Skip to main content

Crate turul_a2a

Crate turul_a2a 

Source
Expand description

A2A Protocol v1.0 server framework.

turul-a2a provides the server side of the A2A Protocol: a typed executor::AgentExecutor trait, HTTP + JSON-RPC transports, Server-Sent Events streaming, and a storage abstraction with four backends (in-memory, SQLite, PostgreSQL, DynamoDB) — all proto-normative per proto/a2a.proto.

§Quick start

See the examples/echo-agent crate for a runnable end-to-end example. A minimal executor implements executor::AgentExecutor and is passed to A2aServer::builder():

let server = A2aServer::builder()
    .executor(MyExecutor)
    .bind(([0, 0, 0, 0], 3000))
    .build()?;
server.run().await?;

§Feature flags

  • in-memory (default) — volatile in-process storage
  • sqlite — SQLx SQLite backend (atomic task+event writes)
  • postgres — SQLx PostgreSQL backend
  • dynamodb — AWS DynamoDB backend with TTL
  • compat-v03 — opt-in compatibility shim for a2a-sdk 0.3.x clients (method name normalization, root POST route, optional A2A-Version header). Canonical builds are v1.0 strict.

§Durable event coordination

Task state and streaming events are written atomically via storage::A2aAtomicStore. The in-process event broker is a local wake-up signal; the storage backend is the source of truth. Subscribers attached while a task is non-terminal receive replay of prior events and then live delivery, supporting Last-Event-ID reconnection across instances when the same backend is used (e.g., shared DynamoDB or PostgreSQL). Subscribing to an already-terminal task returns UnsupportedOperationError per A2A v1.0 §3.1.6 — use storage or GetTask to retrieve the final state.

§Multi-instance streaming

The in-process streaming broker fans out to clients on the same process only. Cross-instance streaming relies on the shared durable event store for replay. For horizontally scaled deployments, configure all instances against the same backend.

Re-exports§

pub use server::A2aServer;

Modules§

card_builder
Ergonomic builders for AgentCard and AgentSkill.
durable_executor
Durable executor continuation.
error
Server-level A2A error types with HTTP and JSON-RPC mapping.
event_sink
Executor-facing EventSink — ADR-010 §2.
executor
AgentExecutor trait — the user-facing contract for agent behavior.
jsonrpc
JSON-RPC 2.0 dispatch layer.
middleware
prelude
Server/agent-authoring prelude.
push
Push notification delivery.
router
HTTP router matching proto google.api.http annotations.
server
A2aServer builder and runtime.
storage
streaming
SSE streaming infrastructure for A2A task events.