> This is a page from the ElevenLabs documentation. For an index of the documentation, fetch https://elevenlabs.io/docs/llms.txt.

# A2A server

## Overview

Every ElevenLabs agent can be reached over the [Agent2Agent (A2A) protocol](https://a2a-protocol.org/), the open standard for agents built on different platforms to work together. An orchestrator agent built with Google ADK, Microsoft Foundry, LangGraph or any other A2A client can discover your agent, send it messages and get its replies, without a custom integration.

The agent answers with the same configuration it uses everywhere else: its prompt, knowledge base, tools, workflows and guardrails. Conversations over A2A run as text and appear in the agent's conversation history like any other conversation.

> **Note**
>
> The A2A server is in alpha and is enabled per workspace. Contact your account team to enable it.
> Until then, requests return an error saying the A2A server is not enabled for the workspace.

## Endpoints

Each agent has its own agent card and JSON-RPC endpoint. Replace `{agent_id}` with your agent's ID:

| Purpose    | URL                                                                              |
| ---------- | -------------------------------------------------------------------------------- |
| Agent card | `https://api.elevenlabs.io/v1/convai/a2a/{agent_id}/.well-known/agent-card.json` |
| JSON-RPC   | `https://api.elevenlabs.io/v1/convai/a2a/{agent_id}`                             |

Workspaces in an isolated [data residency](/docs/overview/administration/data-residency) environment use their region's host instead of `api.elevenlabs.io`, for example `api.eu.residency.elevenlabs.io`.

The agent card tells A2A clients the agent's name, the JSON-RPC URL, that replies stream, and that requests need an API key.

## Authentication

Send an ElevenLabs API key in the `xi-api-key` header, on both the agent card and the JSON-RPC requests. Create a dedicated key in the same workspace as the agent and scope it to ElevenAgents with write access.

> **Warning**
>
> Anyone with the key can talk to every agent in the workspace that the key can access. Store it in
> your A2A client's secret store, and do not put it in client-side code.

## Send a message

`SendMessage` sends one user message and returns the agent's reply as a `Message`:

```bash
curl https://api.elevenlabs.io/v1/convai/a2a/$AGENT_ID \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "SendMessage",
    "params": {
      "message": {
        "messageId": "msg-1",
        "role": "ROLE_USER",
        "parts": [{ "text": "What are your opening hours?" }]
      }
    }
  }'
```

```json
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "message": {
      "messageId": "9f1c…",
      "role": "ROLE_AGENT",
      "contextId": "6b0e…",
      "parts": [
        { "text": "We're open from 9am to 6pm, Monday to Saturday.", "mediaType": "text/plain" }
      ]
    }
  }
}
```

A request without a `contextId` starts a new conversation, and the reply carries its `contextId`. To continue the conversation, send the next message with that `contextId`. The agent then remembers everything said earlier in it.

## Stream the reply

`SendStreamingMessage` takes the same parameters and returns server-sent events, each a JSON-RPC response:

1. A `task` in the `TASK_STATE_WORKING` state.
2. `artifactUpdate` events with the reply text as the agent generates it, one artifact per reply.
3. A `statusUpdate` with the terminal state: `TASK_STATE_COMPLETED`, or `TASK_STATE_FAILED` with the reason in `status.message`.

Track text by `artifactId`: append it when `append` is `true`, and replace the stored text when `append` is `false`. The closing update contains the full reply with `append: false` and `lastChunk: true`, so replace the accumulated text with that final reply.

Each task covers one turn: it ends when the agent has answered. Continue the conversation with the `contextId`, not the task ID.

## Use your agent from other agents

A2A clients only need the agent card URL and the API key header.

### Google ADK

With [Google ADK](https://adk.dev/a2a/quickstart-consuming/), wrap your agent in a `RemoteA2aAgent` and hand it to an orchestrator as a sub-agent. The orchestrator decides when to delegate, and ADK sends the follow-up messages in the same conversation:

```python maxLines=0
# pip install "google-adk[a2a]"
import os

import httpx
from google.adk.agents import Agent
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent

agent_id = os.environ["ELEVENLABS_AGENT_ID"]

support_agent = RemoteA2aAgent(
    name="support_agent",
    description="Acme's support agent. Answers questions about orders, shipping and returns.",
    agent_card=f"https://api.elevenlabs.io/v1/convai/a2a/{agent_id}/.well-known/agent-card.json",
    httpx_client=httpx.AsyncClient(
        headers={"xi-api-key": os.environ["ELEVENLABS_API_KEY"]}, timeout=120
    ),
)

root_agent = Agent(
    model="gemini-2.5-flash",
    name="assistant",
    instruction="You are a personal assistant. Hand any question about an Acme order to support_agent.",
    sub_agents=[support_agent],
)
```

Run it with `adk web` and ask the assistant about an order. The assistant transfers the conversation to your ElevenLabs agent, which answers over A2A and remembers earlier turns:

![The ADK web UI: the assistant transfers to support\_agent, the ElevenLabs agent, which answers
and remembers the user's name on the next turn](/docs/_fern-files/_img/678d0f3a7280b491e1bdffa74aa649f1eba66c6c5a63dcd38b0d6d47e9eafa66.webp)

### A2A Python SDK

With the [A2A Python SDK](https://github.com/a2aproject/a2a-python) 1.x, create a client from the agent's base URL. The client discovers the agent card automatically:

```python maxLines=0
# uv add "a2a-sdk>=1.3.1,<2"
import asyncio
import os

import httpx
from a2a.client import ClientConfig, create_client
from a2a.helpers import new_text_message
from a2a.types import Role, SendMessageRequest

agent_id = os.environ["ELEVENLABS_AGENT_ID"]


async def main() -> None:
    async with httpx.AsyncClient(
        headers={"xi-api-key": os.environ["ELEVENLABS_API_KEY"]}, timeout=120
    ) as http:
        client = await create_client(
            f"https://api.elevenlabs.io/v1/convai/a2a/{agent_id}",
            client_config=ClientConfig(httpx_client=http),
        )
        message = new_text_message("What are your opening hours?", role=Role.ROLE_USER)
        async for event in client.send_message(SendMessageRequest(message=message)):
            print(event)


asyncio.run(main())
```

## Protocol support

The server supports A2A v1.0 and v0.3 over the same JSON-RPC endpoint. The examples above use v1.0; v0.3 clients use different method names and message shapes:

| Contract              | A2A v1.0                                                      | A2A v0.3                                                        |
| --------------------- | ------------------------------------------------------------- | --------------------------------------------------------------- |
| Send / stream methods | `SendMessage` / `SendStreamingMessage`                        | `message/send` / `message/stream`                               |
| User message          | `role: "ROLE_USER"`                                           | `role: "user"`, `kind: "message"`                               |
| Text part             | `{ "text": "Hello" }`                                         | `{ "kind": "text", "text": "Hello" }`                           |
| Reply location        | `result.message`                                              | `result` with `kind: "message"`                                 |
| Streaming events      | `result.task`, `result.artifactUpdate`, `result.statusUpdate` | `result.kind`: `task`, `artifact-update`, `status-update`       |
| Terminal task states  | `TASK_STATE_COMPLETED` / `TASK_STATE_FAILED`                  | `completed` / `failed`, with `final: true` on the status update |

Both versions carry `contextId` on the reply message. Reuse it in `params.message.contextId` for the next turn, and omit `taskId`.

Tasks cannot be retrieved, canceled or resumed through the task methods. `GetTask`, `CancelTask` and `SubscribeToTask` (v0.3: `tasks/get`, `tasks/cancel` and `tasks/resubscribe`) return `TaskNotFoundError`. `ListTasks` in v1.0 returns an empty list.

Malformed message parameters return a JSON-RPC error with code `-32602` and the request's `id`. For example, `role` must be a string; an array or object is invalid. This also applies to streaming requests, which return a JSON error response before a stream starts.

The agent card is also served at `/v1/convai/a2a/{agent_id}/.well-known/agent.json` for clients that look for it there. Both card URLs require the same `xi-api-key` header as the JSON-RPC endpoint.

### Limitations

> **Warning**
>
> These cases return an error instead of a reply:
>
> * **Text only.** Messages must contain only text parts. Files and structured data are refused with `ContentTypeNotSupportedError`.
> * **Voice agents** run as text only when their [security settings](/docs/eleven-agents/customization/personalization/overrides) allow clients to override text-only mode. Otherwise, make the agent text-only.
> * **Zero Retention Mode** agents can't be reached over A2A.

* **No client tools.** A2A clients can't answer [client tool](/docs/eleven-agents/customization/tools/client-tools) calls. If the agent calls one, the tool returns an error to the agent and the turn continues.
* **No push notifications.** Use streaming to get the reply as it's generated.
* **Conversation webhooks.** A2A text conversations do not invoke voice conversation-initiation webhooks or automatically run post-call analysis and webhooks.