a2a-net.Core
0.12.0
Prefix Reserved
dotnet add package a2a-net.Core --version 0.12.0
NuGet\Install-Package a2a-net.Core -Version 0.12.0
<PackageReference Include="a2a-net.Core" Version="0.12.0" />
<PackageVersion Include="a2a-net.Core" Version="0.12.0" />
<PackageReference Include="a2a-net.Core" />
paket add a2a-net.Core --version 0.12.0
#r "nuget: a2a-net.Core, 0.12.0"
#:package a2a-net.Core@0.12.0
#addin nuget:?package=a2a-net.Core&version=0.12.0
#tool nuget:?package=a2a-net.Core&version=0.12.0
A2A-NET
Agent-to-Agent (A2A) is a lightweight, extensible protocol and framework for orchestrating tasks and exchanging structured content between autonomous agents using JSON-RPC 2.0.
๐งฉ Projects
๐ง Core
A2A.Core
Contains the core abstractions, models, contracts, and data types shared across both clients and servers.
Includes agent cards, messages, tasks, artifacts, capabilities, and JSON-RPC protocol definitions.
This package is dependency-free and safe to use in any environment.
๐ก Client
A2A.Client.Abstractions
Defines the core interfaces and contracts for implementing A2A clients, includingIA2AClientand protocol APIs.A2A.Client
Provides client-side functionality for A2A agent discovery and metadata resolution.
Includes utilities for retrieving agent cards and establishing connections.A2A.Client.Transports.Http
Implements the HTTP transport for theIA2AClient.
Enables agent-to-agent communication over HTTP using JSON-RPC 2.0.A2A.Client.Transports.Grpc
Implements the gRPC transport for theIA2AClient.
Enables persistent, bidirectional agent-to-agent communication over gRPC connections.A2A.Client.Transports.JsonRpc
Implements the JSON-RPC transport for theIA2AClient.
Enables persistent, bidirectional agent-to-agent communication over JSON-RPC connections.
๐ ๏ธ Server
A2A.Server.Abstractions
Defines core server-side abstractions includingIA2AServer,IA2AAgentRuntime,IA2AStore, task queuing, and event streaming interfaces.
Provides the foundation for building custom A2A-compatible agent implementations.A2A.Server
Core server components for building A2A-compatible agents.
Includes task execution orchestration, state management, event streaming, and agent runtime integration.A2A.Server.Transports.Http
Implements the HTTP transport for theIA2AServer.
Enables agent-to-agent communication over HTTP using JSON-RPC 2.0.A2A.Server.Transports.Grpc
Implements the gRPC transport for theIA2AServer.
Enables persistent, bidirectional agent-to-agent communication over gRPC connections.A2A.Server.Transports.JsonRpc
Implements the JSON-RPC transport for theIA2AServer.
Enables persistent, bidirectional agent-to-agent communication over JSON-RPC connections.A2A.Server.Persistence.Memory
In-memory implementation ofIA2AStorefor lightweight, ephemeral task state persistence.A2A.Server.Persistence.RedisRedis-based implementation ofIA2AStorefor distributed, scalable task state persistence.A2A.Server.Scheduling.Memory
In-memory task scheduling and queuing implementation.A2A.Server.Scheduling.Quartz
Quartz-based task scheduling and queuing implementation for advanced scheduling scenarios.
๐ Getting Started
Install the packages
dotnet add package A2A.Core
dotnet add package A2A.Client.Abstractions
dotnet add package A2A.Client
dotnet add package A2A.Client.Transports.Http
dotnet add package A2A.Client.Transports.Grpc
dotnet add package A2A.Client.Transports.JsonRpc
dotnet add package A2A.Server.Abstractions
dotnet add package A2A.Server
dotnet add package A2A.Server.Transports.Http
dotnet add package A2A.Server.Transports.Grpc
dotnet add package A2A.Server.Transports.JsonRpc
dotnet add package A2A.Server.Persistence.Memory
dotnet add package A2A.Server.Persistence.Redis
dotnet add package A2A.Server.Scheduling.Memory
dotnet add package A2A.Server.Scheduling.Quartz
Discover a remote agent
var discoveryDocument = await httpClient.GetA2ADiscoveryDocumentAsync(new Uri("http://localhost"));
Configure and use a client
services.AddA2AClient(client =>
{
client.UseHttpTransport(new Uri("http://localhost"));
client.UseGrpcTransport(new Uri("http://localhost:5000"));
client.UseJsonRpcTransport(new Uri("http://localhost:6000"));
});
Host an agent
Configure services
builder.Services.AddA2AServer(server =>
{
server
.Host(agent => agent
.WithCard(card => card
.WithName("Sample Agent")
.WithDescription("An example agent for demonstration purposes.")
.WithVersion("1.0.0")
.WithSkill(skill => skill
.WithName("Chat")
.WithDescription("A skill for engaging in conversations.")
.WithTag("chat"))
.SupportsPushNotifications()
.SupportsStreaming()
.SupportsStateTransitionHistory())
.UseRuntime<ChatAgent>())
.UseMemoryStore()
.UseMemoryTaskQueue()
.UseHttpTransport()
.UseGrpcTransport()
.UseJsonRpcTransport("/json-rpc");
});
Configure the application
app.UseA2AServer();
Implement an agent runtime
public class ChatAgent(Kernel kernel)
: IA2AAgentRuntime
{
public Task<Models.Response> ProcessAsync(Models.Message message, CancellationToken cancellationToken = default)
{
var task = new Models.Task()
{
ContextId = message.ContextId ?? Guid.NewGuid().ToString("N"),
History = [message]
};
return Task.FromResult<Models.Response>(task);
}
public async IAsyncEnumerable<Models.TaskEvent> ExecuteAsync(Models.Task task, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
var chat = kernel.GetRequiredService<IChatClient>();
var message = task.History?.LastOrDefault() ?? throw new NullReferenceException($"The history of the task with the specified id '{task.Id}' is null or empty.");
var messageText = string.Join('\n', message.Parts.OfType<Models.TextPart>().Select(p => p.Text));
var artifactId = Guid.NewGuid().ToString("N");
var isFirstChunk = true;
yield return new Models.TaskStatusUpdateEvent()
{
ContextId = task.ContextId,
TaskId = task.Id,
Status = new()
{
State = TaskState.Working,
Message = new()
{
ContextId = task.ContextId,
TaskId = task.Id,
Role = Role.Agent,
Parts =
[
new Models.TextPart()
{
Text = "Processing started by Semantic Kernel Chat Agent."
}
]
}
}
};
var stopwatch = Stopwatch.StartNew();
await foreach (var content in chat.GetStreamingResponseAsync(messageText, new(), cancellationToken))
{
yield return new Models.TaskArtifactUpdateEvent()
{
ContextId = task.ContextId,
TaskId = task.Id,
Artifact = new()
{
ArtifactId = artifactId,
Parts =
[
new Models.TextPart()
{
Text = content.Text
}
]
},
Append = !isFirstChunk
};
isFirstChunk = false;
}
stopwatch.Stop();
yield return new Models.TaskStatusUpdateEvent()
{
ContextId = task.ContextId,
TaskId = task.Id,
Status = new()
{
State = TaskState.Completed,
Message = new()
{
ContextId = task.ContextId,
TaskId = task.Id,
Role = Role.Agent,
Parts =
[
new Models.TextPart()
{
Text = $"Processing completed in {stopwatch.ElapsedMilliseconds}ms."
}
]
}
},
Final = true
};
}
}
๐ Documentation
For a full overview of the A2A protocol, see https://a2a-protocol.org/.
๐ Tools
Explore tools for working with the A2A protocol and ecosystem:
- Client Console
A simple console application that demonstrates how to interact with A2A-compatible agents using the A2A-NET client.
It allows you to discover agents, send messages, and receive responses over different transports (HTTP, gRPC, JSON-RPC).
๐งช Samples
Explore sample projects demonstrating how to use the A2A-NET solution:
- Semantic Kernel
Demonstrates how to build and host an A2A-compatible agent using Microsoft's Semantic Kernel andOpenAI.
Includes both a server that exposes the agent and a client that interacts with it overHTTPusing theJSON-RPCprotocol.
๐ฏ Key Features
- ๐ Protocol Compliance: Full implementation of the A2A protocol
- ๐ Multiple Transports: HTTP, gRPC and JSON-RPC support for flexible communication patterns
- ๐ Task Management: Complete lifecycle management for agent tasks with state persistence
- ๐ Push Notifications: Configurable push notification system for real-time updates
- ๐ก Event Streaming: Real-time task event streaming with artifact and status updates
- ๐ Pluggable Architecture: Extensible infrastructure with custom storage and event streaming backends
- ๐ญ Agent Discovery: Built-in agent card discovery and metadata resolution
๐ก License
This project is licensed under the Apache-2.0 License.
๐ค Contributing
Contributions are welcome! Please open issues and PRs to help improve the ecosystem.
See contribution guidelines for more information on how to contribute.
๐ Acknowledgments
This project implements the Agent-to-Agent (A2A) protocol specification.
For more information about the A2A protocol, visit https://a2a-protocol.org/.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (8)
Showing the top 5 NuGet packages that depend on a2a-net.Core:
| Package | Downloads |
|---|---|
|
a2a-net.Server.Infrastructure.Abstractions
Contains service abstractions used by the A2A server infrastructure |
|
|
a2a-net.Client.Abstractions
Contains the core abstractions and building blocks for an A2A client. |
|
|
Yaap.A2A.Client.Abstractions
Package Description |
|
|
Yaap.A2A.Server.Abstractions
Package Description |
|
|
a2a-net.Core.JsonRpc
Contains the core JSON-RPC abstractions and building blocks of the A2A Protocol. |
GitHub repositories
This package is not used by any popular GitHub repositories.