A C# implementation of the A2A (Agent-to-Agent) protocol using the official A2A .NET SDK v0.3.3-preview with JSON-RPC and REST transport support.
- Two Transport Modes: JSON-RPC and REST (HTTP+JSON)
- Official A2A SDK: Uses
A2A+A2A.AspNetCore0.3.3-preview NuGet packages - ASP.NET Core: Minimal API
- LLM Integration: Uses Ollama with qwen2.5 model via Semantic Kernel
- Tool Support: Roll dice and check prime numbers
- Streaming: SSE streaming support for both transports
Note: gRPC is not supported in the C# A2A SDK v0.3.3-preview.
| Transport Mode | Server Port | Agent Card URL |
|---|---|---|
| JSON-RPC | 15001 | http://localhost:15001/.well-known/agent-card.json |
| REST (HTTP+JSON) | 15002 | http://localhost:15002/.well-known/agent-card.json |
- .NET 9.0 SDK
- Ollama running locally (
http://localhost:11434) with theqwen2.5model
cd aloha-csharp
dotnet restore
dotnet buildOr use the build script:
# Bash
cd aloha-csharp && ./scripts/build
# PowerShell
cd aloha-csharp && ./scripts/build.batConvenience scripts are provided for running servers and clients:
| Script | Transport | Port |
|---|---|---|
Server/scripts/jsonrpc_server |
JSON-RPC | 15001 |
Server/scripts/rest_server |
REST | 15002 |
Both transports start simultaneously when running either script.
# Bash - Start JSON-RPC server
./Server/scripts/jsonrpc_server
# PowerShell - Start REST server
./Server/scripts/rest_server.bat| Script | Transport | Port |
|---|---|---|
Client/scripts/jsonrpc_client |
JSON-RPC | 15001 |
Client/scripts/rest_client |
REST | 15002 |
# Bash - Test with JSON-RPC client
./Client/scripts/jsonrpc_client
# PowerShell - Test with REST client
./Client/scripts/rest_client.batNote: gRPC is not supported in the C# A2A SDK v0.3.3-preview.
cd aloha-csharp/Server
dotnet runBoth transports start simultaneously:
- JSON-RPC:
http://localhost:15001 - REST:
http://localhost:15002 - Agent Card:
http://localhost:15001/.well-known/agent-card.json
The client uses the A2A SDK with JSON-RPC transport.
cd aloha-csharp/Client
dotnet run -- --message "Roll a 20-sided dice"cd aloha-csharp/Server
dotnet runBoth transports start simultaneously:
- JSON-RPC:
http://localhost:15001 - REST (HTTP+JSON):
http://localhost:15002 - Agent Card:
http://localhost:15001/.well-known/agent-card.json
The client uses the A2A SDK with JSON-RPC transport.
cd aloha-csharp/Client
dotnet run -- --message "Roll a 20-sided dice"# Non-streaming (default)
dotnet run -- --message "Roll a 20-sided dice"
# With streaming
dotnet run -- --stream --message "Check if 17 is prime"
# With custom port
dotnet run -- --port 15001 --message "Roll a 6-sided dice"All settings are in Server/appsettings.json. Override with environment variables.
| Property | Default | Description |
|---|---|---|
Ports:JsonRpc |
15001 |
JSON-RPC server port |
Ports:Rest |
15002 |
REST server port |
Ollama:BaseUrl |
http://localhost:11434 |
Ollama API base URL |
Ollama:Model |
qwen2.5 |
Ollama model name |
Ollama:Temperature |
0.7 |
LLM temperature |
Environment variables (OLLAMA_BASE_URL, OLLAMA_MODEL) take precedence over config file.
-
roll_dice(N): Rolls an N-sided dice
- Example: "Roll a 20-sided dice"
- Example (Chinese): "投掷一个6面骰子"
-
check_prime(nums): Checks if numbers are prime
- Example: "Check if 2, 4, 7, 9, 11 are prime"
- Example (Chinese): "检查17是否为质数"
- A2A Protocol Specification
- A2A .NET SDK v0.3.3-preview
- Semantic Kernel Documentation