![]() |
VOOZH | about |
dotnet add package A2A --version 1.0.0-preview2
NuGet\Install-Package A2A -Version 1.0.0-preview2
<PackageReference Include="A2A" Version="1.0.0-preview2" />
<PackageVersion Include="A2A" Version="1.0.0-preview2" />Directory.Packages.props
<PackageReference Include="A2A" />Project file
paket add A2A --version 1.0.0-preview2
#r "nuget: A2A, 1.0.0-preview2"
#:package A2A@1.0.0-preview2
#addin nuget:?package=A2A&version=1.0.0-preview2&prereleaseInstall as a Cake Addin
#tool nuget:?package=A2A&version=1.0.0-preview2&prereleaseInstall as a Cake Tool
A .NET library that helps run agentic applications as A2AServers following the Agent2Agent (A2A) Protocol.
The A2A .NET SDK provides a robust implementation of the Agent2Agent (A2A) protocol, enabling seamless communication between AI agents and applications. This library offers both high-level abstractions and fine-grained control, making it easy to build A2A-compatible agents while maintaining flexibility for advanced use cases.
Key features include:
This library implements the A2A v1.0 specification. It provides full support for the JSON-RPC binding and HTTP+JSON REST binding, including streaming via Server-Sent Events.
If you're upgrading from the v0.3 SDK, see the for a comprehensive list of breaking changes and before/after code examples. A backward-compatible A2A.V0_3 NuGet package is available during the transition:
dotnet add package A2A.V0_3
dotnet add package A2A
dotnet add package A2A.AspNetCore
This library contains the core A2A protocol implementation. It includes the following key classes:
A2AClient: Primary client for making A2A requests to agents. Supports both streaming and non-streaming communication, task management, and push notifications.A2ACardResolver: Resolves agent card information from A2A-compatible endpoints to discover agent capabilities and metadata.TaskManager: Manages the complete lifecycle of agent tasks including creation, updates, cancellation, and event streaming. Handles both message-based and task-based communication patterns.ITaskStore: An interface for abstracting the storage of tasks.InMemoryTaskStore: Simple in-memory implementation of ITaskStore suitable for development and testing scenarios.AgentTask: Represents a task with its status, history, artifacts, and metadata.AgentCard: Contains agent metadata, capabilities, and endpoint information.Message: Represents messages exchanged between agents and clients.This library provides ASP.NET Core integration for hosting A2A agents. It includes the following key classes:
A2ARouteBuilderExtensions: Provides MapA2A() and MapHttpA2A() extension methods for configuring A2A endpoints in ASP.NET Core applications.using A2A;
using A2A.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var store = new InMemoryTaskStore();
var taskManager = new TaskManager(store);
taskManager.OnSendMessage = async (request, ct) =>
{
var text = request.Message.Parts.FirstOrDefault()?.Text ?? "";
return new SendMessageResponse
{
Message = new Message
{
MessageId = Guid.NewGuid().ToString("N"),
Role = Role.Agent,
Parts = [Part.FromText($"Echo: {text}")]
}
};
};
var agentCard = new AgentCard
{
Name = "Echo Agent",
Description = "Echoes messages back to the user",
Version = "1.0.0",
SupportedInterfaces = [new AgentInterface
{
Url = "http://localhost:5000/echo",
ProtocolBinding = "JSONRPC",
ProtocolVersion = "1.0"
}],
DefaultInputModes = ["text/plain"],
DefaultOutputModes = ["text/plain"],
Capabilities = new AgentCapabilities { Streaming = false },
Skills = [new AgentSkill
{
Id = "echo",
Name = "Echo",
Description = "Echoes back user messages",
Tags = ["echo"]
}],
};
app.MapA2A(taskManager, "/echo");
app.MapWellKnownAgentCard(agentCard);
app.Run();
using A2A;
// Discover agent
var cardResolver = new A2ACardResolver(new Uri("http://localhost:5000/"));
var agentCard = await cardResolver.GetAgentCardAsync();
// Create client using agent's endpoint
var client = new A2AClient(new Uri(agentCard.SupportedInterfaces[0].Url));
// Send message
var response = await client.SendMessageAsync(new SendMessageRequest
{
Message = new Message
{
MessageId = Guid.NewGuid().ToString("N"),
Role = Role.User,
Parts = [Part.FromText("Hello!")]
}
});
// Handle response
switch (response.PayloadCase)
{
case SendMessageResponseCase.Message:
Console.WriteLine(response.Message!.Parts[0].Text);
break;
case SendMessageResponseCase.Task:
Console.WriteLine($"Task created: {response.Task!.Id}");
break;
}
The repository includes several sample projects demonstrating different aspects of the A2A protocol implementation. Each sample includes its own README with detailed setup and usage instructions.
Comprehensive collection of client-side samples showing how to interact with A2A agents:
Server-side examples demonstrating how to build A2A-compatible agents:
Advanced sample showing integration with Microsoft Semantic Kernel:
Command-line tool for interacting with A2A agents:
Clone and build the repository:
git clone https://github.com/a2aproject/a2a-dotnet.git
cd a2a-dotnet
dotnet build
Run the client samples:
cd samples/AgentClient
dotnet run
For detailed instructions and advanced scenarios, see the individual README files linked above.
To learn more about the A2A protocol, explore these additional resources:
This library builds upon Darrel Miller's sharpa2a project. Thanks to Darrel and all the other contributors for the foundational work that helped shape this SDK.
This project is licensed under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on A2A:
| Package | Downloads |
|---|---|
|
A2A.AspNetCore
ASP.NET Core extensions for the Agent2Agent (A2A) protocol. |
|
|
Microsoft.Agents.AI.Hosting.A2A
Microsoft Agent Framework is a comprehensive .NET library for building, orchestrating, and deploying AI agents and multi-agent workflows. The framework provides everything from simple chat agents to complex multi-agent systems with graph-based orchestration capabilities. |
|
|
Microsoft.Agents.AI.Hosting.A2A.AspNetCore
Provides Microsoft Agent Framework support for hosting A2A agents in an ASP.NET Core context. |
|
|
Microsoft.Agents.AI.A2A
Provides Microsoft Agent Framework support for Agent2Agent (A2A) protocol. |
|
|
Microsoft.SemanticKernel.Agents.A2A
Defines a concrete Agent based on the A2A Protocol. |
Showing the top 7 popular GitHub repositories that depend on A2A:
| Repository | Stars |
|---|---|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
|
SciSharp/BotSharp
AI Multi-Agent Framework in .NET
|
|
|
dapr/dotnet-sdk
Dapr SDK for .NET
|
|
|
lofcz/LLMTornado
The .NET library to build AI agents with 30+ built-in connectors.
|
|
|
clawdotnet/openclaw.net
Self-hosted OpenClaw gateway + agent runtime in .NET (NativeAOT-friendly)
|
|
|
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
|
|
|
Azure-Samples/eShopLite
eShopLite is a set of reference .NET applications implementing an eCommerce site with features like Semantic Search, MCP, Reasoning models and more.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview2 | 78,816 | 4/9/2026 |
| 1.0.0-preview | 29,832 | 3/16/2026 |
| 0.3.4-preview | 73,304 | 3/6/2026 |
| 0.3.3-preview | 143,628 | 10/21/2025 |
| 0.3.2-preview | 328 | 10/21/2025 |
| 0.3.1-preview | 98,942 | 9/4/2025 |
| 0.1.0-preview.2 | 61,938 | 7/31/2025 |