a2a_http_server
A2A HTTP Server
Section titled “A2A HTTP Server”A2A HTTP Server with WASM default and native testing support
✅ Target Adaptive: WASM (Spin SDK) + Native (Axum) with identical APIs ✅ Complete Feature Parity: All A2A protocol methods work identically ✅ Testing Excellence: Native HTTP server for comprehensive testing ✅ Clean Architecture: Protocol instance injection, no global state ✅ Comprehensive Logging: Debug, info, warn, error levels with agent context
Structs
Section titled “Structs”A2AHttpServer
Section titled “A2AHttpServer”A2A HTTP Server - Native implementation using Axum
Wraps an A2AProtocol instance to provide HTTP transport. No global state, pure dependency injection.
Methods
fn new(protocol: A2AProtocol) -> SelfCreate new HTTP server with protocol instance
new_with_a2a_methods
Section titled “new_with_a2a_methods”fn new_with_a2a_methods(agent_card: AgentCard) -> SelfRecommended Constructor: Create HTTP server with full A2A standard methods
with_app_adapter
Section titled “with_app_adapter”fn with_app_adapter(self, app: Arc<dyn a2a_app_ports::A2AAppPort>) -> SelfAttach application adapter (SDK) for delegation of selected methods
with_app_adapter_async
Section titled “with_app_adapter_async”fn with_app_adapter_async(self, app: Arc<dyn a2a_app_ports::A2AAppPortAsync>) -> SelfAttach async application adapter (SDK) for delegation of selected methods
new_with_storage
Section titled “new_with_storage”fn new_with_storage(agent_card: AgentCard, storage: Arc<dyn TaskStorage>) -> SelfCreate HTTP server with custom task storage
agent_id
Section titled “agent_id”fn agent_id(&self) -> &strGet agent ID (for testing)
can_serve
Section titled “can_serve”fn can_serve(&self) -> boolCheck if server can serve (for testing)
build_router
Section titled “build_router”fn build_router(self) -> RouterBUILD AXUM ROUTER: Create router for native HTTP serving
async fn serve(self, addr: &str) -> Result<()>START SERVER: Start the server on given address (for testing)
serve_request
Section titled “serve_request”async fn serve_request(&self, method: &str, path: &str, headers: HeaderMap, body: Vec<u8>) -> Result<(StatusCode, HeaderMap, Vec<u8>)>SERVE REQUEST SIMULATION: For API compatibility testing
Functions
Section titled “Functions”init_logging
Section titled “init_logging”fn init_logging(component_name: &str)Initialize logging for A2A HTTP Server
This is a convenience function that can be called by applications to ensure proper logging is configured for the A2A HTTP server.
Arguments
Section titled “Arguments”component_name- Name of the component (typically the agent name)
Example
Section titled “Example”a2a_http_server::init_logging("my-agent");log_server_info
Section titled “log_server_info”fn log_server_info(agent_id: &str)Log server creation with target information