Skip to main content

Module server

Module server 

Source
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.
auditaudit
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.
conformanceconformance
A conformance harness for AgentExecutor implementations.
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.
otelotel
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.
skillsskills
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 in a2a_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_looptool-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 AgentExecutor implementation from a closure-like syntax.

Structs§

A2aRouteraxum
Builder for an Axum [Router] that serves all A2A v1.0 protocol methods.
ApiKeyAuthInterceptor
Rejects requests whose API-key header is absent or not in the allowed set.
ArtifactChunk
Where an artifact update event sits in its artifact.
AuthFailureThrottle
Refuses a peer that has failed authentication too often; see the module docs.
AuthFailureThrottleConfig
Configuration for an AuthFailureThrottle.
BearerTokenAuthInterceptor
Rejects requests whose Authorization: Bearer <token> is absent or whose token is not in the allowed set.
BearerTokenTenantResolver
Extracts a tenant ID from the Authorization: Bearer <token> header.
BindingSpan
One inbound call on a binding outside this crate: the SERVER span it runs in, and its rpc.server.call.duration, exactly as the bindings in this crate record theirs.
CallContext
Metadata about the current server-side method call.
CancellationToken
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 own tokio-util dependency 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.
CombinedDispatcher
JSON-RPC and HTTP+JSON for one RequestHandler on one listener; see the module docs for how a request is routed.
ConnectionPoolStats
Statistics about the HTTP connection pool.
CorsConfig
CORS configuration for A2A dispatchers.
CustomBinding
How a binding outside this crate names itself on its spans and in rpc.server.call.duration.
DispatchConfig
Configuration for dispatch-layer limits shared by both JSON-RPC and REST dispatchers.
DynamicAgentCardHandler
Serves a dynamically generated AgentCard as a JSON HTTP response.
EventEmitter
Ergonomic helper for emitting status and artifact events from an executor.
EventQueueManager
Manages event queues for active tasks.
GrpcConfiggrpc
Configuration for the gRPC dispatcher.
GrpcDispatchergrpc
gRPC dispatcher that routes A2A requests to a RequestHandler.
HaltReport
What RequestHandler::halt did to the tasks that were running.
HandlerLimits
Configurable limits for the request handler.
HeaderTenantResolver
Extracts a tenant ID from a configurable HTTP header.
HotReloadAgentCardHandler
An agent card handler that supports hot-reloading.
HttpPushSender
HTTP-based PushSender using hyper.
InFlightReport
What RequestHandler::cancel_in_flight did.
InMemoryPushConfigStore
In-memory PushConfigStore backed by a HashMap.
InMemoryQueueReader
In-memory EventQueueReader backed by a broadcast channel receiver.
InMemoryQueueWriter
In-memory EventQueueWriter backed by a broadcast channel sender.
InMemoryTaskStore
In-memory TaskStore backed by a pre-allocated HashMap with secondary indexes under a single [RwLock].
Inbox
The messages sent to a running turn, oldest first, bounded.
InvalidTrustedProxy
Why a string is not a TrustedProxy.
JsonRpcDispatcher
JSON-RPC 2.0 request dispatcher.
LoadReport
What one replica holds now: see RequestHandler::load.
Migrationsqlite
A single schema migration.
MigrationRunnersqlite
Runs schema migrations against a SQLite database.
OpenAiChatModeltool-loop
A ToolModel that sends each turn as POST {base}/chat/completions.
OtelMetricsotel
A Metrics implementation backed by OpenTelemetry instruments.
PathSegmentTenantResolver
Extracts a tenant ID from a URL path segment by index.
PeerAddr
The address of the connection a request arrived on, as an HTTP request extension.
PeerCertificate
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.
PerTenantConfig
Per-tenant configuration for timeouts, capacity limits, and executor selection.
PgMigrationpostgres
A single schema migration.
PgMigrationRunnerpostgres
Runs schema migrations against a PostgreSQL database.
PostgresPushConfigStorepostgres
PostgreSQL-backed PushConfigStore.
PostgresRateLimitCounterpostgres
A RateLimitCounter backed by a PostgreSQL table.
PostgresTaskStorepostgres
PostgreSQL-backed TaskStore.
PushRetryPolicy
Retry policy for push notification delivery.
RateLimitConfig
Configuration for RateLimitInterceptor.
RateLimitInterceptor
A fixed-window rate limiting ServerInterceptor.
ReloadingCertResolvertls-rustls
A [ResolvesServerCert] that serves the certificate chain and key in two PEM files and replaces them when the files change.
RequestContext
Context for a single agent execution request.
RequestHandler
The core protocol logic handler.
RequestHandlerBuilder
Fluent builder for RequestHandler.
RestDispatcher
REST HTTP request dispatcher.
RpcCall
One finished inbound call, as Metrics::on_rpc_call reports it.
ServeConfig
Limits applied to a Server.
ServeReport
What the socket layer did, and whether it finished.
Server
A bound listener that has not started accepting yet.
ServerInterceptorChain
An ordered chain of ServerInterceptor instances.
ShutdownReport
What a shutdown actually managed to do.
SqlitePushConfigStoresqlite
SQLite-backed PushConfigStore.
SqliteTaskStoresqlite
SQLite-backed TaskStore.
StaticAgentCardHandler
Serves a pre-serialized AgentCard as a JSON HTTP response with caching.
Steered
A steering message as the executor receives it: the message, and who sent it as authentication established.
SteeringConfig
Turns steering on, and sets its two bounds. See RequestHandlerBuilder::with_steering.
StreamEnd
The claim a response stream holds on the call it answers. Dropped without end, the stream was abandoned.
StreamEvent
One event as it travels the queue, carrying the position it holds in the task’s event log.
TaskStoreConfig
Configuration for InMemoryTaskStore.
TenantAwareInMemoryPushConfigStore
Tenant-isolated in-memory PushConfigStore.
TenantAwareInMemoryTaskStore
Tenant-isolated in-memory TaskStore.
TenantAwarePostgresPushConfigStorepostgres
Tenant-scoped PostgreSQL-backed PushConfigStore.
TenantAwarePostgresTaskStorepostgres
Tenant-scoped PostgreSQL-backed TaskStore.
TenantAwareSqlitePushConfigStoresqlite
Tenant-scoped SQLite-backed PushConfigStore.
TenantAwareSqliteTaskStoresqlite
Tenant-scoped SQLite-backed TaskStore.
TenantContext
Thread-safe tenant context for scoping store operations.
TenantLimits
Resource limits declared for a single tenant.
TenantStoreConfig
Configuration for TenantAwareInMemoryTaskStore.
ToolLooptool-loop
A model, the tools it may call, and the bounded loop between them.
ToolLoopExecutortool-loop
An AgentExecutor that answers each message by running a ToolLoop.
ToolSettool-loop
The tools a ToolLoop offers its model, in the order they were added. Names are unique: a model asking for a name two tools share could not be answered.
TrustedProxy
An address range of reverse proxies this server trusts to say who the client is.
WebSocketDispatcherwebsocket
WebSocket-based A2A dispatcher.
WebSocketUpgradeswebsocket
The WebSocket connections an HTTP dispatcher upgrades.

