Skip to main content

Crate a2a_ao

Crate a2a_ao 

Source
Expand description

§a2a-ao

Rust SDK for the Agent-to-Agent (A2A) protocol — the open standard for agent interoperability, governed by the Linux Foundation.

A2A enables AI agents to discover each other, delegate tasks, and collaborate regardless of framework or platform.

§Architecture

The A2A protocol has three layers:

  1. Canonical Data Model — Protocol-agnostic type definitions (this crate’s types)
  2. Abstract Operations — Core operations like SendMessage, GetTask, etc.
  3. Protocol Bindings — Wire-level: JSON-RPC 2.0, gRPC, HTTP+JSON

§Quick Start

use a2a_ao::{A2AClient, AgentCard};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Discover a remote agent
    let card = AgentCard::discover("https://agent.example.com").await?;
    println!("Found: {}", card.name);

    // Create a client and send a message
    let client = A2AClient::new("https://agent.example.com");
    let response = client.send_message_text("Summarize Q4 report").await?;
    println!("Task state: {:?}", response.state);
    Ok(())
}

Re-exports§

pub use agent_card::AgentCapabilities;
pub use agent_card::AgentCard;
pub use agent_card::AgentProvider;
pub use agent_card::AgentSkill;
pub use agent_card::ContentType;
pub use agent_card::SecurityScheme;
pub use artifact::Artifact;
pub use client::A2AClient;
pub use client::SendMessageRequest;
pub use error::A2AError;
pub use message::DataPart;
pub use message::FilePart;
pub use message::Message;
pub use message::MessagePart;
pub use message::MessageRole;
pub use notification::PushNotificationConfig;
pub use notification::PushNotificationEvent;
pub use task::Task;
pub use task::TaskEvent;
pub use task::TaskQueryParams;
pub use task::TaskState;
pub use transport::jsonrpc::JsonRpcError;
pub use transport::jsonrpc::JsonRpcRequest;
pub use transport::jsonrpc::JsonRpcResponse;
pub use transport::sse::TaskEventStream;

Modules§

agent_card
Agent Card — the self-describing metadata document for agent discovery.
artifact
Artifact — outputs/deliverables produced by a task.
client
A2A Client — high-level client for interacting with A2A-compatible agents.
error
A2A Error types.
message
Message — communication units between agents in A2A.
notification
Push notification types for A2A webhook-based async delivery.
task
Task — the stateful unit of work in the A2A protocol.
transport
Transport layer — wire-level protocol bindings for A2A.