Project website ยท Turul family
Rust implementation of the A2A (Agent-to-Agent) Protocol v1.0.
Proto-first: types are generated from the normative proto/a2a.proto (package lf.a2a.v1) via prost + pbjson, then wrapped in ergonomic Rust types. Wire format is interop-tested against the official Go A2A SDK.
| Crate | docs.rs | Description |
|---|---|---|
turul-a2a-proto |
๐ | Proto-generated types with camelCase JSON via pbjson |
turul-a2a-types |
๐ | Ergonomic wrappers, state machine, #[non_exhaustive] |
turul-a2a |
๐ | Server framework: HTTP + JSON-RPC + SSE, storage, middleware |
turul-a2a-auth |
๐ | Bearer JWT and API key middleware |
turul-a2a-client |
๐ | Client library: discovery, send, stream, subscribe; builds for wasm32 (browser or Node) |
turul-a2a-aws-lambda |
๐ | AWS Lambda adapter |
turul-jwt-validator |
๐ | Local JWT validator with JWKS caching |
[dependencies] turul-a2a = "0.2" turul-a2a-client = "0.2" tokio = { version = "1", features = ["full"] }
cargo run -p echo-agent # runs on :3000 curl -X POST http://localhost:3000/message:send \ -H 'Content-Type: application/json' -H 'a2a-version: 1.0' \ -d '{"message":{"messageId":"1","role":"ROLE_USER","parts":[{"text":"hello"}]}}'
use turul_a2a::prelude::*; struct MyAgent; #[async_trait::async_trait] impl AgentExecutor for MyAgent { async fn execute(&self, task: &mut Task, message: &Message, _ctx: &ExecutionContext) -> Result<(), A2aError> { task.push_text_artifact("result", "Response", format!("You said: {}", message.joined_text())); task.complete(); Ok(()) } fn agent_card(&self) -> turul_a2a_proto::AgentCard { AgentCardBuilder::new("My Agent", "1.0.0") .streaming(true) .build() .unwrap() } } #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { A2aServer::builder().executor(MyAgent).bind(([0, 0, 0, 0], 3000)).build()?.run().await?; Ok(()) }
The card's capability flags are enforced (A2A v1.0.1 ยง3.3.4): streaming,
push-notification configs and the extended agent card are refused unless
the card declares streaming(true), push_notifications(true) or
extended_agent_card(true). AgentCardBuilder leaves all three unset.
See crates/turul-a2a/README.md for storage wiring, durable streaming, and feature flags.
use turul_a2a_client::prelude::*; let client = A2aClient::discover("http://localhost:3000").await?; let reply = client.send_message(MessageBuilder::new().text("hello")).await?;
See crates/turul-a2a-client/README.md for streaming, push config, tenant routing and WebAssembly (ADR-033).
Four parity-tested backends. Pick one with a feature flag and pass the instance to .storage():
| Backend | Feature | Notes |
|---|---|---|
| In-memory | in-memory (default) |
Volatile, single-process. |
| SQLite | sqlite |
File-backed, atomic task + event writes. |
| PostgreSQL | postgres |
Multi-instance ready. |
| DynamoDB | dynamodb |
TTL-aware, AWS deployments. |
use turul_a2a_auth::{ApiKeyMiddleware, BearerMiddleware}; let auth = ApiKeyMiddleware::new(Arc::new(my_lookup), "X-API-Key"); // or: BearerMiddleware::new(jwt_validator, "sub"); A2aServer::builder().executor(MyAgent).middleware(Arc::new(auth)).build()?;
| Transport | Default | Where to read |
|---|---|---|
| HTTP + JSON | yes | This crate. |
| JSON-RPC | yes | This crate (POST /jsonrpc, 11 methods). |
| SSE streaming | yes | This crate. |
| gRPC | feature grpc |
crates/turul-a2a/README.md |
| AWS Lambda | separate crate | crates/turul-a2a-aws-lambda/README.md |
Verified against the official Go A2A SDK (v2, spec v1.0):
cd interop/go-sdk TURUL_SERVER_URL=http://localhost:3000 go test -v
cargo build --workspace
cargo test --workspace
cargo clippy --workspace -- -D warnings
cargo fmt --all -- --checkArchitecture rationale lives under docs/adr/. Per-crate READMEs cover crate-local concerns.
MIT OR Apache-2.0
Turul brand artwork is ยฉ 2026 Toast Technology Pty Ltd, all rights reserved, and is excluded from the software licence. See the artwork notice and master assets.