Enums§

CallOutcome
How a call ended, as ServerInterceptor::on_complete is told.
ForwardedHeader
The header trusted reverse proxies record the client’s address in.
HaltScope
What a halt applies to.
InboundTracePolicy
What this deployment does with a traceparent an unauthenticated peer sent it.
SendMessageResult
Result of RequestHandler::on_send_message.
ServerError
Server framework error type.
StreamOutcome
How a response stream ended.
TerminalConfirmation
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 ErrorInfo domain of 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-Origin header value for public agent cards.
HALTED_REASON
The ErrorInfo reason a halt refusal carries (ADR 0049); the same as a2a_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; see CallContext::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§

AgentCardProducer
Trait for producing an AgentCard dynamically.
AgentExecutor
Trait for implementing A2A agent execution logic.
Dispatcher
Trait for types that can dispatch HTTP requests to an A2A handler.
EventQueueReader
Trait for reading streaming events.
EventQueueWriter
Trait for writing streaming events.
ExtendedCardProvider
Chooses the extended agent card GetExtendedAgentCard serves to the caller of one request (spec §13.3 MAY).
Metrics
Trait for receiving metrics callbacks from the handler.
PushConfigCipherpostgres or sqlite
Encrypts push notification configs for an SQL store; see the module docs.
PushConfigStore
Trait for storing push notification configurations.
PushSender
Trait for delivering push notifications to client webhooks.
RateLimitCounter
A request counter every replica shares.
ServerInterceptor
A server-side interceptor for request processing.
TaskStore
Trait for persisting and retrieving Task objects.
TenantResolver
Trait for extracting a tenant identifier from incoming requests.
Tooltool-loop
Something a model may call.
ToolModeltool-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>>.
serveDeprecated
Starts an HTTP server that dispatches requests using the given dispatcher, and never stops.
serve_with_addrDeprecated
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, systemd and kubectl delete pod send) or SIGINT (Ctrl-C) on Unix, Ctrl-C elsewhere.
validate_version_metadata
Validates the A2A version carried in a binding’s request metadata.

Type Aliases§

RestRouteraxum
A2aRouter under a name that says which binding it serves.
ServerResult
Convenience type alias: Result<T, ServerError>.