Expand description
Convenience re-exports for common A2A usage patterns.
Import with use a2a_protocol_sdk::prelude::* to get the most frequently used
types for building agents and clients:
- Wire types:
Task,TaskState,TaskStatus,Message,Part,PartContent,FileContent,MessageRole,Artifact,StreamResponse,AgentCard,AgentCapabilities,AgentInterface,AgentSkill, and the task events - ID newtypes:
TaskId,ContextId,MessageId,ArtifactId - Params and responses:
MessageSendParams,TaskQueryParams,ListTasksParams,SendMessageResponse,TaskListResponse - Client:
A2aClient,ClientBuilder,EventStream,RetryPolicy,RetryBudget,resolve_agent_card, and the token providers and bearer interceptor (TokenProvider,StaticTokenProvider,OAuth2ClientCredentials,BearerAuthInterceptor), and, with featuretls-rustls(on by default),HttpPoolandHttpPoolBuilderfor sharing HTTP connections between clients - Webhooks (feature
webhook, on by default):WebhookReceiver,WebhookOutcome, for receiving push notifications - Server:
AgentExecutor,RequestHandler,RequestHandlerBuilder,RequestContext,EventQueueWriter,JsonRpcDispatcher,RestDispatcher,Dispatcher,Server,ServeConfig,shutdown_signal, and the auth and rate-limit interceptors (and the deprecatedserveandserve_with_addr) - Executor ergonomics:
agent_executor!,boxed_future,EventEmitter,ArtifactChunk - Errors:
A2aError,A2aResult,ClientError,ClientResult,ServerError,ServerResult - Telemetry (feature
otlp):Telemetry; Axum (featureaxum):RestRouter(andA2aRouter, the same type)
This is a summary: the pub use lines of the module are the complete list.
§Reading the caller’s text
Message::text returns the first text
part, so the common case needs no PartContent match at all. PartContent
is in the prelude for the cases that do — inspecting file, URL, or
structured-data parts.
Modules§
- serve
- Server startup.
Macros§
- agent_
executor - Generates an
AgentExecutorimplementation from a closure-like syntax.
Structs§
- A2aClient
- A client for communicating with A2A-compliant agents.
- A2aError
- The canonical error type for A2A protocol operations.
- A2aRouter
axum - Builder for an Axum [
Router] that serves all A2A v1.0 protocol methods. - Agent
Capabilities - Defines optional capabilities supported by an agent.
- Agent
Card - A self-describing manifest for an agent. It provides essential metadata including the agent’s identity, capabilities, skills, supported communication methods, and security requirements.
- Agent
Interface - Declares a combination of a target URL, transport and protocol version for interacting with the agent. This allows agents to expose the same functionality over multiple protocol binding mechanisms.
- Agent
Skill - Represents a distinct capability or function that an agent can perform.
- ApiKey
Auth Interceptor - Rejects requests whose API-key header is absent or not in the allowed set.
- Artifact
- Artifacts represent task outputs.
- Artifact
Chunk - Where an artifact update event sits in its artifact.
- Artifact
Id - Opaque unique identifier for an
Artifact. - Bearer
Auth Interceptor - A
CallInterceptorthat injectsAuthorization: Bearer <token>from aTokenProviderbefore every request. - Bearer
Token Auth Interceptor - Rejects requests whose
Authorization: Bearer <token>is absent or whose token is not in the allowed set. - Client
Builder - Builder for
A2aClient. - Context
Id - Opaque unique identifier for a conversation context.
- Event
Emitter - Ergonomic helper for emitting status and artifact events from an executor.
- Event
Stream - An async stream of
StreamResponseevents from an SSE endpoint. - File
Content - Content of a file part.
- Http
Pool tls-rustls - One set of HTTP connections that many clients share.
- Http
Pool Builder tls-rustls - Builds an
HttpPool:HttpPool::builder. - Json
RpcDispatcher - JSON-RPC 2.0 request dispatcher.
- List
Tasks Params - Parameters for listing tasks with optional filtering criteria.
- Message
Messageis one unit of communication between client and server.- Message
Id - Opaque unique identifier for a
Message. - Message
Send Params - Represents a request for the
SendMessagemethod. - OAuth2
Client Credentials - A
TokenProviderimplementing the OAuth 2.0 client credentials grant (RFC 6749 §4.4) with caching and proactive refresh. - Part
Partrepresents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).- Rate
Limit Config - Configuration for
RateLimitInterceptor. - Rate
Limit Interceptor - A fixed-window rate limiting
ServerInterceptor. - 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.
- Retry
Budget - How many retries a client may make, as a fraction of the calls it makes.
- Retry
Policy - Configuration for automatic retry with exponential backoff.
- Serve
Config - Limits applied to a
Server. - Server
- A bound listener that has not started accepting yet.
- Static
Token Provider - A
TokenProviderthat always returns the same fixed token. - Task
Taskis the core unit of action for A2A.- Task
Artifact Update Event - A task delta where an artifact has been generated.
- TaskId
- Opaque unique identifier for a
Task. - Task
List Response - Result object for
ListTasksmethod containing an array of tasks and pagination information. - Task
Query Params - Represents a request for the
GetTaskmethod. - Task
Status - A container for the status of a task
- Task
Status Update Event - An event sent by the agent to notify the client of a change in a task’s status.
- Telemetry
otlp - Exporting providers for traces, metrics and logs, and the guard that
flushes them. Built by
Telemetry::initorTelemetry::builder. - Webhook
Receiver webhook - Checks webhook requests against the push configs a client registered (spec §4.3.3, §13.2).
Enums§
- Client
Error - Errors that can occur during A2A client operations.
- Message
Role - Defines the sender of a message in A2A protocol communication.
- Part
Content - The content of a
Part, discriminated by JSON member name per v1.0 spec. - Send
Message Response - Represents the response for the
SendMessagemethod. - Server
Error - Server framework error type.
- Stream
Response - A wrapper object used in streaming operations to encapsulate different types of response data.
- Task
State - Defines the possible lifecycle states of a
Task. - Webhook
Outcome webhook - What became of one webhook request.
Traits§
- Agent
Executor - Trait for implementing A2A agent execution logic.
- Dispatcher
- Trait for types that can dispatch HTTP requests to an A2A handler.
- Event
Queue Writer - Trait for writing streaming events.
- Token
Provider - A source of bearer access tokens.
Functions§
- boxed_
future - Wraps an async expression into
Pin<Box<dyn Future<Output = T> + Send + 'a>>. - new_
message_ id - A new message id: a random UUID (version 4), as a
MessageId. - resolve_
agent_ card - Fetches the
AgentCardfrom the standard well-known path. - 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.
Type Aliases§
- A2aResult
- Convenience type alias:
Result<T, A2aError>. - Client
Result - Convenience type alias:
Result<T, ClientError>. - Rest
Router axum A2aRouterunder a name that says which binding it serves.- Server
Result - Convenience type alias:
Result<T, ServerError>.