![]() |
VOOZH | about |
dotnet add package A2A.AspNetCore --version 0.3.3-preview
NuGet\Install-Package A2A.AspNetCore -Version 0.3.3-preview
<PackageReference Include="A2A.AspNetCore" Version="0.3.3-preview" />
<PackageVersion Include="A2A.AspNetCore" Version="0.3.3-preview" />Directory.Packages.props
<PackageReference Include="A2A.AspNetCore" />Project file
paket add A2A.AspNetCore --version 0.3.3-preview
#r "nuget: A2A.AspNetCore, 0.3.3-preview"
#:package A2A.AspNetCore@0.3.3-preview
#addin nuget:?package=A2A.AspNetCore&version=0.3.3-preview&prereleaseInstall as a Cake Addin
#tool nuget:?package=A2A.AspNetCore&version=0.3.3-preview&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 most of the features of protocol v0.2.6, however there are some scenarios that are not yet complete for full compatibility with this version. A complete list of outstanding compatibility items can be found at: open compatibility items
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();
// Create and register your agent
var taskManager = new TaskManager();
var agent = new EchoAgent();
agent.Attach(taskManager);
app.MapA2A(taskManager, "/echo");
app.Run();
public class EchoAgent
{
public void Attach(ITaskManager taskManager)
{
taskManager.OnMessageReceived = ProcessMessageAsync;
taskManager.OnAgentCardQuery = GetAgentCardAsync;
}
private Task<Message> ProcessMessageAsync(MessageSendParams messageSendParams, CancellationToken cancellationToken)
{
var text = messageSendParams.Message.Parts.OfType<TextPart>().First().Text;
return Task.FromResult(new Message
{
Role = MessageRole.Agent,
MessageId = Guid.NewGuid().ToString(),
ContextId = messageSendParams.Message.ContextId,
Parts = [new TextPart { Text = $"Echo: {text}" }]
});
}
private Task<AgentCard> GetAgentCardAsync(string agentUrl, CancellationToken cancellationToken)
{
return Task.FromResult(new AgentCard
{
Name = "Echo Agent",
Description = "Echoes messages back to the user",
Url = agentUrl,
Version = "1.0.0",
DefaultInputModes = ["text"],
DefaultOutputModes = ["text"],
Capabilities = new AgentCapabilities { Streaming = true }
});
}
}
using A2A;
// Discover agent and create client
var cardResolver = new A2ACardResolver(new Uri("http://localhost:5100/"));
var agentCard = await cardResolver.GetAgentCardAsync();
var client = new A2AClient(new Uri(agentCard.Url));
// Send message
var response = await client.SendMessageAsync(new MessageSendParams
{
Message = new Message
{
Role = MessageRole.User,
Parts = [new TextPart { Text = "Hello!" }]
}
});
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 is compatible. 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 was computed. 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.AspNetCore:
| Package | Downloads |
|---|---|
|
Microsoft.Agents.AI.Hosting.A2A.AspNetCore
Provides Microsoft Agent Framework support for hosting A2A agents in an ASP.NET Core context. |
|
|
LlmTornado.A2A
Enable seamless collaboration between AI agents across different platforms with the Agent2Agent (A2A) protocol. |
|
|
AgentCircuits.Portal
Web-based management portal for AgentCircuits. Provides dashboard, agent configuration UI, session viewer, and interactive playground. |
|
|
AgentCircuits.A2A
A2A (Agent-to-Agent) protocol support for AgentCircuits. Enables cross-platform agent communication via the standard A2A protocol. |
|
|
CrestApps.OrchardCore.AI.Core
CrestApps enhances the capabilities of Orchard Core, a modular and multi-tenant application framework built on ASP.NET Core. By leveraging Orchard Core's powerful foundation for creating dynamic, data-driven websites and applications, CrestApps introduces additional features and tools that empower developers to build more flexible, scalable, and feature-rich solutions. OrchardCore-specific AI core services that extend the framework-independent CrestApps.Core.AI.Core. |
Showing the top 4 popular GitHub repositories that depend on A2A.AspNetCore:
| Repository | Stars |
|---|---|
|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
|
lofcz/LLMTornado
The .NET library to build AI agents with 30+ built-in connectors.
|
|
|
clawdotnet/openclaw.net
Self-hosted Personal AI + agent runtime in .NET (NativeAOT-friendly)
|
|
|
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview2 | 75,227 | 4/9/2026 |
| 1.0.0-preview | 25,993 | 3/16/2026 |
| 0.3.4-preview | 58,771 | 3/6/2026 |
| 0.3.3-preview | 111,017 | 10/21/2025 |
| 0.3.2-preview | 291 | 10/21/2025 |
| 0.3.1-preview | 85,002 | 9/4/2025 |
| 0.1.0-preview.2 | 47,672 | 7/31/2025 |