These samples demonstrate how to work with Agent-to-Agent (A2A) specific features in the Agent Framework.
For other samples that demonstrate how to use AIAgent instances, see the Getting Started With Agents samples.
See the README.md for each sample for the prerequisites for that sample.
| Sample | Description |
|---|---|
| A2A Agent As Function Tools | This sample demonstrates how to represent an A2A agent as a set of function tools, where each function tool corresponds to a skill of the A2A agent, and register these function tools with another AI agent so it can leverage the A2A agent's skills. |
| A2A Agent Polling For Task Completion | This sample demonstrates how to poll for long-running task completion using continuation tokens with an A2A agent. |
| A2A Agent Stream Reconnection | This sample demonstrates how to reconnect to an A2A agent's streaming response using continuation tokens, allowing recovery from stream interruptions. |
| A2A Agent Protocol Selection | This sample demonstrates how to select the A2A protocol binding (HTTP+JSON vs JSON-RPC) when creating an AIAgent from an A2A agent card using A2AClientOptions. |
To run the samples, navigate to the desired sample directory, e.g.
cd A2AAgent_AsFunctionToolsSet the required environment variables as documented in the sample readme. If the variables are not set, you will be prompted for the values when running the samples. Execute the following command to build the sample:
dotnet buildExecute the following command to run the sample:
dotnet run --no-buildOr just build and run in one step:
dotnet runOpen the solution in Visual Studio and set the desired sample project as the startup project. Then, run the project using the built-in debugger or by pressing F5.
You will be prompted for any required environment variables if they are not already set.