SharpA2A.AspNetCore 0.1.0-preview.1

This is a prerelease version of SharpA2A.AspNetCore.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SharpA2A.AspNetCore --version 0.1.0-preview.1
                    
NuGet\Install-Package SharpA2A.AspNetCore -Version 0.1.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpA2A.AspNetCore" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpA2A.AspNetCore" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="SharpA2A.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpA2A.AspNetCore --version 0.1.0-preview.1
                    
#r "nuget: SharpA2A.AspNetCore, 0.1.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpA2A.AspNetCore@0.1.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpA2A.AspNetCore&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SharpA2A.AspNetCore&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

SharpA2A: A .NET implementation of the Google A2A protocol

Interact with agents using the A2A protocol in .NET applications. This library is designed to be used with ASP.NET Core applications and provides a simple way to add A2A support to your agents.

Status

This library is in early development and is not yet ready for production use. The following shows the current status of the library:

  • Server
    • task/send (push notification set is not yet implemented)
    • task/sendsubscribe
    • task/get (history length is not yet implemented)
    • task/pushnotification/set (Client notifications are not yet sent)
    • task/pushnotification/get
  • Client
    • task/send
    • task/get
    • task/sendsubscribe (Not yet implemented)
    • task/pushnotification/set (Client notifications cannot yet be received)
    • task/pushnotification/get

Overview

alt text

Library: a2a.AspNetCore

This library adds the MapA2A extension method that allows you to add A2A support to an Agent hosted at the specified path.

var echoAgent = new EchoAgent();
var echoTaskManager = new TaskManager();
echoAgent.Attach(echoTaskManager);
app.MapA2A(echoTaskManager,"/echo");

Library: SharpA2A.Core

This library contains the core A2A protocol implementation. It includes the following classes:

  • A2AClient: Used for making A2A requests to an agent.
  • TaskManager: Provides standardized support for managing tasks and task execution.
  • ITaskStore: An interface for abstracting the storage of tasks. InMemoryTaskStore is a simple in-memory implementation.

Library: DomFactory

This library contains helper classes for support deserialization and serialization of A2A messages and JsonRPC envelopes. In theory this can be done with JsonSerializer, but this library makes the process easier to debug and doesn't require an reflection or code generation.

Agent Integration Example

Each agent instance should be given its own TaskManager instance. The TaskManager is responsible for managing the tasks and their execution. It is an implementation decision as to whether a single agent instance processes many tasks or whether an agent instance is created for each task.

using SharpA2A.Core;

public class EchoAgent
{
    private TaskManager? _TaskManager;

    public void Attach(TaskManager taskManager)
    {
        _TaskManager = taskManager;
        taskManager.OnTaskCreated = ExecuteAgentTask;
        taskManager.OnTaskUpdated = ExecuteAgentTask;
    }

    public async Task ExecuteAgentTask(AgentTask task) {
        if  (_TaskManager == null) {
            throw new Exception("TaskManager is not attached.");
        }
        // Set Status to working
        await _TaskManager.UpdateStatusAsync(task.Id, TaskState.Working);

        var message = task.History!.Last().Parts.First().AsTextPart().Text;
        var artifact = new Artifact() {
            Parts = [new TextPart() {
                Text = $"Echo: {message}"
            }]
        };
        await _TaskManager.ReturnArtifactAsync(new TaskIdParams() {Id = task.Id}, artifact);
        await _TaskManager.UpdateStatusAsync(task.Id, TaskState.Completed, final: true);
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.2-preview.1 886 6/30/2025
0.2.1-preview.1 4,440 6/11/2025
0.1.0-preview.6 124 6/3/2025
0.1.0-preview.5 57 5/23/2025
0.1.0-preview.4 354 5/14/2025
0.1.0-preview.3 249 5/14/2025
0.1.0-preview.2 203 5/13/2025
0.1.0-preview.1 175 5/12/2025
0.1.0-preview 169 5/12/2025