Skip to main content

Module prelude

Module prelude 

Source
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 feature tls-rustls (on by default), HttpPool and HttpPoolBuilder for 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 deprecated serve and serve_with_addr)
  • Executor ergonomics: agent_executor!, boxed_future, EventEmitter, ArtifactChunk
  • Errors: A2aError, A2aResult, ClientError, ClientResult, ServerError, ServerResult
  • Telemetry (feature otlp): Telemetry; Axum (feature axum): RestRouter (and A2aRouter, 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 AgentExecutor implementation from a closure-like syntax.

Structs§

A2aClient
A client for communicating with A2A-compliant agents.
A2aError
The canonical error type for A2A protocol operations.
A2aRouteraxum
Builder for an Axum [Router] that serves all A2A v1.0 protocol methods.
AgentCapabilities
Defines optional capabilities supported by an agent.
AgentCard
A self-describing manifest for an agent. It provides essential metadata including the agent’s identity, capabilities, skills, supported communication methods, and security requirements.
AgentInterface
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.
AgentSkill
Represents a distinct capability or function that an agent can perform.
ApiKeyAuthInterceptor
Rejects requests whose API-key header is absent or not in the allowed set.
Artifact
Artifacts represent task outputs.
ArtifactChunk
Where an artifact update event sits in its artifact.
ArtifactId
Opaque unique identifier for an Artifact.
BearerAuthInterceptor
A CallInterceptor that injects Authorization: Bearer <token> from a TokenProvider before every request.
BearerTokenAuthInterceptor
Rejects requests whose Authorization: Bearer <token> is absent or whose token is not in the allowed set.
ClientBuilder
Builder for A2aClient.
ContextId
Opaque unique identifier for a conversation context.
EventEmitter
Ergonomic helper for emitting status and artifact events from an executor.
EventStream
An async stream of StreamResponse events from an SSE endpoint.
FileContent
Content of a file part.
HttpPooltls-rustls
One set of HTTP connections that many clients share.
HttpPoolBuildertls-rustls
Builds an HttpPool: HttpPool::builder.
JsonRpcDispatcher
JSON-RPC 2.0 request dispatcher.
ListTasksParams
Parameters for listing tasks with optional filtering criteria.
Message
Message is one unit of communication between client and server.
MessageId
Opaque unique identifier for a Message.
MessageSendParams
Represents a request for the SendMessage method.
OAuth2ClientCredentials
A TokenProvider implementing the OAuth 2.0 client credentials grant (RFC 6749 §4.4) with caching and proactive refresh.
Part
Part represents 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).
RateLimitConfig
Configuration for RateLimitInterceptor.
RateLimitInterceptor
A fixed-window rate limiting ServerInterceptor.
RequestContext
Context for a single agent execution request.
RequestHandler
The core protocol logic handler.
RequestHandlerBuilder
Fluent builder for RequestHandler.
RestDispatcher
REST HTTP request dispatcher.
RetryBudget
How many retries a client may make, as a fraction of the calls it makes.
RetryPolicy
Configuration for automatic retry with exponential backoff.
ServeConfig
Limits applied to a Server.
Server
A bound listener that has not started accepting yet.
StaticTokenProvider
A TokenProvider that always returns the same fixed token.
Task
Task is the core unit of action for A2A.
TaskArtifactUpdateEvent
A task delta where an artifact has been generated.
TaskId
Opaque unique identifier for a Task.
TaskListResponse
Result object for ListTasks method containing an array of tasks and pagination information.
TaskQueryParams
Represents a request for the GetTask method.
TaskStatus
A container for the status of a task
TaskStatusUpdateEvent
An event sent by the agent to notify the client of a change in a task’s status.
Telemetryotlp
Exporting providers for traces, metrics and logs, and the guard that flushes them. Built by Telemetry::init or Telemetry::builder.
WebhookReceiverwebhook
Checks webhook requests against the push configs a client registered (spec §4.3.3, §13.2).

Enums§

ClientError
Errors that can occur during A2A client operations.
MessageRole
Defines the sender of a message in A2A protocol communication.
PartContent
The content of a Part, discriminated by JSON member name per v1.0 spec.
SendMessageResponse
Represents the response for the SendMessage method.
ServerError
Server framework error type.
StreamResponse
A wrapper object used in streaming operations to encapsulate different types of response data.
TaskState
Defines the possible lifecycle states of a Task.
WebhookOutcomewebhook
What became of one webhook request.

Traits§

AgentExecutor
Trait for implementing A2A agent execution logic.
Dispatcher
Trait for types that can dispatch HTTP requests to an A2A handler.
EventQueueWriter
Trait for writing streaming events.
TokenProvider
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 AgentCard from the standard well-known path.
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.

Type Aliases§

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