Expand description
Server framework for implementing A2A agents.
Modules§
- __types
- A2A protocol v1.0 — pure data types with serde support.
- admission
- An opt-in admission gate for sends: a capacity, slots reserved per tenant, a bounded wait, priority classes and weighted fairness, all set by the server (audit H9, ADR 0045).
- agent_
card - Agent card HTTP handlers (static, dynamic, and caching utilities).
- approval
- The server half of the approval extension: checking a person’s decision before the executor acts on it.
- audit
audit - A tamper-evident audit trail of who did what to which task (ADR 0015).
- auth
- Server-side authentication interceptors.
- builder
- Builder for
RequestHandler. - call_
context - Call context for server-side interceptors.
- conformance
conformance - A conformance harness for
AgentExecutorimplementations. - dispatch
- HTTP dispatch layer — JSON-RPC and REST routing, apart or on one listener
(
CombinedDispatcher). - error
- Server-specific error types.
- executor
- Agent executor trait.
- executor_
helpers - Ergonomic helpers for implementing
AgentExecutor. - handler
- Core request handler — protocol logic layer.
- interceptor
- Server-side interceptor chain.
- metrics
- Metrics hooks for observing handler activity.
- otel
otel - OpenTelemetry integration for the A2A server.
- profile
- Deployment profiles: one call that applies the settings a kind of
deployment needs, and a
build()that refuses the ones it cannot have. - push
- Push notification configuration storage and delivery.
- rate_
limit - Fixed-window rate limiter as a
ServerInterceptor. - request_
context - Request context passed to the
AgentExecutor. - serve
- Server startup.
- skills
skills - Agent Skills in the tool loop, without running their scripts (ADR 0035;
feature
skills). - steering
- Steering a running task: a message to a task that is still
working, delivered to the executor through an inbox (ADR 0036, the extension ina2a_protocol_types::steering). - store
- Task storage backend.
- streaming
- Streaming infrastructure for SSE responses and event queues.
- tenant_
config - Per-tenant resource limits for multi-tenant A2A servers.
- tenant_
resolver - Tenant resolution for multi-tenant A2A servers.
- tool_
loop tool-loop - Tool calling: a model, the tools it may call, and the bounded loop
between them, run as an A2A task (ADR 0022; feature
tool-loop). - url_
guard - Refusing URLs that point into the server’s own network (SSRF).
Macros§
- agent_
executor - Generates an
AgentExecutorimplementation from a closure-like syntax.
Structs§
- A2aRouter
axum - Builder for an Axum [
Router] that serves all A2A v1.0 protocol methods. - ApiKey
Auth Interceptor - Rejects requests whose API-key header is absent or not in the allowed set.
- Artifact
Chunk - Where an artifact update event sits in its artifact.
- Auth
Failure Throttle - Refuses a peer that has failed authentication too often; see the module docs.
- Auth
Failure Throttle Config - Configuration for an
AuthFailureThrottle. - Bearer
Token Auth Interceptor - Rejects requests whose
Authorization: Bearer <token>is absent or whose token is not in the allowed set. - Bearer
Token Tenant Resolver - Extracts a tenant ID from the
Authorization: Bearer <token>header. - Binding
Span - One inbound call on a binding outside this crate: the
SERVERspan it runs in, and itsrpc.server.call.duration, exactly as the bindings in this crate record theirs. - Call
Context - Metadata about the current server-side method call.
- Cancellation
Token - The type of
RequestContext::cancellation_token, re-exported so an executor can name it — to store it, or create one in a test — without its owntokio-utildependency at a version that must match this crate’s (N16). A token which can be used to signal a cancellation request to one or more tasks. - Combined
Dispatcher - JSON-RPC and HTTP+JSON for one
RequestHandleron one listener; see the module docs for how a request is routed. - Connection
Pool Stats - Statistics about the HTTP connection pool.
- Cors
Config - CORS configuration for A2A dispatchers.
- Custom
Binding - How a binding outside this crate names itself on its spans and in
rpc.server.call.duration. - Dispatch
Config - Configuration for dispatch-layer limits shared by both JSON-RPC and REST dispatchers.
- Dynamic
Agent Card Handler - Serves a dynamically generated
AgentCardas a JSON HTTP response. - Event
Emitter - Ergonomic helper for emitting status and artifact events from an executor.
- Event
Queue Manager - Manages event queues for active tasks.
- Grpc
Config grpc - Configuration for the gRPC dispatcher.
- Grpc
Dispatcher grpc - gRPC dispatcher that routes A2A requests to a
RequestHandler. - Halt
Report - What
RequestHandler::haltdid to the tasks that were running. - Handler
Limits - Configurable limits for the request handler.
- Header
Tenant Resolver - Extracts a tenant ID from a configurable HTTP header.
- HotReload
Agent Card Handler - An agent card handler that supports hot-reloading.
- Http
Push Sender - HTTP-based
PushSenderusing hyper. - InFlight
Report - What
RequestHandler::cancel_in_flightdid. - InMemory
Push Config Store - In-memory
PushConfigStorebacked by aHashMap. - InMemory
Queue Reader - In-memory
EventQueueReaderbacked by abroadcastchannel receiver. - InMemory
Queue Writer - In-memory
EventQueueWriterbacked by abroadcastchannel sender. - InMemory
Task Store - In-memory
TaskStorebacked by a pre-allocatedHashMapwith secondary indexes under a single [RwLock]. - Inbox
- The messages sent to a running turn, oldest first, bounded.
- Invalid
Trusted Proxy - Why a string is not a
TrustedProxy. - Json
RpcDispatcher - JSON-RPC 2.0 request dispatcher.
- Load
Report - What one replica holds now: see
RequestHandler::load. - Migration
sqlite - A single schema migration.
- Migration
Runner sqlite - Runs schema migrations against a
SQLitedatabase. - Open
AiChat Model tool-loop - A
ToolModelthat sends each turn asPOST {base}/chat/completions. - Otel
Metrics otel - A
Metricsimplementation backed by OpenTelemetry instruments. - Path
Segment Tenant Resolver - Extracts a tenant ID from a URL path segment by index.
- Peer
Addr - The address of the connection a request arrived on, as an HTTP request extension.
- Peer
Certificate - The certificate a client presented in the TLS handshake of the connection a request arrived on, DER-encoded, as an HTTP request extension; see the module docs.
- PerTenant
Config - Per-tenant configuration for timeouts, capacity limits, and executor selection.
- PgMigration
postgres - A single schema migration.
- PgMigration
Runner postgres - Runs schema migrations against a
PostgreSQLdatabase. - Postgres
Push Config Store postgres PostgreSQL-backedPushConfigStore.- Postgres
Rate Limit Counter postgres - A
RateLimitCounterbacked by aPostgreSQLtable. - Postgres
Task Store postgres PostgreSQL-backedTaskStore.- Push
Retry Policy - Retry policy for push notification delivery.
- Rate
Limit Config - Configuration for
RateLimitInterceptor. - Rate
Limit Interceptor - A fixed-window rate limiting
ServerInterceptor. - Reloading
Cert Resolver tls-rustls - A [
ResolvesServerCert] that serves the certificate chain and key in two PEM files and replaces them when the files change. - Request
Context - Context for a single agent execution request.
- Request
Handler - The core protocol logic handler.
- Request
Handler Builder - Fluent builder for
RequestHandler. - Rest
Dispatcher - REST HTTP request dispatcher.
- RpcCall
- One finished inbound call, as
Metrics::on_rpc_callreports it. - Serve
Config - Limits applied to a
Server. - Serve
Report - What the socket layer did, and whether it finished.
- Server
- A bound listener that has not started accepting yet.
- Server
Interceptor Chain - An ordered chain of
ServerInterceptorinstances. - Shutdown
Report - What a shutdown actually managed to do.
- Sqlite
Push Config Store sqlite - SQLite-backed
PushConfigStore. - Sqlite
Task Store sqlite - SQLite-backed
TaskStore. - Static
Agent Card Handler - Serves a pre-serialized
AgentCardas a JSON HTTP response with caching. - Steered
- A steering message as the executor receives it: the message, and who sent it as authentication established.
- Steering
Config - Turns steering on, and sets its two bounds. See
RequestHandlerBuilder::with_steering. - Stream
End - The claim a response stream holds on the call it answers. Dropped
without
end, the stream was abandoned. - Stream
Event - One event as it travels the queue, carrying the position it holds in the task’s event log.
- Task
Store Config - Configuration for
InMemoryTaskStore. - Tenant
Aware InMemory Push Config Store - Tenant-isolated in-memory
PushConfigStore. - Tenant
Aware InMemory Task Store - Tenant-isolated in-memory
TaskStore. - Tenant
Aware Postgres Push Config Store postgres - Tenant-scoped
PostgreSQL-backedPushConfigStore. - Tenant
Aware Postgres Task Store postgres - Tenant-scoped
PostgreSQL-backedTaskStore. - Tenant
Aware Sqlite Push Config Store sqlite - Tenant-scoped SQLite-backed
PushConfigStore. - Tenant
Aware Sqlite Task Store sqlite - Tenant-scoped
SQLite-backedTaskStore. - Tenant
Context - Thread-safe tenant context for scoping store operations.
- Tenant
Limits - Resource limits declared for a single tenant.
- Tenant
Store Config - Configuration for
TenantAwareInMemoryTaskStore. - Tool
Loop tool-loop - A model, the tools it may call, and the bounded loop between them.
- Tool
Loop Executor tool-loop - An
AgentExecutorthat answers each message by running aToolLoop. - ToolSet
tool-loop - The tools a
ToolLoopoffers its model, in the order they were added. Names are unique: a model asking for a name two tools share could not be answered. - Trusted
Proxy - An address range of reverse proxies this server trusts to say who the client is.
- WebSocket
Dispatcher websocket - WebSocket-based A2A dispatcher.
- WebSocket
Upgrades websocket - The WebSocket connections an HTTP dispatcher upgrades.
Enums§
- Call
Outcome - How a call ended, as
ServerInterceptor::on_completeis told. - Forwarded
Header - The header trusted reverse proxies record the client’s address in.
- Halt
Scope - What a halt applies to.
- Inbound
Trace Policy - What this deployment does with a
traceparentan unauthenticated peer sent it. - Send
Message Result - Result of
RequestHandler::on_send_message. - Server
Error - Server framework error type.
- Stream
Outcome - How a response stream ended.
- Terminal
Confirmation - What a streaming client is told when the task store does not confirm a terminal event the executor emitted.
Constants§
- A2A_
RUST_ ERROR_ DOMAIN - The
ErrorInfodomainof the reasons this SDK defines, where A2A defines none (ADR 0049). - A2A_
VERSION_ METADATA_ KEY - The service parameter naming the A2A protocol version, spelled the way a non-HTTP binding carries it.
- CORS_
ALLOW_ ALL - CORS
Access-Control-Allow-Originheader value for public agent cards. - HALTED_
REASON - The
ErrorInforeasona halt refusal carries (ADR 0049); the same asa2a_protocol_types::halt::HALTED_REASON, which a caller reads it by. - LOAD_
HEADER - The response header carrying the load, in the text form of an ORCA load
report:
TEXT application_utilization=0.250, named_metrics.running=3, named_metrics.queued=0. - PEER_
ADDR_ KEY - The headers-map key under which a binding records the address of the
connection a call arrived on, as
ip:port; seeCallContext::peer_addr. - PEER_
CERTIFICATE_ KEY - The headers-map key under which a binding records the client’s
mutual-TLS certificate, standard base64 of its DER encoding; see
CallContext::peer_certificate.
Traits§
- Agent
Card Producer - Trait for producing an
AgentCarddynamically. - Agent
Executor - Trait for implementing A2A agent execution logic.
- Dispatcher
- Trait for types that can dispatch HTTP requests to an A2A handler.
- Event
Queue Reader - Trait for reading streaming events.
- Event
Queue Writer - Trait for writing streaming events.
- Extended
Card Provider - Chooses the extended agent card
GetExtendedAgentCardserves to the caller of one request (spec §13.3 MAY). - Metrics
- Trait for receiving metrics callbacks from the handler.
- Push
Config Cipher postgresorsqlite - Encrypts push notification configs for an SQL store; see the module docs.
- Push
Config Store - Trait for storing push notification configurations.
- Push
Sender - Trait for delivering push notifications to client webhooks.
- Rate
Limit Counter - A request counter every replica shares.
- Server
Interceptor - A server-side interceptor for request processing.
- Task
Store - Trait for persisting and retrieving
Taskobjects. - Tenant
Resolver - Trait for extracting a tenant identifier from incoming requests.
- Tool
tool-loop - Something a model may call.
- Tool
Model tool-loop - One completion turn of a model that can call tools.
Functions§
- boxed_
future - Wraps an async expression into
Pin<Box<dyn Future<Output = T> + Send + 'a>>. - serve
Deprecated - Starts an HTTP server that dispatches requests using the given dispatcher, and never stops.
- serve_
with_ addr Deprecated - Starts an HTTP server on a background task and returns the bound
SocketAddr. Nothing can stop the task. - shutdown_
signal - Resolves when the platform asks this process to stop:
SIGTERM(what a container runtime,systemdandkubectl delete podsend) orSIGINT(Ctrl-C) on Unix, Ctrl-C elsewhere. - validate_
version_ metadata - Validates the A2A version carried in a binding’s request metadata.
Type Aliases§
- Rest
Router axum A2aRouterunder a name that says which binding it serves.- Server
Result - Convenience type alias:
Result<T, ServerError>.