API Quick Reference
A condensed overview of the public types, traits, and functions across the a2a-rust crates.
This page is a curated selection, kept short enough to scan. For the
exhaustive, always-current listing — every item, every signature, generated
from the code (docs.rs builds it for each release; the deploy builds it from
main under /dev/api/) — see the generated API documentation.
Jump to the crate you are using, or straight to the constructors cheatsheet: one compiled block that builds the values you need most, from task states, parts, artifacts and ids to capabilities, an agent card and a push config.
| Crate | What you find there |
|---|---|
a2a-protocol-types | Wire types: tasks, messages, artifacts, agent cards, security schemes, errors, JSON-RPC envelopes |
a2a-protocol-client | The client, discovery, interceptors, authentication helpers, transports |
a2a-protocol-server | The handler and its builder, executors, dispatchers, stores, configuration |
a2a-protocol-sdk | The umbrella crate: re-exports, telemetry, the prelude |
Every name below is checked against the crates by
scripts/check_api_reference.py in CI, so a type that gets renamed cannot leave
a stale entry here. The same script checks the other direction at the crate
roots: every item a crate re-exports from its lib.rs — the names you reach as
use a2a_protocol_types::X — must have a row on this page. Deeper module items
are rustdoc's job.
Wire Types (a2a-protocol-types)
Modules
| Module | Contents |
|---|---|
agent_card | Agent card and capability discovery types |
approval | The approval extension: ApprovalRequest, ApprovalDecision, and action_digest (signing feature) for binding a person's answer to an exact action |
artifact | Artifact types for the A2A protocol |
audit | Tamper-evident audit records: schema, hash chains, signed checkpoints, verify_chain (audit feature) |
auth_rejection | Why a request was refused on authentication or authorization grounds |
budget | The budget extension: Budget, a deadline and named meters a delegated turn may spend, and BudgetStatus, what is left and spent (ADR 0023) |
delegation_journal | A supervisor's record of the children it delegated to, so a restart can find them: the DelegationJournal trait, DelegationRecord and an in-memory journal (ADR 0030) |
error | A2A protocol error types |
events | Server-sent event types for A2A streaming |
extensions | Agent extension and card-signature types |
failure | Why a task failed, as a class a caller can match on |
idempotency | Client-supplied idempotency keys for message/send, as a declared extension |
jsonrpc | JSON-RPC 2.0 envelope types |
lease | The lease extension: Lease, a delegated task's time to live, granted on the message that starts it and renewed by a GetTask that activates the extension |
lineage | The lineage extension: Lineage (its root, depth and parent task id), the job a task belongs to; Lineage::child for a delegated task; tree arranges tasks into a job's tree (ADR 0034) |
message | Message types for the A2A protocol |
method | The A2A v1.0 service methods, mirrored from the ratified specification |
params | JSON-RPC method parameter types |
provenance | Marks messages and artifacts as AI-generated and signs them (mark_ai_generated; sign_content, verify_content with the signing feature) |
proto | Canonical A2A protobuf message types (lf.a2a.v1) and conversions (proto feature) |
push | Push notification configuration types |
required | The REQUIRED fields of a2a.proto neither wire format's parser enforces, checked the same way at both ends (spec §5.7) |
responses | RPC method response types |
security | Security scheme types for A2A agent authentication |
serde_helpers | Serialization helpers for reducing allocation overhead |
signing | Agent card signing and verification (spec §8.4) (signing feature) |
steering | The steering extension: declare marks a message as a message to a running task, Receipt and Delivery say where the server put it (ADR 0036) |
task | Task types for the A2A protocol |
trace_context | W3C traceparent / tracestate: parse, validate, derive a child |
Protocol Constants
| Constant | Description |
|---|---|
A2A_VERSION | A2A protocol version string, in the Major.Minor wire form ("1.0") |
A2A_CONTENT_TYPE | The registered A2A media type (spec §14.1.1), accepted on ingress by the HTTP bindings alongside JSON_CONTENT_TYPE, and the HTTP+JSON binding's response type unless the request prefers application/json or asks only for text/event-stream |
JSON_CONTENT_TYPE | application/json: the JSON-RPC binding's content type, and the HTTP+JSON binding's when the request's Accept prefers it (or asks only for text/event-stream) |
A2A_VERSION_HEADER | HTTP header name for the A2A protocol version (A2A-Version) |
A2A_EXTENSIONS_HEADER | HTTP header name for extension activation (spec §14.2.2) |
WEBSOCKET_BINDING_URI | This project's identifier for its §12 WebSocket binding, as AgentInterface::protocol_binding |
Core Types
| Type | Description |
|---|---|
Task | Unit of work with ID, status, history, artifacts |
TaskId | Newtype wrapper for task identifiers |
TaskState | Enum: Unspecified, Submitted, Working, InputRequired, AuthRequired, Completed, Failed, Canceled, Rejected |
TaskStatus | State + optional message + timestamp |
TaskVersion | Monotonically increasing version number |
ContextId | Conversation context identifier |
Messages
| Type | Description |
|---|---|
Message | Structured payload with ID, role, parts |
MessageId | Newtype wrapper for message identifiers |
MessageRole | Enum: Unspecified, User, Agent |
Part | Content unit: text, raw, url, or data |
PartContent | Enum: Text, Raw, Url, Data |
FileContent | Content of a file part. Deprecated: exists for backward compatibility with v0.3; in v1.0 use Part::raw or Part::url |
Artifacts
| Type | Description |
|---|---|
Artifact | Result produced by an agent. Call validate() to check non-empty parts. |
ArtifactId | Newtype wrapper for artifact identifiers |
Events
| Type | Description |
|---|---|
StreamResponse | Enum: Task, Message, StatusUpdate, ArtifactUpdate |
TaskStatusUpdateEvent | Status change notification |
TaskArtifactUpdateEvent | Artifact delivery notification |
Agent Card
| Type | Description |
|---|---|
AgentCard | Root discovery document |
AgentInterface | Transport endpoint descriptor |
AgentCapabilities | Capability flags (streaming, push, extended card) |
AgentSkill | Discrete agent capability |
AgentProvider | Organization info |
Extensions
| Type | Description |
|---|---|
AgentExtension | Describes an optional extension that an agent supports |
AgentCardSignature | A cryptographic signature over an AgentCard |
Security Schemes
| Type | Description |
|---|---|
SecurityScheme | A security scheme supported by an agent |
NamedSecuritySchemes | A map from security scheme name to its definition, as used in AgentCard.securitySchemes |
SecurityRequirement | A security requirement object mapping scheme names to their required scopes |
StringList | A list of strings used within a SecurityRequirement map value |
ApiKeySecurityScheme | API key security scheme: a token sent in a header, query parameter, or cookie |
ApiKeyLocation | Where an API key is placed in the request |
HttpAuthSecurityScheme | HTTP authentication security scheme (Bearer, Basic, etc.) |
OAuth2SecurityScheme | OAuth 2.0 security scheme |
OAuthFlows | Available OAuth 2.0 flows for an OAuth2SecurityScheme |
AuthorizationCodeFlow | OAuth 2.0 authorization code flow |
ClientCredentialsFlow | OAuth 2.0 client credentials flow |
DeviceCodeFlow | OAuth 2.0 device authorization flow (RFC 8628) |
ImplicitFlow | OAuth 2.0 implicit flow (deprecated; retained for compatibility) |
PasswordOAuthFlow | OAuth 2.0 resource owner password credentials flow (deprecated but in spec) |
OpenIdConnectSecurityScheme | OpenID Connect security scheme |
MutualTlsSecurityScheme | Mutual TLS security scheme |
Parameters
| Type | Description |
|---|---|
MessageSendParams | SendMessage / SendStreamingMessage input |
SendMessageConfiguration | Output modes, history, push config |
TaskQueryParams | GetTask input |
ListTasksParams | ListTasks input with filters and pagination |
CancelTaskParams | CancelTask input |
TaskIdParams | SubscribeToTask input |
GetPushConfigParams | GetTaskPushNotificationConfig input |
DeletePushConfigParams | DeleteTaskPushNotificationConfig input |
ListPushConfigsParams | ListTaskPushNotificationConfigs input |
GetExtendedAgentCardParams | GetExtendedAgentCard input |
AcceptedFields | Trait: the JSON keys a request type accepts, in both protobuf spellings |
Push Notifications
| Type | Description |
|---|---|
TaskPushNotificationConfig | Webhook registration |
AuthenticationInfo | Webhook auth credentials |
Responses
| Type | Description |
|---|---|
SendMessageResponse | Enum: Task or Message |
TaskListResponse | Paginated task list |
ListPushConfigsResponse | Paginated push config list |
AuthenticatedExtendedCardResponse | Type alias for AgentCard |
Serialization Helpers
| Type | Description |
|---|---|
SerBuffer | Thread-local reusable serialization buffer; serialize still returns an owned Vec<u8>. In the published results (2026-10-14) it is about 1.4x faster than to_vec at 64 and 256 bytes, and within 6 % of it from 1 KiB up |
deser_from_str | serde_json::from_str behind a helper. The wire types own their strings, so nothing is borrowed and allocations do not fall |
deser_from_slice | The same from &[u8]: checks UTF-8, then parses as deser_from_str does; falls back to serde_json::from_slice when the bytes are not UTF-8 |
Timestamps
| Function | Description |
|---|---|
utc_now_iso8601() | Returns the current UTC time as an ISO 8601 string with millisecond precision |
unix_millis_to_iso8601(millis) | Formats Unix-epoch milliseconds as an ISO 8601 UTC string with millisecond precision; a pre-1970 instant is written as itself, and one outside years 0000-9999 clamps to 0000-01-01 or the end of 9999-12-31 |
parse_iso8601_to_unix_millis(s) | Parses an ISO 8601 / RFC 3339 timestamp into milliseconds since the Unix epoch; None for anything structurally invalid |
Errors
| Type | Description |
|---|---|
A2aError | Protocol-level error |
ErrorCode | Standard error codes |
AuthRejection | A refused credential an A2aError carries: its kind and WWW-Authenticate challenge |
AuthRejectionKind | Unauthenticated (HTTP 401, gRPC UNAUTHENTICATED) or PermissionDenied (HTTP 403, gRPC PERMISSION_DENIED) |
A2aResult<T> | Alias for Result<T, A2aError> |
JSON-RPC
| Type | Description |
|---|---|
JsonRpcRequest | JSON-RPC 2.0 request envelope |
JsonRpcError | JSON-RPC error object |
JsonRpcVersion | Version marker ("2.0") |
JsonRpcResponse | JSON-RPC 2.0 response: either a success with a result or an error with an error object |
JsonRpcSuccessResponse | A successful JSON-RPC 2.0 response |
JsonRpcErrorResponse | An error JSON-RPC 2.0 response |
JsonRpcRequestId | A JSON-RPC 2.0 request identifier with three distinct states |
JsonRpcId | A JSON-RPC 2.0 response identifier |
Client (a2a-protocol-client)
Modules
| Module | Contents |
|---|---|
auth | Authentication interceptor and credential storage |
balance | Calls spread over the endpoints of one agent (EndpointSource, StaticEndpoints, DnsEndpoints), with ejection and opt-in hedging (BalancePolicy, Ejection, Hedge; ClientBuilder::with_balancing, ADR 0050) |
builder | Fluent builder for A2aClient |
client | The A2aClient itself |
config | Client configuration types |
delegation | Delegation: a task sent to another agent and cancelled with its parent — on the parent's cancel, a lost stream, or a dropped handle; DelegationOptions::with_lineage gives the child its job's lineage |
delegation | Delegation: a task sent to another agent and cancelled with its parent — on the parent's cancel, a lost stream, or a dropped handle; HandOffPolicy bounds how often it continues a child whose server handed its turn back (ADR 0054) |
discovery | Agent card discovery with HTTP caching |
error | Client error types |
interceptor | Request/response interceptor infrastructure |
jwks | fetch_jwks: a JWK Set from a trusted HTTPS URL, bounded in size and time, for verifying card signatures; it sends only the headers set with CardFetchOptions::with_jwks_header (signing feature) |
methods | Per-method client helpers |
retry | Configurable retry policy for transient client errors |
streaming | SSE client-side streaming support |
testing | ScriptedPeer: a misbehaving agent on any binding (stall, cut-off, mis-frame, 401), for testing a client's failure handling (testing feature) |
tls | TLS connector via rustls (tls-rustls feature) |
token_provider | Token acquisition: TokenProvider, OAuth 2.0 client-credentials, and OIDC discovery |
otel_baggage | W3C baggage on outbound calls, opt-in by key, and which propagators the environment turns on |
trace_propagation | Carrying W3C trace context on outbound calls |
transport | Transport abstraction for A2A client requests |
version_query | Sending A2A-Version as a request parameter (§3.6.1) |
webhook | The receiving side of push notifications: WebhookReceiver, new_notification_token (webhook feature, default on) |
Core Types
| Type | Description |
|---|---|
A2aClient | Main client for calling remote agents |
ClientBuilder | Fluent builder for client configuration |
ClientConfig | Configuration for an A2aClient instance |
EventStream | Async SSE event stream |
RetryPolicy | Configurable retry with exponential backoff |
RetryBudget | Retries as a bounded fraction of calls, so retries cannot multiply an overload (RetryPolicy::with_budget) |
HttpPool | One set of HTTP connections many clients share, with an optional maximum connection lifetime, HTTP/2 PING and idle limits (ClientBuilder::with_pool, HttpPool::shared()), and per-origin state: a circuit breaker, an in-flight cap and a retry budget shared by its clients (HttpPool::origins()); needs tls-rustls |
HttpPoolBuilder | Builds an HttpPool: TLS configuration, connect and idle timeouts, idle connections per host, connection lifetime, HTTP/2 keep-alive (HttpPool::builder()) |
OriginSnapshot | One origin's state from HttpPool::origins(): calls in flight, how much longer it is ejected, failures and ejections in a row |
CredentialPreflight | What a client built from a card does with a call whose credential matches none of the card's security requirements (§3.1.11): off, warn (default) or refuse |
CurrentTrace | The trace the current task runs under, and how to start one |
TracePropagationInterceptor | Writes traceparent onto every outbound request |
BaggagePolicy | Which W3C baggage entries cross the wire: Off (default), Keys([...]), All |
Propagators | Which propagators the environment's propagator list turns on: tracecontext, baggage |
VersionQueryInterceptor | Adds A2A-Version to every request's query parameters, beside the header |
ClientError | Errors that can occur during A2A client operations |
ClientResult<T> | Alias for Result<T, ClientError> |
Discovery
| Function | Description |
|---|---|
new_message_id() | A fresh UUID v4 MessageId for a message about to be sent (in the SDK prelude too) |
resolve_agent_card(base_url) | async — fetches the AgentCard from the standard well-known path; no headers, 30 s budget |
resolve_agent_card_with_options(base_url, &options) | async — the same with the headers and budget in a CardFetchOptions (discovery module; fetch_card_from_url_with_options for an absolute URL) |
CachingCardResolver | A private RFC 9111 cache of one card: one HTTP client (or an HttpPool's, with_pool), one fetch at a time across clones, stale-if-error (with_stale_if_error, and the card's own directive), opt-in refresh jitter (discovery module) |
CardCache | One shared CachingCardResolver per card URL with one set of options, bounded (with_max_entries, default 1024), 10% refresh jitter (discovery module) |
Client Methods
| Method | Returns | Description |
|---|---|---|
send_message(params) | SendMessageResponse | Synchronous send |
stream_message(params) | EventStream | Streaming send |
get_task(params) | Task | Retrieve task by ID |
list_tasks(params) | TaskListResponse | Query tasks |
cancel_task(id) | Task | Cancel a running task |
subscribe_to_task(id) | EventStream | Re-subscribe to task events |
follow_task(id, poll_every) | TaskFollow | Follow a task to its end: subscribe when the agent streams, poll GetTask when it does not (§7.6.2) |
subscribe_to_task_from(id, last_event_id) | EventStream | Resume a broken stream from its last SSE id: (sends Last-Event-ID) |
set_push_config(config) | TaskPushNotificationConfig | Create push config |
get_push_config(task_id, id) | TaskPushNotificationConfig | Get push config |
list_push_configs(params) | ListPushConfigsResponse | List push configs |
delete_push_config(task_id, id) | () | Delete push config |
get_extended_agent_card() | AuthenticatedExtendedCardResponse | Get extended card |
Interceptors
| Type | Description |
|---|---|
CallInterceptor | Request/response hook trait |
InterceptorChain | Ordered interceptor sequence |
ClientRequest | A logical A2A request as seen by interceptors |
ClientResponse | A logical A2A response as seen by interceptors |
Authentication
| Type | Description |
|---|---|
AuthInterceptor | A CallInterceptor that injects Authorization headers from a CredentialsStore |
CredentialsStore | Persistent storage for auth credentials, keyed by session + scheme |
InMemoryCredentialsStore | An in-memory CredentialsStore backed by an RwLock<HashMap> |
SessionId | Opaque identifier for a client authentication session |
TokenProvider | A source of bearer access tokens |
StaticTokenProvider | A TokenProvider that always returns the same fixed token |
OAuth2ClientCredentials | A TokenProvider implementing the OAuth 2.0 client credentials grant (RFC 6749 §4.4) with caching and proactive refresh |
BearerAuthInterceptor | A CallInterceptor that injects a bearer token from a TokenProvider before every request |
Webhook Receiver
| Type | Description |
|---|---|
WebhookReceiver | Checks a push notification's token, Authorization, body and task; suppresses duplicates; optional per-config rate limit |
WebhookOutcome | Accepted, Duplicate or Rejected, with the HTTP status to answer |
WebhookRejection | Why a notification was refused: 401, 400, 403 or 429 |
Transport
| Type | Description |
|---|---|
Transport | Pluggable transport trait |
JsonRpcTransport | JSON-RPC 2.0 transport |
RestTransport | REST/HTTP transport |
WebSocketTransport | WebSocket transport (websocket feature) |
WebSocketTransportConfig | Configuration for WebSocketTransport::connect_with_config (websocket feature) |
GrpcTransport | gRPC transport (grpc feature); dials host:port targets and http(s):// URLs |
GrpcBareAddressScheme | How a bare host:port gRPC target is dialled: TLS except loopback (default), always TLS, or always plaintext |
Server (a2a-protocol-server)
Modules
| Module | Contents |
|---|---|
admission | Admission, the opt-in gate in front of the send path set with RequestHandlerBuilder::with_admission: a capacity, TenantShare reservations, a bounded wait inside the send's budget, priority classes and weighted rounds; AdmissionLoad is what RequestHandler::admission_load reports (ADR 0045) |
agent_card | Agent card HTTP handlers (static, dynamic, and caching utilities) |
approval | ApprovalGate: admits an approval decision only from an allowed, authenticated approver, for the pending request and its digest, and with with_quorum(n) only once n distinct approvers have approved (recorded under QUORUM_METADATA_KEY); VerifiedApproval is what the executor sees |
audit | AuditLog, its stores, retention and legal holds; records every call, run, task event and cancel request (audit feature); AuditPrivacy, AuditLog::with_privacy, reveal, digest_matches and erase_subject protect who and what records name and erase a person (audit and encryption) |
auth | Server-side authentication interceptors |
builder | Builder for RequestHandler |
call_context | Call context for server-side interceptors |
conformance | Grades an AgentExecutor against the protocol invariants, and with conformance::halt a HaltStore and a handler's halt end to end (conformance feature) |
dispatch | HTTP dispatch layer — JSON-RPC and REST routing |
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 | OtelMetrics (otel feature, on by default) and Telemetry (OTLP traces, metrics and logs; the Langfuse preset; otlp feature) |
profile | Deployment profiles, which combine. Profile::Auditable turns on the audit trail and an approval gate, with a build() that refuses a log that is not required or not signed, a chain with no authenticator, or a builder that has not said how callers' tasks relate (audit feature). Profile::Production refuses a handler with no authenticator, halt store, lease store or content signer (ADR 0025, ADR 0027; the signer needs the signing feature). Profile::DurableProduction refuses stores that keep their state in this process; Profile::LocalDevelopment says that is intended. ProfileReport (RequestHandler::profile_report) lists what was checked, what an escape hatch gave up, and what startup cannot verify |
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, ServeConfig, ServeReport, Dispatcher, shutdown_signal (and the deprecated serve(), serve_with_addr) |
steering | Steering a running task (ADR 0036): SteeringConfig, set with RequestHandlerBuilder::with_steering, bounds the inbox and the message size; Inbox is what RequestContext::inbox gives an executor, and Steered a message in it |
store | Task storage backend |
skills | Agent Skills in the tool loop: SkillCatalog, SkillsConfig, SkillSource and the two tools; scripts are never run (skills feature, ADR 0035) |
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 calling inside a task: the model/tool loop, its executor, and a chat-completions client (tool-loop feature, ADR 0022) |
url_guard | SSRF checks for URLs an agent fetches: check_public_url, resolve_public_url, resolve_public_addrs |
Constants
| Constant | Description |
|---|---|
CORS_ALLOW_ALL | CORS Access-Control-Allow-Origin header value for public agent cards |
A2A_VERSION_METADATA_KEY | The service parameter naming the A2A protocol version, spelled the way a non-HTTP binding carries it |
PEER_ADDR_KEY | The headers-map key (":peer-addr") under which a binding records the connection's address for CallContext::peer_addr |
PEER_CERTIFICATE_KEY | The headers-map key (":peer-certificate") under which a binding records the client's mutual-TLS certificate, base64 DER, for CallContext::peer_certificate |
Core Types
| Type | Description |
|---|---|
RequestHandler | Central protocol orchestrator |
RequestHandlerBuilder | Fluent builder for handler configuration |
RequestContext | Per-execution context (task ID, message, etc.) |
CancellationToken | The type of RequestContext::cancellation_token, re-exported so an executor need not depend on tokio-util to name it |
CallContext | Per-request metadata (request ID, headers, tenant) |
SteeringConfig | Turns steering on and bounds it: the inbox's capacity (16), the message size (64 KiB), and whether a handed-off message is announced with PostgreSQL notifications |
Inbox | The messages sent to a running turn, oldest first, bounded: try_recv, recv().await, len, close; RequestContext::inbox is None unless steering is on |
Steered | A steering message as the executor receives it: the message and who sent it (from) |
HandlerLimits | Configurable validation limits |
TerminalConfirmation | What a stream is told of a terminal event the store did not confirm: Required (the default) ends the stream with UNAVAILABLE; BestEffort delivers the event as emitted (HandlerLimits::terminal_confirmation) |
InboundTracePolicy | What this handler does with a traceparent an as-yet unauthenticated peer sent (W3C Trace Context §7.2) |
MIN_MESSAGE_ID_LENGTH | The floor message.id's length bound is never taken below: 36, a hyphenated UUID |
SendMessageResult | Result of RequestHandler::on_send_message: a synchronous response or a streaming reader |
ShutdownReport | What a shutdown actually managed to do (live queues it had to destroy, whether executor cleanup completed) |
InFlightReport | What RequestHandler::finish_in_flight / cancel_in_flight did: tasks that completed on their own, tasks cancelled, still running at the end of the grace period, whether everything finished |
HaltScope | What RequestHandler::halt applies to: one job (HaltScope::root(tenant, root), ADR 0034), one tenant, or all |
RequestHandler::running_in_root / halt_reason_for_root | The turns of one job running in this process, with their lineage; why a job's sends are refused |
RequestContext::lineage / child_lineage | The turn's job, and the lineage to give a task it delegates |
HALTED_REASON, A2A_RUST_ERROR_DOMAIN | The ErrorInfo reason (HALTED) and domain (a2a-rust.com) a halt refusal carries on every binding (ADR 0049) |
HaltScope | What RequestHandler::halt applies to: one tenant, or all |
LoadReport | What RequestHandler::load reports: turns running, sends queued at the admission gate, the capacity, draining, halted; utilization_permille, to_json (the /load body) and header_value (ADR 0046) |
LOAD_HEADER | endpoint-load-metrics, the response header carrying the load in ORCA's text form when the handler is built with_load_reporting() |
HaltReport | What a halt did: stopped, the ids of the tasks whose token it fired, and persisted, whether the halt store took it (None without a store) |
ConnectionPoolStats | Statistics about the HTTP connection pool |
RpcCall | One finished inbound call as Metrics::on_rpc_call reports it: binding, method, duration, status (rpc.server.call.duration) |
BindingSpan | The per-call server span and rpc.server.call.duration for a binding outside this crate, as the in-crate bindings record theirs (ADR 0013) |
CustomBinding | How such a binding names itself: its rpc.system.name, its status for each ServerError, and optionally the status of a success |
StreamEnd | A response stream's claim on the call it answers (BindingSpan::run_with): the call is recorded when the stream ends, as cancelled if the claim is dropped |
StreamOutcome | How a response stream ended: completed, failed with an error, or abandoned |
Traits
| Trait | Description |
|---|---|
AgentExecutor | Agent logic entry point |
TaskStore | Task persistence backend |
PushConfigCipher | Seals push configs at rest in the SQL push-config stores (with_cipher; sqlite / postgres features) |
ContentCipher | Seals part content for EncryptedTaskStore; implement it to put a key-management service behind the store (encryption feature) |
PushConfigStore | Push config persistence |
PushSender | Webhook delivery |
ServerInterceptor | Server-side middleware |
AgentCardProducer | Dynamic agent card generation |
ExtendedCardProvider | Chooses each caller's extended agent card (§13.3; with_extended_card_provider) |
Dispatcher | HTTP dispatch trait (what Server::serve_with_shutdown serves) |
Metrics | Pluggable metrics observer (requests, latency, errors) |
TenantResolver | Extracts tenant from request context |
RateLimitCounter | A request counter every replica shares |
ToolModel | One completion turn of a model that can call tools: preamble, conversation and tool specs in, text and tool calls out, with the usage, model, id and finish reason the provider reported; server() says where it is served, for the spans (tool-loop feature) |
Tool | Something a model may call: a name, a description, a JSON Schema, read_only (default false) and call(invocation), given the arguments and an idempotency key (tool-loop feature, ADR 0026) |
Dispatchers
| Type | Description |
|---|---|
JsonRpcDispatcher | JSON-RPC 2.0 HTTP dispatcher (implements Dispatcher) |
RestDispatcher | RESTful HTTP dispatcher (implements Dispatcher) |
CombinedDispatcher | JSON-RPC and REST on one listener: a POST to the JSON-RPC path is JSON-RPC, the rest is REST (implements Dispatcher); with_websocket adds the WebSocket binding on the same port, upgraded at the JSON-RPC path (websocket feature, ADR 0055) |
WebSocketUpgrades | The connections an HTTP dispatcher upgraded to WebSockets: open(), and close(within), which Server::serve_with_shutdown calls in its drain and an axum application calls itself (RestRouter::websocket_upgrades) |
WebSocketDispatcher | WebSocket dispatcher (websocket feature); with_serve_config(ServeConfig) takes the listener settings Server takes, and serve_with_shutdown(listener, signal) on an Arc of it serves (ADR 0052) |
GrpcDispatcher | gRPC dispatcher (grpc feature); with_serve_config(ServeConfig) takes the listener settings Server takes, and serve_with_shutdown(listener, signal) serves (ADR 0052); with_rustls(rustls::ServerConfig) serves TLS through this crate's handshake, so a ReloadingCertResolver rotates it (grpc-tls and tls-rustls) |
RestRouter | Axum framework adapter (axum feature): an axum Router for the HTTP+JSON binding (into_router), and a Dispatcher that Server serves; A2aRouter is the same type under its original name (ADR 0053) |
A2aRouter | The type RestRouter names (axum feature), under its original name; not deprecated (ADR 0053) |
Server Startup
| Name | Description |
|---|---|
Server | A bound listener that has not started accepting yet; binding is separated from serving so the caller can learn the address. serve_with_shutdown(dispatcher, signal) serves any Dispatcher, the axum RestRouter included (ADR 0052) |
serve(addr, dispatcher) -> io::Result<()> | Deprecated since 0.16.0 (removed no earlier than 0.17.0): binds and drives the accept loop until the future is dropped; use Server |
serve_with_addr(addr, dispatcher) -> io::Result<SocketAddr> | Deprecated since 0.16.0 (removed no earlier than 0.17.0): binds, spawns the accept loop with no way to stop it, returns the bound SocketAddr; use Server |
ServeConfig | Limits applied to a Server; ServeConfig::production() makes it refuse plaintext beyond loopback and a binding the agent card does not declare (ADR 0025) |
ServeReport | What a shutdown did — Server::serve_with_shutdown, or the gRPC and WebSocket dispatchers' serve_with_shutdown: connections accepted, drained or abandoned, and (with a handler-backed dispatcher) the InFlightReport for its tasks; refused says why a ServeConfig::production() server declined to start |
shutdown_signal() -> impl Future<Output = ()> | Resolves on SIGTERM or SIGINT (Ctrl-C on non-Unix); pass it to Server::serve_with_shutdown so a pod stop drains in-flight work, returns from main, and lets a live Telemetry guard flush |
DispatchConfig | Configuration for dispatch-layer limits shared by both JSON-RPC and REST dispatchers; with_base_path names a reverse proxy's path prefix |
GrpcConfig | Configuration for the gRPC dispatcher (grpc feature) |
validate_version_metadata(metadata, required) | Validates the A2A version carried in a binding's request metadata |
Executor Helpers
| Name | Description |
|---|---|
agent_executor! | Macro: generates an AgentExecutor implementation from a closure-like syntax |
boxed_future | Wraps an async expression into a pinned, boxed, Send future |
Tool Calling
All behind the tool-loop feature; the rest of the module (ToolCall,
ChatMessage, ModelError, LoopError, …) is at tool_loop::.
| Type | Description |
|---|---|
ToolLoop | Runs model turns until the model answers without a call, bounded by with_max_turns (default 8); tool errors go back to the model, and a call written as text is run as one; with_agent_name and with_meter for its gen_ai.* metrics; with_model_retry sends a rate-limited turn again (off by default) |
ToolLoopExecutor | A ToolLoop as an AgentExecutor: Working, the answer and tool-trace artifacts, Completed; Failed as internal or budget-exhausted; with_drafts streams each turn's text to a draft-N artifact first |
ToolSet | The tools a loop offers; refuses two of one name |
OpenAiChatModel | A ToolModel for POST {base}/chat/completions (OpenAI, llama-server, vLLM, Ollama) on the crate's hyper client; HTTPS with tls-rustls; streams for complete_streaming |
TextSink | Where ToolModel::complete_streaming hands each piece of a turn's text |
InferenceLimit | At most max model turns in flight at one provider, shared by every loop holding a clone; max() and available() (ADR 0048) |
LimitedModel | A ToolModel that holds a slot of an InferenceLimit for each turn, streamed or not, and gives it back however the turn ends |
ModelRetry | ToolLoop::with_model_retry's policy for a rate-limited turn (ModelError::RateLimited): 3 retries, 0.5 s doubling to 30 s with half jitter, or the provider's Retry-After spread by up to a quarter; never past max_delay or the budget's remaining time (ADR 0048) |
Agent Skills
All behind the skills feature (it implies tool-loop), at skills::.
| Type | Description |
|---|---|
SkillCatalog | The skills discover found in the configured directories and a list of SkillDiagnostics; never fails. prompt() is the catalog for the system prompt, tools() the tools that serve it, agent_skills() the entries for an agent card (off unless called) |
SkillsConfig | What to scan and the bounds: 32 skills, a 400-character description in the prompt, a 64 KiB body, a 64 KiB file read, each set with a with_max_* |
SkillSource | One directory of skills: operator(path) is trusted, project(path) is not read until with_trusted(true); with_follow_symlinks(true) follows a link to a skill directory |
Skill | One skill: name, description, body, location, scope, and the optional fields the file had, with allowed_tools recorded and never used |
SkillDiagnostic | What discovery noticed: a Severity, a DiagnosticKind to match on, a path and a message |
ActivateSkillTool | activate_skill: its name is an enum of the catalog's names; returns the instructions, the files the skill bundles and the scripts that are not run |
ReadSkillFileTool | read_skill_file: the text of a file under a skill's references/ or assets/, through the confined reader |
ToolLoopExecutor::with_skills puts the catalog's prompt after the loop's preamble and adds the tools.
Built-in Implementations
| Type | Description |
|---|---|
InMemoryTaskStore | In-memory task store with TTL |
EventHolds | What attached streams still owe from each task's event log, so a bounded log keeps it (store; TaskStore::hold_events, spec §3.5.2) |
EventHold | One stream's hold on a task's log, raised as it delivers and released on drop (store) |
EncryptedTaskStore | Wraps any TaskStore and seals every part at rest, bound to where it sits (store::encrypted; encryption feature) |
Aes256GcmCipher | AES-256-GCM over a key ring for EncryptedTaskStore, and a PushConfigCipher (encryption feature) |
InMemoryPushConfigStore | In-memory push config store |
PushOutbox | Where webhook deliveries wait until delivered (push::outbox, ADR 0037); RequestHandlerBuilder::with_push_outbox |
InMemoryPushOutbox | In-memory PushOutbox: retries outlast a delivery, not a restart |
SqlitePushOutbox | SQLite PushOutbox, table a2a_push_outbox (sqlite feature); with_cipher seals event bodies |
PostgresPushOutbox | PostgreSQL PushOutbox shared by every replica, claims with FOR UPDATE SKIP LOCKED (postgres feature); with_cipher |
HttpPushSender | HTTP webhook delivery with SSRF protection; follows the proxy variables in every build, and with_proxy_resolved_names() lets a proxy resolve names this process cannot (ADR 0043) |
SqliteTaskStore | SQLite task store (sqlite feature) |
SqlitePushConfigStore | SQLite push config store (sqlite feature) |
TenantAwareInMemoryTaskStore | Multi-tenant in-memory task store |
TenantAwareInMemoryPushConfigStore | Multi-tenant in-memory push config store |
TenantAwareSqliteTaskStore | Multi-tenant SQLite task store (sqlite feature) |
TenantAwareSqlitePushConfigStore | Multi-tenant SQLite push config store (sqlite feature) |
PostgresTaskStore | PostgreSQL task store (postgres feature) |
PostgresPushConfigStore | PostgreSQL push config store (postgres feature) |
TenantAwarePostgresTaskStore | Multi-tenant PostgreSQL task store (postgres feature) |
TenantAwarePostgresPushConfigStore | Multi-tenant PostgreSQL push config store (postgres feature) |
PgMigrationRunner | PostgreSQL migration runner (postgres feature) |
PostgresDelegationJournal | A supervisor's DelegationJournal in PostgreSQL, shared by its replicas (postgres feature; ADR 0030) |
SqliteDelegationJournal | A supervisor's DelegationJournal in a SQLite file, kept across a restart on one host (sqlite feature; ADR 0030) |
StaticAgentCardHandler | Static agent card with HTTP caching |
DynamicAgentCardHandler | Dynamic agent card with producer |
HotReloadAgentCardHandler | Agent card with live reloading |
HeaderTenantResolver | TenantResolver that reads a configurable request header |
BearerTokenTenantResolver | TenantResolver that takes the Authorization: Bearer token as the tenant (a digest of it), or what a with_mapper closure makes of it; default() (and the deprecated new()) names the unverified token by its digest (tenant_resolver::tenant_id_for_token), so use with_mapper with a closure that verifies the token |
PathSegmentTenantResolver | TenantResolver that parses tenant from a configurable path segment |
RateLimitInterceptor | Per-caller rate limiting interceptor |
PostgresRateLimitCounter | A RateLimitCounter backed by a PostgreSQL table (postgres feature) |
ApiKeyAuthInterceptor | Rejects requests whose API-key header is absent or not in the allowed set |
BearerTokenAuthInterceptor | Rejects requests whose bearer token is absent or not in the allowed set |
AuthFailureThrottle | Refuses a peer whose credentials were refused too often, until its window ends |
auth::MutualTlsAuthInterceptor::with_forwarded | Also names a caller from the client certificate a trusted TLS-terminating proxy forwarded (tls-rustls or grpc-tls) |
auth::ForwardedClientCert | Where a proxy forwards the client certificate and which peers may: envoy (x-forwarded-client-cert), url_encoded_pem(header, ..) (nginx), aws_alb (x-amzn-mtls-clientcert) |
ReloadingCertResolver | A rustls certificate resolver that serves two PEM files and replaces the certificate on reload() or watch(interval); server_config() builds a configuration around it (tls-rustls) |
PeerAddr | Request extension carrying the connection's address, which the dispatchers copy to CallContext::peer_addr |
PeerCertificate | Request extension carrying the client's mutual-TLS certificate (DER), which the dispatchers pass to CallContext::peer_certificate |
ServerInterceptorChain | An ordered chain of ServerInterceptor instances |
CallOutcome | How a call ended — succeeded, failed with the error sent, or cancelled — as ServerInterceptor::on_complete is told |
Migration | A single SQLite schema migration (sqlite feature) |
MigrationRunner | Runs schema migrations against a SQLite database (sqlite feature) |
PgMigration | A single PostgreSQL schema migration (postgres feature) |
NoopMetrics | No-op metrics implementation (the default without the otel feature) |
OtelMetrics | OpenTelemetry metrics (otel feature, on by default) |
Streaming
| Name | Kind | Description |
|---|---|---|
EventEmitter | struct | Ergonomic event emission helper (wraps an EventQueueWriter): status, text_artifact, artifact_chunk, complete_with and complete_with_text (the result artifact then Completed), fail, auth_required, request_approval |
ArtifactChunk | struct | Where an artifact update sits in its artifact (append, last), for EventEmitter::artifact_chunk: whole(), first(), append(), last() |
EventQueueWriter | trait | Write events to a task's event stream |
EventQueueReader | trait | Read events from a task's event stream |
EventQueueManager | struct | Per-task queue lifecycle manager (create / lookup / destroy); with_max_buffered_bytes bounds the bytes all its queues hold at once and buffered_bytes reports them (ADR 0047) |
InMemoryQueueWriter | struct | Bounded-channel EventQueueWriter implementation |
InMemoryQueueReader | struct | Bounded-channel EventQueueReader implementation |
StreamEvent | struct | One queued event and its position in the task's event log (the SSE id:) |
Configuration
| Type | Description |
|---|---|
CorsConfig | Cross-origin policy |
TaskStoreConfig | TTL and capacity for in-memory store |
TenantStoreConfig | Configuration for TenantAwareInMemoryTaskStore |
TenantContext | Thread-safe tenant context for scoping store operations |
PerTenantConfig | Per-tenant configuration for timeouts, capacity limits, and executor selection |
TenantLimits | Resource limits declared for a single tenant |
RateLimitConfig | Configuration for RateLimitInterceptor |
TrustedProxy | An address range (10.0.0.0/8) of reverse proxies whose forwarded header is believed; set on RateLimitConfig and AuthFailureThrottleConfig, and on ForwardedClientCert |
ForwardedHeader | The header the trusted proxies write the client address into: XForwardedFor (default) or RFC 7239 Forwarded; with_forwarded_header on RateLimitConfig and AuthFailureThrottleConfig |
InvalidTrustedProxy | Why a string is not a TrustedProxy |
AuthFailureThrottleConfig | Configuration for AuthFailureThrottle |
PushRetryPolicy | Retry policy for push notification delivery |
ServerError | Server-level error type |
ServerResult<T> | Alias for Result<T, ServerError> |
SDK (a2a-protocol-sdk)
Modules
| Module | Re-exports |
|---|---|
a2a_protocol_sdk::types | All a2a-protocol-types exports |
a2a_protocol_sdk::client | All a2a-protocol-client exports |
a2a_protocol_sdk::server | All a2a-protocol-server exports |
a2a_protocol_sdk::prelude | Most commonly used types |
Telemetry
| Item | Description |
|---|---|
Telemetry | OpenTelemetry for the process, from the standard OTEL_* environment: every signal is exported (to localhost when nothing names an endpoint) unless with_export_where_configured() limits it to the signals an endpoint names (otlp, on by default; a2a_protocol_server::otel::Telemetry) |
Prelude Contents
The prelude includes the most commonly used types from all three crates — see Project Structure for the full list.
Constructors Cheatsheet
use a2a_protocol_sdk::prelude::*; use a2a_protocol_sdk::types::push::TaskPushNotificationConfig; fn main() -> Result<(), Box<dyn std::error::Error>> { let base64_string = "aGVsbG8="; let card = AgentCard::new("a", "1.0.0", AgentInterface::jsonrpc("http://localhost:3000")).with_description("An example agent"); // Task status TaskStatus::new(TaskState::Working); TaskStatus::with_timestamp(TaskState::Completed); // Messages and parts (v1.0 wire format: flat oneof) Part::text("hello"); // → {"text": "hello"} Part::raw(base64_string); // → {"raw": "aGVsbG8="} Part::url("https://..."); // → {"url": "https://..."} Part::data(serde_json::json!({"k": 1})); // → {"data": {"k": 1}} Part::file_bytes(base64_string); // deprecated alias for raw(); prefer raw() Part::file_uri("https://..."); // deprecated alias for url(); prefer url() let wire = |p: Part| serde_json::to_value(p).unwrap(); assert_eq!(wire(Part::text("hello")), serde_json::json!({"text": "hello"})); assert_eq!(wire(Part::raw(base64_string)), serde_json::json!({"raw": "aGVsbG8="})); assert_eq!(wire(Part::url("https://...")), serde_json::json!({"url": "https://..."})); assert_eq!(wire(Part::data(serde_json::json!({"k": 1}))), serde_json::json!({"data": {"k": 1}})); assert_eq!(wire(Part::file_bytes(base64_string)), wire(Part::raw(base64_string))); assert_eq!(wire(Part::file_uri("https://...")), wire(Part::url("https://..."))); // Artifacts Artifact::new("artifact-id", vec![Part::text("content")]); // IDs TaskId::new("task-123"); ContextId::new("ctx-456"); MessageId::new("msg-789"); // Capabilities (non_exhaustive — use builder) AgentCapabilities::none() .with_streaming(true) .with_push_notifications(false); // Agent cards: `new` takes name, version and the first interface; `validate` also needs a description and a skill with a tag, so add both by `with_*` AgentCard::new("my-agent", "1.0.0", AgentInterface::jsonrpc("http://localhost:3000")) .with_description("Does one thing well") .with_skill(AgentSkill::new("echo", "Echo", "Repeats").with_tags(["text"])) .with_interface(AgentInterface::grpc("http://localhost:50051")) .with_streaming(true); // one flag; with_capabilities(..) for the rest // Client-side: which interface `from_card` picked ClientBuilder::from_card(&card)?.chosen_interface(); // Option<&AgentInterface> // Push configs TaskPushNotificationConfig::new("task-id", "https://webhook.url"); Ok(()) }
Next Steps
- Changelog — Version history
- Configuration Reference — All tunable parameters