A2A Protocol

Agent-to-Agent communication protocol

A2A (Agent-to-Agent) enables standardized communication between agents.

Diagram

A2A Protocol

🤖 Agent 1

📡 A2A

🤖 Agent 2

Quick Start

  1. Create an Agent with A2A Card
    rust
    use praisonai::{Agent, A2A, A2AAgentCard};
    
    // First create your agent
    let agent = Agent::new()
        .name("Support Agent")
        .instructions("Help users with support questions")
        .build()?;
    
    // Create A2A card for discovery
    let card = A2AAgentCard::new()
        .name("Support Agent")
        .description("Handles customer support")
        .url("http://localhost:8080");
    
    // Start A2A server
    let a2a = A2A::new()
        .card(card)
        .build()?;
  2. Connect to Remote Agent
    rust
    use praisonai::A2A;
    
    // Connect to another agent
    let remote = A2A::connect("http://agent-b:8080").await?;
    
    // Send a task
    let task = remote.create_task("Summarize this document").await?;
    let result = remote.get_task_result(&task.id).await?;

A2A Components

ComponentDescription
A2AAgentCardAgent’s public identity and capabilities
A2ATaskWork unit sent between agents
A2AProtocol handler for communication

Related