Skip to main content
PraisonAI supports the A2A Protocol for agent-to-agent communication, enabling your agents to be discovered and collaborate with other AI agents via JSON-RPC 2.0.
The user publishes an agent as an A2A server; other agents discover it via the agent card and collaborate over JSON-RPC.

Quick Start

1

Simple Agent Server

2

FastAPI Integration


JSON-RPC Methods

The A2A server exposes six JSON-RPC 2.0 methods for complete task lifecycle management:

message/send

Send a message and receive the complete task result:
Response:

message/stream

Send a message and receive real-time updates via Server-Sent Events:
SSE Event Format:

tasks/get

Retrieve an existing task by ID:

tasks/cancel

Cancel a running task:

Configuration Options


Multi-Agent Support

Route messages to multi-agent workflows using AgentTeam:
When both agent and agents are provided, the single agent takes priority.

Streaming Events

Event Types


Agent Card

The Agent Card is automatically generated from your agent’s configuration:
Access via: GET /.well-known/agent.json

Message Parts

A2A messages support multimodal content through different part types:

A2UI payloads

When an agent uses send_a2ui_messages, sync message/send artifacts may include a DataPart with metadata.mimeType of application/json+a2ui. Use create_a2ui_part() / is_a2ui_part() from praisonaiagents.ui.a2ui for manual wrapping.
A2A message/stream currently emits text-only artifacts. For live A2UI during streaming, prefer AG-UI or PraisonAIUI.
See A2UI Protocol for the tool contract and renderer options.

Authentication

Protect your A2A endpoint with bearer token authentication:
Authenticated requests:
The discovery endpoint (/.well-known/agent.json) remains public per A2A spec. Only POST /a2a requires authentication.

Task Lifecycle


Docker Deployment

requirements.txt:

Best Practices

Set auth_token on any A2A server exposed beyond localhost. The discovery card stays public per spec — keep sensitive skills and tools out of the advertised card when auth is required.
Use message/stream when responses may take more than a few seconds. Clients receive progress via SSE instead of blocking on a single JSON-RPC response.
Route complex workflows through AgentTeam rather than chaining multiple single agents. One A2A endpoint can orchestrate monitor → act → feedback loops cleanly.
Keep name, description, and url aligned with your deployment. External agents discover capabilities via GET /.well-known/agent.json — stale URLs break inter-agent handoffs.

A2UI Protocol

Declarative UI via send_a2ui_messages and DataPart artifacts

A2A Client

A2A client for connecting to other agents

MCP Lifecycle

Model Context Protocol for tool integration