Expand description
Server framework for implementing A2A v1 agents.
Published as a2a-server-lf and imported as a2a_server. The protocol
types come from the a2a crate.
§How a request flows
A protocol binding turns a wire request into a call on a
RequestHandler. DefaultRequestHandler is the implementation most
agents use: it manages the task lifecycle, saves tasks in a TaskStore,
and hands the work to your AgentExecutor, which returns a stream of
events.
§Where to start
- Implement
AgentExecutorwith the agent’s logic.ExecutorContextdescribes the request being served. - Build a
DefaultRequestHandlerfrom the executor and aTaskStore.InMemoryTaskStoreis provided. - Mount a binding on an axum router with
jsonrpc::jsonrpc_routerorrest::rest_router. The gRPC and SLIMRPC bindings are in thea2a-grpcanda2a-slimrpccrates. - Serve the agent card at
WELL_KNOWN_AGENT_CARD_PATHwithagent_card::agent_card_router, from aStaticAgentCardor your ownAgentCardProducer.
§Also in this crate
sse: streaming responses as server-sent events.push: push notification configs (PushConfigStore) and their delivery (HttpPushSender).middleware:CallInterceptors around a handler, applied withInterceptedHandler.RequestAuthorizer: decides whether a request may proceed; set it withDefaultRequestHandler::with_authorizer.pagination: the page limits the list endpoints share.
§Feature flags
rustls-tls(default): rustls, with its default crypto provider, for push notification delivery and for serving over HTTPS through thetlsmodule.rustls-no-provider: the same, with the crypto provider installed by the application.native-tls: the platform’s native TLS stack for push notification delivery. Thetlsmodule is not available with this flag alone.
fuzzing is for the fuzz targets in this repository, not for dependents.
Re-exports§
pub use agent_card::AgentCardProducer;pub use agent_card::StaticAgentCard;pub use agent_card::WELL_KNOWN_AGENT_CARD_PATH;pub use executor::AgentExecutor;pub use executor::ExecutorContext;pub use handler::DefaultRequestHandler;pub use handler::ExtendedAgentCardResolver;pub use handler::RequestAuthorizer;pub use handler::RequestHandler;pub use middleware::CallContext;pub use middleware::CallInterceptor;pub use middleware::InterceptedHandler;pub use middleware::ServiceParams;pub use middleware::User;pub use push::HttpPushSender;pub use push::HttpPushSenderConfig;pub use push::InMemoryPushConfigStore;pub use push::PushConfigStore;pub use task_store::InMemoryTaskStore;pub use task_store::TaskStore;
Modules§
- agent_
card - executor
- handler
- jsonrpc
- middleware
- pagination
- Shared paging limits for the list endpoints.
- push
- rest
- sse
- task_
store - tls
- Re-exports for serving axum routers over HTTPS with rustls.