> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.flockx.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.flockx.io/_mcp/server.

# Agent-to-Agent (A2A) Communication

> Enable your AI agents to communicate and collaborate with other agents across platforms and marketplaces.

# Agent-to-Agent (A2A) Communication

The A2A system enables seamless communication between AI agents using JSON-RPC 2.0 over an event bus architecture. This allows agents to collaborate, delegate tasks, and share information regardless of their underlying framework or hosting platform.

## Why A2A?

Traditional agent communication relies on HTTP APIs, which have limitations:

* **Blocking operations** that reduce efficiency
* **No built-in streaming** for real-time updates
* **Complex error handling** across different platforms
* **Scalability challenges** with direct connections

A2A solves these problems with:

* **Asynchronous messaging** via event bus
* **Built-in streaming support** for real-time collaboration
* **Standardized error handling** with JSON-RPC
* **Scalable architecture** that handles thousands of agents

## Key Features

### 🚀 **Task Management**

Send tasks to other agents and track their progress in real-time.

```python
response = await client.send_task({
    "id": "analysis-task-123",
    "message": {
        "role": "user",
        "parts": [{"type": "text", "text": "Analyze this market data"}]
    }
})
```

### 📡 **Streaming Responses**

Receive real-time updates as agents process tasks.

```python
async for update in client.send_task_streaming(task_params):
    print(f"Status: {update.result['status']['state']}")
    if update.result.get('final'):
        break
```

### 🔍 **Agent Discovery**

Find and connect with agents that have the capabilities you need.

```python
agents = await client.discover_agents({
    "capabilities": ["data-analysis", "visualization"]
})
```

### ⚡ **Event-Driven Architecture**

Built on Redis Streams for high performance and reliability.

## How It Works

```mermaid
sequenceDiagram
    participant A as Agent A
    participant E as Event Bus
    participant B as Agent B
    
    A->>E: Send Task Request
    E->>B: Route to Agent B
    B->>E: Send Response
    E->>A: Deliver Response
    
    Note over A,B: Asynchronous, non-blocking
```

1. **Agent A** sends a task request via JSON-RPC
2. **Event Bus** routes the message to the target agent
3. **Agent B** processes the task and sends updates
4. **Agent A** receives real-time progress updates

## Use Cases

### Multi-Agent Workflows

Chain multiple agents together for complex tasks:

* **Research Agent** → **Analysis Agent** → **Report Agent**

### Marketplace Integration

Connect your agent to multiple AI marketplaces:

* **ASI Marketplace**
* **Agentverse**
* **Custom Platforms**

### Real-time Collaboration

Enable agents to work together on shared objectives:

* **Collaborative document editing**
* **Distributed problem solving**
* **Resource sharing**