# A2A agents

**Last updated:** 2026-11-23T10:17:09-03:00 (UTC-3)

Publish your agents ([A2A](https://a2a-protocol.org/) protocol) behind the gateway: clients call `/a2a/{id}` with the gateway key, the gateway checks whether the team can use that agent and forwards the call with the agent's credential, which never leaves the server. A kill switch turns an agent off immediately. Flag: `a2a_agents`.

## How to enable it

```yaml
features:
  a2a_agents: true
agents:
  - id: support
    name: Support agent
    url: https://agents.internal.example/rpc   # the agent's JSON-RPC endpoint
    auth_header: Authorization                 # optional; Authorization gets "Bearer "
    secret_env: SUPPORT_AGENT_TOKEN
    teams: [platform]                          # empty = nobody
```

| Key | Default | What it does |
| --- | --- | --- |
| `agents[].id` | required | Unique lower-case identifier (up to 63 characters); clients call the agent at `/a2a/<id>` |
| `agents[].name` | required | Display name, up to 120 bytes |
| `agents[].description` | empty | Up to 1000 bytes, shown in the agent list |
| `agents[].url` | required | The agent's A2A JSON-RPC endpoint |
| `agents[].card_url` | `<url origin>/.well-known/agent-card.json` | Where the gateway reads the agent's card |
| `agents[].auth_header` | empty | Header that carries the agent's credential, up to 64 letters, digits or dashes; `Authorization` gets a `Bearer ` prefix |
| `agents[].secret_env` | empty | Variable holding that credential; required together with `auth_header` |
| `agents[].teams` | `[]` | Teams whose keys may call the agent; empty means nobody |
| `agents[].disabled` | `false` | Turns the agent off without removing it |

**In the console:** the **Agents** menu lists, creates, edits, turns off (kill switch) and removes agents, and reads the agent's card on the spot. An agent from the YAML can be overridden through the console and reverted.

**Through the API:** `PUT` and `DELETE /api/v1/admin/agents/{id}`, and `POST /api/v1/admin/agents/{id}/kill_switch`. The credential is always referenced by the environment variable's name, never by its value.

## How to use it

The client key needs the `agents:invoke` scope, and its team must be in `teams`.

| Route | What it does |
| --- | --- |
| `GET /v1/agents` | Lists the agents the key can call |
| `GET /a2a/{id}/.well-known/agent-card.json` | The agent's card, rewritten to point to the gateway |
| `POST /a2a/{id}` | A2A JSON-RPC, versions 0.3 and 1.0: `message/send`, `message/stream` and tasks |

With the A2A SDK in Python:

```python
async with httpx.AsyncClient(headers={"Authorization": f"Bearer {gateway_key}"}) as http:
    client = await create_client("https://gateway.example/a2a/support", ClientConfig(httpx_client=http))
```

## Tasks belong to the team that created them

The gateway calls the agent with the agent's own credential, so the agent cannot tell its callers apart. The gateway keeps that apart instead: every task and context ID the agent returns in its answer to a message (`message/send`, `message/stream`, `SendMessage`, `SendStreamingMessage`) is recorded for the calling key's team, before the answer, or the stream event, reaches the client. Only the answer's own fields count (the task's `id` and `contextId`, and the `taskId` and `contextId` of a message or stream event), never IDs inside the history, parts, artifacts or metadata, which a client could have written.

With [organization admins](/docs/features/organization-admins/) on, a call that names a task or context of another team answers `404` with JSON-RPC error `-32001 Task not found`, the same answer as an unknown task, and never reaches the agent. This covers `tasks/get`, `tasks/cancel`, `tasks/resubscribe`, `GetTask`, `CancelTask`, `SubscribeToTask`, and a message whose `taskId`, `contextId` or `referenceTaskIds` names another team's. A task ID the gateway never handed to the team answers the same way. A `contextId` the client names first becomes its team's. `ListTasks` returns only the team's tasks and leaves out `totalSize`, which would count every team's; a page can therefore hold fewer tasks than asked, and an answer the gateway cannot read (a stream, or one over 16 MiB) answers `502` instead. IDs are read in the JSON names and the protobuf names (`taskId` and `task_id`, `params.message` and `params.request`); params that repeat a member or spell one of these names another way (another case, or a Unicode character that folds to it) answer `-32600 Invalid Request`, since the agent might read them differently. Single-tenant mode forwards every call as before.

A record unused for 90 days is removed; the task then answers like an unknown one. Tasks created before this release have no record and answer `404` in multi-tenant mode.

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `GET /api/v1/admin/agents` | Lists the declared agents (`Agent`: the YAML names `id`, `name`, `description`, `url`, `card_url`, `auth_header`, `secret_env`, `teams`, `disabled`, with URLs stripped of credentials and query strings) and whether the credential is set |
| `POST /api/v1/admin/agents/{agent_id}/test` | Reads the agent's card now, with its credential and without the cache, to check the connection |

## See also

- [MCP and agents](/docs/features/feature-mcp-agents/): overview.
- [MCP tools](/docs/features/mcp-execution/).
- Interactive reference at `/docs/swagger/`, tag **Agents**.
