a2a_app_ports
Crate: a2a_app_ports · Path: crates/a2a_app_ports
Description (Cargo.toml): Application layer ports for A2A servers (clean architecture)
Defines the application-facing port traits that the infrastructure layer (HTTP server) uses to delegate A2A methods to the SDK/application layer. This is the clean-architecture boundary: the server depends on these traits, and the SDK implements them.
Feature flags
Section titled “Feature flags”No feature flags — this crate has no [features] section.
Public API (from src/lib.rs)
Section titled “Public API (from src/lib.rs)”Type alias:
AppFuture<'a>— pinned boxed future returningA2AResult<SendMessageResponse>. On WASM it is!Send; on native it isSend.
Traits:
A2AAppPort(sync) —Send + Syncbuild_agent_card(&self) -> AgentCardhandle_send_message(&self, params: SendMessageRequest) -> A2AResult<SendMessageResponse>
A2AAppPortAsync(async) —Send + Syncbuild_agent_card(&self) -> AgentCardhandle_send_message_async<'a>(&'a self, params: SendMessageRequest) -> AppFuture<'a>
Example sketch
Section titled “Example sketch”use a2a_app_ports::{A2AAppPort, A2AAppPortAsync};use a2a_protocol_core::{AgentCard, A2AResult};use a2a_protocol_core::methods::params::{SendMessageRequest, SendMessageResponse};
struct MyAgent { /* ... */ }
impl A2AAppPort for MyAgent { fn build_agent_card(&self) -> AgentCard { AgentCard::new("my-agent".into()) }
fn handle_send_message(&self, params: SendMessageRequest) -> A2AResult<SendMessageResponse> { // process the message and return a response todo!() }}Full API reference: cargo doc -p a2a_app_ports --no-deps