Skip to content

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.

No feature flags — this crate has no [features] section.

Type alias:

  • AppFuture<'a> — pinned boxed future returning A2AResult<SendMessageResponse>. On WASM it is !Send; on native it is Send.

Traits:

  • A2AAppPort (sync) — Send + Sync
    • build_agent_card(&self) -> AgentCard
    • handle_send_message(&self, params: SendMessageRequest) -> A2AResult<SendMessageResponse>
  • A2AAppPortAsync (async) — Send + Sync
    • build_agent_card(&self) -> AgentCard
    • handle_send_message_async<'a>(&'a self, params: SendMessageRequest) -> AppFuture<'a>
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