Claude Managed Agents add-on¶
The Claude Managed Agents add-on is an A2A server in front of agents in Claude Managed Agents. It serves each
ClaudeManagedAgent resource that a team declares in its own namespace, and that the operator's allowlist lets in, as an
A2A agent of its own, at /a2a/agents/<namespace>/<name>. It can also serve one agent named in its settings at /a2a,
the single agent, which is deprecated. Agent Kourier reaches each agent through an AgentBackend with the a2a dialect.
The add-on turns each A2A turn into a turn of a session of that agent, through the Anthropic API. A ClaudeManagedAgent
names an agent made in the Claude console, or defines one, which the add-on makes, keeps and archives in the workspace
(Defined agents).
It is experimental: the single agent was tested against a self-hosted environment with a Haiku agent. On a build before
the release (22 and 23 November 2026) it was also tested on Postgres with two replicas, where a leader killed during an
approval left the standby to take over and complete the same task. The ClaudeManagedAgent resource is newer than those
tests. On a build before the release (1 December 2026), one defined agent ran against a live self-hosted environment
with Slack (Defined agents). Cloud environments are untested.
Connect Claude Managed Agents installs it. Add-ons says what an add-on is.
flowchart LR
thread[Thread] <--> binding["Binding<br/>a2a dialect"]
binding <-- "A2A, streamed" --> addon["Add-on<br/>/a2a/agents/<ns>/<name>"]
cr["ClaudeManagedAgent<br/>(team namespace)"] -- "watched; status written" --- addon
addon --- store[("tasks, message IDs,<br/>context → session<br/>(SQLite or Postgres)")]
addon <-- "send events,<br/>event stream" --> api["Claude Managed Agents<br/>sessions"]
api <--> worker["Self-hosted worker"] --> sandbox["Sandbox pod<br/>per session"]
Agent Kourier owns the chat side: the thread, its session, approvals and their timeout, and audit. The add-on translates. Claude Managed Agents owns the agent: the model loop, its tools and the sandbox they run in.
How A2A maps to sessions and turns¶
| A2A (what Agent Kourier sees) | Claude Managed Agents (what the add-on does) |
|---|---|
| A context (one thread) | One session of the agent whose path the request reached, created on the context's first message, with the context ID in its a2a_context_id metadata and the title A2A context <id>. A ClaudeManagedAgent's session also carries its owner in a2a_owner (Caller check). Sessions run the agent's latest version in its environment, with its vaults. Two agents' contexts with the same ID are two sessions. |
| A task | One turn of that session. |
| A message's text and data parts | One user.message. Data parts are sent as JSON text, and the parts are joined with newlines. A message with any other part, or with no text, is refused as invalid. |
| Artifact text | agent.message text. Content blocks that are not text are not shown. |
ADK function_call and function_response data parts, which Agent Kourier renders as tool calls |
agent.tool_use and agent.mcp_tool_use, and their results (agent.tool_result, user.tool_result, agent.mcp_tool_result). A result's text is cut to 4000 characters and marked with …. |
input-required with kagent's human-in-the-loop tool_approval_request |
A tool call whose evaluated permission is ask (the always_ask policy), once the session idles with requires_action on it. |
tool_approval_response |
One user.tool_confirmation per call. A denial passes its reason on as the deny message. |
| Cancel | user.interrupt, and the task is canceled. |
completed |
The session idles with the stop reason end_turn. |
failed |
The session terminates; idles with any other stop reason; idles on a call the turn cannot answer (below); its event stream ends before the turn does; or a sandbox tool, or a session that has not resumed after a requires_action idle that came straight after the tool's result, gets no event in time. |
Each agent has its own agent card, at its path plus /.well-known/agent-card.json: the single agent's at
/a2a/.well-known/agent-card.json, named claude-managed-agent, with the endpoint PUBLIC_URL; a ClaudeManagedAgent's
named <namespace>/<name>, with the endpoint in its status.url. A card advertises streaming over JSON-RPC and text
input and output. It lists the human-in-the-loop extension, https://kagent.dev/extensions/hitl/v1, which is how Agent
Kourier's a2a dialect knows to read the add-on's pauses as tool approvals.
A turn with an approval¶
sequenceDiagram
participant K as Agent Kourier
participant A as Add-on
participant C as Session
participant W as Worker and sandbox
K->>A: SendStreamingMessage (the thread's text)
A->>C: open the event stream, then user.message
C-->>A: agent.tool_use bash (permission: ask)
C-->>A: session.status_idle (requires_action)
A-->>K: input-required + tool_approval_request
Note over K: Approve and Deny in the thread
K->>A: SendStreamingMessage (tool_approval_response)
A->>C: user.tool_confirmation (allow)
C->>W: run bash
W-->>C: user.tool_result
C-->>A: user.tool_result, agent.message
C-->>A: session.status_idle (end_turn)
A-->>K: artifacts, then completed
The add-on opens the session's event stream before it sends anything, because the stream delivers only the events that happen after it opens.
An answer to a paused task must decide every call the pause named, once each, in a tool_approval_response. The add-on
refuses any other answer as invalid before the turn runs, a typed reply in the thread included, and the task stays
paused.
Agent Kourier sends one from the Approve and Deny buttons. If nobody decides before the Binding's
interactions.timeout, it denies the calls (Agent contract).
On a self-hosted environment, a built-in tool's result comes from the worker as user.tool_result. A call the agent may
run without asking also idles the session with requires_action until that result arrives, and in multi-agent sessions
a trailing requires_action idle can still name a sandbox call whose result just arrived on the stream. The add-on
treats all of these as waits, not as questions: a pause asks only about the calls whose permission was ask.
A pause on anything else, such as a custom tool, or a call the turn did not see ask for approval, fails the turn with "The agent is waiting on an action this adapter cannot answer."
A sandbox that never starts¶
A self-hosted sandbox that cannot be scheduled sends no event at all, and the session waits.
When a turn waits on a built-in tool that the sandbox runs (one the agent may run, or one a person approved) — or waits
for the session to resume after an ignored trailing requires_action idle whose sandbox tool results already arrived —
and no session event arrives for TOOL_RESULT_TIMEOUT, the add-on sends the session user.interrupt. It fails the task
with the status metadata code: timeout, which selects Agent Kourier's timeout notice in the thread. A tool that runs
silently for longer is cut off the same way.
MCP tools do not run in the sandbox, and a model that is thinking after the session has resumed is not waiting on a tool, so neither is timed.
The add-on also sends a working update after each 60s without a session event, so
that Agent Kourier, which cuts a stream silent for 5 minutes, keeps a slow turn's stream open.
The ClaudeManagedAgent resource¶
ClaudeManagedAgent, group cma.agentkourier.dev, version v1alpha1, is namespaced and has a status subresource. A
team creates one in its own namespace for each agent it wants served. The add-on reads them only with CMA_ALLOWLIST_FILE
set (the chart's addons.cma.managedAgents.enabled), in every namespace.
apiVersion: cma.agentkourier.dev/v1alpha1
kind: ClaudeManagedAgent
metadata:
name: pr-reviewer
namespace: team-a
spec:
agentId: agent_0123456789
environmentId: env_0123456789
vaultIds: [vlt_0123456789]
callerTokenDigests:
- sha256:<64 lower-case hex digits>
status:
url: http://agent-kourier-cma.agent-kourier.svc:8090/a2a/agents/team-a/pr-reviewer
conditions:
- {type: Accepted, status: "True", reason: Accepted, observedGeneration: 1}
- {type: Ready, status: "True", reason: Served, observedGeneration: 1}
| Field | Required | What it is |
|---|---|---|
spec.agentId |
One of agentId and agent |
The agent each new session runs, made in the workspace: agent_ and then ASCII letters and digits, at most 128 characters. |
spec.agent |
One of agentId and agent |
The agent the add-on makes in the workspace and keeps as the field says (Defined agents), in the structure of the Agents API's create request with its names in camelCase. Its fields are in The agent definition. |
spec.environmentId |
Yes | The environment each new session runs in: env_ and then letters and digits, at most 128 characters. |
spec.vaultIds |
No | The vaults each new session is created with, in order: each vlt_ and then letters and digits, at most 128 characters, none twice, at most 16 of them. A writer replaces the list whole. |
spec.callerTokenDigests |
Yes | The SHA-256 digests of the tokens that may call the agent (Caller check): each sha256: and then 64 lower-case hex digits, none twice, 1 to 4 of them. |
status.url |
Written by the add-on | The agent's A2A URL, for the url of an a2a AgentBackend: PUBLIC_URL without its trailing /a2a, then /a2a/agents/<namespace>/<name>. Written once the agent is accepted, and removed when it is not. |
status.agentId |
Written by the add-on | The agent the resource is served on: spec.agentId, or the agent the add-on made for spec.agent, once it has made one. Written once the agent is accepted, and removed when it is not. |
status.agentVersion |
Written by the add-on | For a defined agent, the agent's version as the add-on's last write, or its last listing of the workspace, gave it. Absent for an agent the spec names. |
status.conditions |
Written by the add-on | Accepted, Ready and, for a defined agent once it is accepted, Synced, each with the observedGeneration of the object it describes. |
The CRD's schema refuses a create or update that breaks one of the rules above. The add-on checks the same rules again
before it serves an object, and refuses one that breaks them with InvalidSpec. kubectl get claudemanagedagents shows
the columns Accepted, Ready, Synced and URL.
The agent definition¶
spec.agent mirrors the Agents API's create request field for field, with the names in camelCase (mcp_servers is
mcpServers, default_config is defaultConfig, permission_policy is permissionPolicy, mcp_server_name is
mcpServerName, allowed_domains is allowedDomains). Define your agent
has an example with every field.
| Field | Required | What it is |
|---|---|---|
name |
No | The agent's name in the workspace, at most 256 characters. Left out, <namespace>/<name> of the resource, cut to 256 characters. |
description |
No | At most 2048 characters. |
model.id |
Yes | The model: lower-case letters, digits, . and -, starting with a letter or digit, at most 128 characters. Only the API's object form: a bare string is refused. |
model.effort |
No | low, medium, high, xhigh or max. Left out, the model's default on a create; an update keeps the last effort set while model.id stays the same (What a write sets). |
model.speed |
No | standard or fast. Left out, standard. |
system |
No | The system prompt, at most 100000 characters. |
mcpServers |
No | At most 20 servers, each type: url (the only type, and the default), a name of 1 to 255 characters on one line that no other server has, and a url of https:// and then a host, with no user information and no white space, at most 2048 characters. Anthropic connects to them (MCP servers). |
tools |
No | At most 21 entries, told apart by type. Left out, the agent has no tools. The agent may have at most 256 tools in all, its built-in tools and every tool its MCP servers expose: a limit of the Managed Agents API that its API reference and the Anthropic Go SDK's documentation state, not yet tested here. Past it the workspace refuses the write, and Synced is False with the reason AgentRefused (Limits). |
tools[].type: agent_toolset_20260401 |
The built-in tools, at most one entry: defaultConfig (enabled, permissionPolicy) and configs, which name each of the 8 tools (bash, edit, read, write, glob, grep, web_fetch, web_search) at most once, each with enabled and permissionPolicy. The web_fetch and web_search configs may carry allowedDomains or blockedDomains, not both: 1 to 64 lower-case DNS names each, of at most 253 characters, with no repeat. |
|
tools[].type: mcp_toolset |
The tools of the server of mcpServers that mcpServerName names, with defaultConfig and at most 64 configs, each with a name of 1 to 128 characters that no other config of the set has. Each server is named by exactly one mcp_toolset. |
|
permissionPolicy |
No | {type: always_allow}, {type: always_ask} or {type: auto}. Left out, the API's default: always_allow for the built-in tools, always_ask for an MCP server's. A call whose evaluated permission is ask pauses the turn for Approve and Deny (A turn with an approval). |
A tool of any other type, custom included, is refused. The schema has no field for the API's other settings
(skills, multiagent, executionIdentity, metadata, the model's inferenceGeo, the web tools' other settings):
kubectl apply refuses them under its default strict field validation, and the API server
prunes them otherwise.
Conditions¶
| Condition | Status | Reason | When |
|---|---|---|---|
Accepted |
True |
Accepted |
The spec is valid, the allowlist lets the namespace name each ID, and the agent holds a place. |
Accepted |
False |
InvalidSpec |
The object does not decode, or breaks a rule of the spec above. The message names each field and its problem. |
Accepted |
False |
IDNotAllowed |
The allowlist does not name the namespace, or does not let it name the ID in a field, or, for a defined agent, does not let it define agents or use its model or the host of an MCP server's URL. The message names the fields (spec.agentId, spec.environmentId, spec.vaultIds[<i>], spec.agent.model.id, spec.agent.mcpServers[<i>].url) or says define agents (spec.agent), never an ID, a model or a host. A defined agent needs no entry in agentIds. |
Accepted |
False |
AgentLimitReached |
Every place under CMA_MAX_AGENTS is held (Places at the cap). |
Ready |
True |
Served |
The add-on serves the agent at status.url. |
Ready |
False |
Pending |
Accepted, and the leader has not yet restored the agent's sessions, or, for a defined agent, not yet made its agent (the message then points at Synced). A restore that fails is tried again every 10s, and the agent's path answers 404 until one succeeds. |
Ready |
False |
NotAccepted |
Not served, for the reason Accepted names. Its path answers 404. |
Synced |
True |
Synced |
A defined agent: the agent in the workspace holds the object's generation. |
Synced |
False |
Pending |
A defined agent: the leader has not yet written this generation, or its agent is gone from the workspace and it has not yet made another. |
Synced |
False |
AgentRefused |
A defined agent: the workspace refused the last write, with a 4xx other than 408, 409 and 429. The message is "The workspace refused the agent definition (HTTP _. It is tried again with the write back-off. Or the add-on could not make a request of the definition: "The add-on cannot write this agent definition.", tried again only for a new generation. |
Synced |
False |
WorkspaceError |
A defined agent: the last write failed otherwise (no answer, a 5xx, 408, 409 or 429): "The workspace call failed; the add-on tries again." |
Synced is written only for a defined agent that is accepted, and an agent the spec names never has it. A defined agent
whose agent has a version keeps being served on it while Synced is False; one with no agent yet is not served.
An object is refused for the first of InvalidSpec, IDNotAllowed and AgentLimitReached that it meets, in that order.
One object's refusal changes nothing for another.
Each message is fixed text that the add-on composes and that names fields, never a value of the spec, cut to
1024 bytes at a character boundary and marked with …. A team reads its
agent's status in its own namespace and needs no access to the add-on's logs.
Only the leader writes status, with a server-side apply of the status subresource under the field manager
agent-kourier-cma, and only a status that differs from the one the object holds, at most once every
10s per object. A write that fails is tried again with a growing wait
(Limits). An object being deleted gets no status.
Places at the cap¶
The add-on serves at most CMA_MAX_AGENTS agents, 100 by default, the single agent
included. The single agent takes the first place, and the accepted ClaudeManagedAgents the rest.
- Places are kept. An agent already served keeps its place. A free place goes to the oldest waiting agent, by
creationTimestamp, then namespace and name. A change to one agent, or to the allowlist, never takes another's place. - Across restarts and takeovers. An agent whose
Acceptedcondition, as the leader last wrote it, isTrueholds its place. A replica that restarts, or a standby that takes over, goes by that condition, even one the last leader wrote before a later change, and by its own reading only for an agent with no condition written. - The window before a status is written. A change of places that the leader has not yet written to the status (writes come at most once every 10 seconds per object) is decided again by the replica that takes over, from its own reading of the cluster and the allowlist.
- A lowered cap. The setting is read at start, so a lower value takes effect when the add-on restarts with it. When
more agents hold places than it gives, the oldest of them keep theirs. The rest get
AgentLimitReached, and the restore archives their sessions and forgets their contexts, as of any agent not served (Restarts). - Past the cap. An agent left out has
AgentLimitReachedand its path answers 404, even when it is older than one served. It is served once a place is free and no older agent waits.
Changes while it is served¶
Every change below takes effect without a restart, and none of them cuts a running turn of another agent.
- Caller digests. The next request is checked against the new list: a removed digest is refused from then on. A turn already running goes on.
- Vaults. Sessions created from then on carry the new list. Existing sessions keep theirs.
- Agent or environment (a retirement). The agent's sessions on the old agent or environment are archived: each one no turn holds at once, and each other one when its last running turn ends. The context's next turn runs in a new session on the new agent, under the same A2A context ID, so the thread carries on with no notice and without the old history. A session that fails to archive is logged, and the next restore archives it as superseded.
- Deleted, or no longer accepted (a removal). The path answers 404 from then on. Each running turn of the agent is
interrupted in its session and fails with "The agent was removed from the adapter, so the adapter ended this turn."
Each of its sessions is archived, a session a turn still holds once that turn ends, and its contexts are forgotten
with their tasks. A session that fails to archive is logged, and the removal does not try it again: it keeps its
context in the store, for the upkeep once it has been idle for
SESSION_IDLE_TTL, or for the next restart or takeover (When the first reading is slow says when that one leaves it too). An agent loses acceptance when an allowlist change drops its namespace or one of its IDs, or when its spec turns invalid. - A defined agent's definition. The leader writes it to the same agent, which ends no session: each session keeps the version it was created on, and new sessions get the new one (Defined agents).
- From
agentIdtoagent, or back. The agent the resource is served on changes, so this is a retirement, as a new agent ID is. A defined agent left behind is archived by the sweep. - Deleted and made again under its name. The new object has another uid, so it is a new agent: it takes no session, context or task of the old one, whether a leader runs throughout, a takeover comes between, or no replica leads meanwhile. It also has no status yet, so at the cap it waits for a free place like any other.
- Accepted again with the same uid. An object that loses acceptance and regains it during one leader's lead is the
same agent. Before it is served again the leader archives every session that Claude Managed Agents still lists for
it, and forgets its stored contexts with their tasks, so it resumes none of them. It stays
Ready=Falsewith the reasonPending, and its path answers 404, until that has succeeded. If a takeover comes between, a session that its removal failed to archive may be kept. A takeover while the object is still not accepted, whose first reading is in time, tries that archive again with the other agents not served, and keeps the session only if it fails again. A takeover once it is accepted again restores it as any served agent, and keeps the session.
An answer to a paused task after a change¶
A retirement or a removal forgets the agent's tasks paused on an approval, since the sessions they paused in are archived.
- After a retirement the path is still served, so an answer reaches the add-on and finds no task: A2A answers that the task was not found.
- After a removal the path answers 404 while the agent is not served. Once it is served again, under the same uid or as a new object under its name, an answer finds no task.
- An answer whose turn already runs in its session when the change comes keeps its task. On a retirement it ends in the old session; on a removal it fails as every running turn does.
- An answer that reached the add-on before a retirement, but has no session yet, either fails its task with "The agent's session for this task has ended, so the adapter could not take the answer.", or finds the task forgotten, as after a retirement. Before a removal, it gets an error and runs no turn.
- A turn that pauses in a session being let go of has its task forgotten once the pause is stored, so an answer to it finds no task.
Defined agents¶
The leader makes, keeps and archives the agents that ClaudeManagedAgents define in spec.agent, with the add-on's one
API key. A standby calls no workspace: it routes a defined agent's path as any other, and forwards its requests to the
leader. Limits has the waits below in one row.
Making the agent, and its tags¶
A defined resource is written to the workspace only once it is accepted: valid, allowed, and within the cap. A resource
refused, or held out by AgentLimitReached, gets no agent until it is accepted.
The leader creates the agent with two metadata keys: kourier_owner, the resource's <namespace>/<name>/<uid>, and
kourier_install, the UID of the ClaudeManagedAgent CRD, which the add-on reads at start, and again when its leader
could not read it then. Only an agent that carries this install's tag and an owner is read as the add-on's own. Until the
install is known nothing is written and nothing archived. The add-on sets 2 of the 16 metadata keys that the
API reference and the Anthropic Go SDK's documentation allow an agent, and
leaves the others alone: the Claude Managed Agents documentation says the API
merges metadata key by key. In a run against a live workspace the listing had both tags on an agent the add-on made;
the merge and the limit of 16 keys have not been tested here.
Until the create succeeds the resource is not served: Ready=False with the reason Pending, Synced=False, and its
path answers 404. Once it succeeds the leader serves the resource on the new agent's ID and writes status.agentId and
status.agentVersion.
Keeping it in sync¶
- On a change. A new generation of the resource is written to its agent at once, as an update that names no version, so it applies whatever version the agent is at (update semantics).
- On a timer. Every agent is written again every
5mafter its last write, whether or not the resource changed, so an edit made in the Claude console lasts at most that long. The Claude Managed Agents documentation says an update that changes nothing makes no new version, which a run against a live workspace confirmed. - After a failure. A failed write is tried again after
10s, then twice as long each time, up to5m. A write the workspace refused is tried again the same way. A new generation is written at once, whatever the wait. Each call to the workspace is cut at10s. The first failure of a run is logged at WARN. - A refused update keeps the resource served on the version its agent has, with
Synced=False. A refused create leaves it not served. - Versions and sessions. Each session is created with the agent's ID, which gives it the agent's latest version at that moment, and the session keeps that version; a run against a live workspace confirmed both. A definition change retires no session: a thread with a session goes on with the version it started on, and a new one gets the latest.
What a write sets¶
Every create and update sends the whole definition, so the resource wins over an edit made elsewhere. The Claude Managed Agents documentation says a null or empty value clears a field; this has not been tested here.
name,model.idand the metadata tags, always;descriptionandsystem, and on an updatenullfor one left out, which clears it;toolsandmcpServers, as an empty list when left out, which clears them;model.speed,standardwhen left out;- no skills, and the default execution identity (the service account), on every write; and, on an update, a null multiagent.
model.effort is the exception: the Claude Managed Agents documentation
says that an update without it keeps the agent's last effort while model.id stays the same, which a run against a
live workspace confirmed, and resets it to the new model's default when model.id changes, which has not been tested
here. Set another level instead of removing it.
Archiving: sweeps¶
The leader archives an agent of its install when two of its sweeps, at least 60s
apart, both find that:
- no object in the informer's cache with the agent's owner tag defines an agent: the object is deleted, or made again
under its name (another uid), or names its agent with
agentIdnow; or - its owner is served on another agent: a duplicate from a create whose answer was lost and that was made again.
A sweep runs at a takeover, in the pass after an object that defined an agent is gone or no longer defines one, every
5m, and once 60s have passed since an agent
first became a candidate. A deleted resource's agent is therefore archived about a minute after the delete.
The guards:
- A sweep runs only with the informer's cache synced and a successful listing of the workspace, and only with the install known. It goes by the install's tag alone.
- An object refused by the allowlist or held out by the cap still defines its agent, so neither ever archives it: allowed again, the resource is served on the same agent.
- An agent that carries no owner tag is never touched. One that carries an owner tag and another install's tag, or no
install tag, is never touched either, and is counted in
agentkourier_cma_foreign_agents{state="orphaned"}: an agent of an add-on in another cluster on the same workspace, or of this one before its CRD was made again. Re-creating the CRD deletes everyClaudeManagedAgentwith it, and leaves their agents, under the old UID, counted there. - An archive is final: the Claude Managed Agents documentation says it cannot be undone, that new sessions cannot reference the agent while its existing sessions go on running, and that the API rejects updates to it. The add-on archives a deleted resource's sessions itself, at the removal. An archive that fails is tried at the next sweep. A leader whose lead has ended sends none.
The sessions of an agent swept are already archived: the resource's removal archived them, or a takeover's restore did, for an owner not served.
A new leader¶
At its takeover the leader lists the workspace's unarchived agents once, and indexes those of its install by owner. An owner with several takes the newest by creation, and the others are candidates for the sweep. A resource whose owner has an indexed agent is served on it, and written to it, with no new create.
Until a listing succeeds the leader writes no agent and serves no defined agent; it tries the listing again with the
write back-off. If the first listing fails, the takeover keeps the defined agents' sessions, and restores them once a
listing succeeds and they are served. Such a restore leaves undone what a restore before the informer's first sync leaves
undone (When the first reading is slow): a cut-off turn of an agent restored later is
failed, but its session is not interrupted, and the stored contexts of a resource deleted while no replica led wait for
SESSION_IDLE_TTL.
An agent archived or deleted elsewhere¶
- Archived elsewhere. When two listings at least
60sapart do not list the agent a resource is served on, the leader drops it, logs a WARN, and makes a new agent. The resource is served on the new one, which retires its sessions on the old one. Between the two listings the workspace refuses an update of the archived agent with 400, andSyncedreadsAgentRefused. In a run against a live workspace, with no update due in between, the new agent was made about 2 minutes after the archive. - Gone. An update the workspace answers with 404 drops the agent at once, and the next pass makes a new one, in the same way.
Pacing¶
The leader's loop writes the creates due before it applies the served set, and at most one update after it, then the
sweep. Creates are not paced; updates go one per pass, and a pass that wrote one starts the next at once. So a removal (a
resource deleted or refused, a caller digest dropped) waits for the pass in flight: its creates, at most one update, and
its sweep, each call cut at 10s.
The allowlist¶
The operator's allowlist says which Claude Managed Agents IDs each namespace's ClaudeManagedAgents may name. The add-on
reads it from the file CMA_ALLOWLIST_FILE names, a JSON object of namespaces:
{"team-a": {"agentIds": ["agent_0123456789"], "environmentIds": ["env_0123456789"], "vaultIds": ["vlt_0123456789"],
"agentDefinitions": {"models": ["claude-sonnet-5-5"], "mcpServerHosts": ["mcp.github.example.com"]}}}
- A
ClaudeManagedAgentis accepted only when its namespace is a key and itsagentId, itsenvironmentIdand every one of itsvaultIdsare in that namespace's lists. Any namespace may create one; one the allowlist does not name getsIDNotAllowed. There are no wildcards. - A key is a namespace name. Each list is optional, names an ID once, and holds IDs of the shape and length a
ClaudeManagedAgentmay name. The one other key allowed isagentDefinitions. -
agentDefinitionslets the namespace'sClaudeManagedAgents define their agent (spec.agent); without it they may only name one. It has two keys, and no other:models, required: the model IDs a defined agent may run on,1to64, each named once. A defined agent'smodel.idmust be one of them, exactly.mcpServerHosts, optional: the hosts its MCP server URLs may name, at most64, each a lower-case DNS name named once, with no scheme, port, path or wildcard. Only a URL's host is matched, exactly, ignoring ASCII letter case: its port is ignored, and a subdomain of a listed host does not match. Without it, a defined agent may name no MCP server.
A defined agent needs no entry in
agentIds; itsenvironmentIdandvaultIdsare checked against the namespace's lists as any other's. TakingagentDefinitions, a model or a host away stops serving the agents that need it, as any refusal does, and keeps their agents in the workspace (Archiving: sweeps). - The add-on reads the file again every5s. A mounted ConfigMap changes in place, so an edit needs no restart, but the kubelet updates the file only after a sync delay of its own, and the add-on's next read picks the change up after that. On the repository's kind tier the two took about a minute (67 to 83 seconds from thehelm upgradeto the agent'sAcceptedcondition). A change that drops an agent removes it, as a deletion does. - A file it cannot read, or that breaks a rule, stops the add-on at start (exit code 2, with an error that namesCMA_ALLOWLIST_FILE). On a reload the last good allowlist stays, and the failure is logged at WARN once until it changes. An error never shows what the file holds: it names a namespace or an entry of one of its lists by its position, and a syntax error by its byte offset.
Limits has the most namespaces, IDs and bytes.
Vaults¶
An MCP server that needs a credential, such as a token in a static_bearer, gets it from a vault. The Claude Managed
Agents documentation says that whoever holds the workspace makes a vault, in the Claude console or with the Vaults API,
and that a session matches a vault's credential to an MCP server by the server's URL. The Managed Agents API
takes a session's vaults only when it creates the session. The add-on creates each session of a ClaudeManagedAgent with
the vaults of its spec.vaultIds, and each session of the single agent with those of CMA_VAULT_IDS, in order, and with
none when the list is empty, which leaves its sessions no credential for such a server.
The add-on checks each ID's shape only: vlt_ and then letters and digits, none twice, and at most
16 of them. Whether each vault exists is the API's to say when it creates a session. A
message whose session the API does not create, for a vault it does not know or any other reason, fails with the API's
error, and the context's next message tries again.
A session keeps the vaults it was created with. A change to a ClaudeManagedAgent's spec.vaultIds reaches the sessions
it creates from then on. A change to CMA_VAULT_IDS needs a restart, and then reaches only the sessions created after
it: every session the add-on restores, from its store or adopted, keeps the vaults it had. To move a thread
to the new vaults, archive its session in Claude Managed Agents and restart the add-on: when no other session of the
agent carries the context, the restart forgets it, and its next message starts a new session, without the old history.
The Claude Managed Agents documentation says that a vault's credentials are re-resolved periodically, in running sessions too, so a credential rotated in its vault reaches sessions that already carry the vault. The add-on plays no part in that, and it has not been tested here.
MCP servers¶
A defined agent's mcpServers name servers by URL. The Claude Managed Agents documentation says that Anthropic connects
to an agent's MCP servers, not the environment's worker, on a self-hosted environment too, so a server must be reachable
from Anthropic: at a public URL, or through an MCP tunnel, which the same documentation calls a research preview. A
server at a .svc name or another address private to the cluster is not reached, even though the agent's sandbox runs
beside it. The same documentation says that a session whose MCP server cannot be reached still starts, and the agent
finds that server's tools missing. None of this has been tested with the add-on.
The add-on checks only that each URL is https:// and then a host the namespace's
mcpServerHosts lists. It does not refuse a private host name, which a tunnelled server may use. A
server's credential comes from a vault of spec.vaultIds; the resource holds no credential.
Restarts¶
The store keeps the A2A tasks, the message ID that started or joined each task, and each context's session, each under
its agent's owner (Caller check), so a restart loses none of them. Its migrations are applied at start.
A store that a release before the ClaudeManagedAgent wrote opens as it is, and its rows are the single agent's.
A store that an earlier version of the add-on wrote, which kept each context's session in a table of its own, is refused. The add-on logs that the store holds an earlier layout and exits with code 1, before it writes to the store.
Start the add-on on a new store: a new SQLite file, or an empty Postgres database or schema. The chart reuses the claim
<fullname>-cma-data while it exists, so for SQLite set addons.cma.persistence.existingClaim to a new claim of your
own, or delete that claim so that the chart makes a new one.
At start, before it serves, the add-on:
- Waits for its first reading of every
ClaudeManagedAgent, withCMA_ALLOWLIST_FILEset, and decides which it serves. - Lists the workspace's unarchived, unterminated sessions that carry a context ID, once, and groups them by the owner in
their
a2a_ownermetadata. A session without one is the single agent's when it runs that agent in its environment, and otherwise none of this add-on's. Each agent served is checked against its own sessions only. It does not start if the store or the listing cannot be read.- A stored session that is still listed is kept, and the context's other listed sessions are archived.
- A context the store lacks adopts the session listed for it (the one active last, when there are several; the others are archived).
- A stored session that is no longer listed (archived, terminated, or on another agent or environment) is replaced: when another session is listed for its context, the context adopts that one (the one active last, when there are several; the others are archived) and keeps its tasks. When none is, the context is forgotten with its tasks, and its next message starts a new session.
- A session of an agent served, on another agent or environment than the one it is served on, is archived as superseded.
- The stored contexts of an owner not served, such as a
ClaudeManagedAgentdeleted while no replica led, are archived and forgotten, with that owner's other listed sessions. - Listed sessions of an owner that the store holds no context of are left alone: they may be another install's.
-
Fails each task left
submittedorworkingwith the agent message "Interrupted by an adapter restart." and sends its sessionuser.interrupt(a failed interrupt is logged). Each task is failed in a write of its own.A task whose stored record does not decode is failed by its state alone, so that
TASK_RETENTIONdeletes it, and is logged at WARN. A task that changed since it was read is logged at WARN and left as it is.The add-on does not start if the store cannot be read or written.
| Survives a restart | Is interrupted |
|---|---|
A task paused on an approval (input-required): an Approve or Deny pressed after the restart reaches the paused calls |
A turn that was running: its task fails, its session is interrupted, and Agent Kourier shows its fixed failure notice in the thread |
| Each context's session: the thread's next turn continues it | |
| The record of message IDs: a resend joins its first send's task |
When the first reading is slow¶
The wait in step 1 lasts at most 30s. Past it the add-on logs a WARN, restores the
single agent alone, if there is one, and serves. Each ClaudeManagedAgent is then restored once the add-on has read it,
and only then served: until then its path answers 404. Such a takeover leaves three things undone:
- Cut-off turns of a later agent. Its tasks are failed, but its sessions are not interrupted, and run on until they idle.
- Agents deleted while no replica led. Their stored contexts wait for the upkeep, which archives and forgets each
once it has been idle for
SESSION_IDLE_TTL. - Sessions the store never held. A session that Claude Managed Agents lists for an owner not served, and that the store holds no context of, is not archived. A crash between creating a session and storing it leaves one, and so does a failed archive. This holds after a synced reading too.
An API server that does not answer at start does not stop the add-on: it logs a WARN, and reads the
ClaudeManagedAgents once the API server answers.
Resends¶
Agent Kourier sends a message again, with the same ID, when it cannot tell whether the first send arrived. A message whose ID the store has recorded for the same agent joins that message's task instead of starting a second turn. It gets the task as it stands if the task has settled or paused, and the rest of its stream otherwise.
A resend that arrives before the first send's turn has answered anything waits for it, even when the first sender has hung up, so the message reaches the session once. A resend that names another context or another task than its first send's is refused as invalid.
Sessions and their lifetime¶
A session holds its sandbox until it is archived. SESSION_IDLE_TTL archives a context's session once the context has
been inactive for that long with no turn running, checked every 1m. It also
deletes the context's tasks from before the archive with their message IDs. It applies to every agent alike.
The store keeps when each context was last active, so the clock survives a restart and a takeover. A context is active when a message for it was accepted, or a turn of it started or ended. A message refused as invalid, or a resend of one already accepted, does not count.
Archiving cannot be undone: the context's next message starts a new session without the old history. A session that fails to archive is logged at WARN and tried again at the next check.
Each check first reads every context's last activity, then archives the idle contexts one at a time. It leaves a session for a later check if, when it comes to that context:
- a message for the context has been accepted since the read,
- a turn is running in the session or creating it, or
- a turn of it started or ended after the read.
A message for the context that arrives while its session is being archived waits for the archive to end. Once the session is archived, and the tasks from before deleted, the message starts a new session. If the archive failed, the message continues the session.
Set SESSION_IDLE_TTL to the Binding's session.threadTTL, whose default,
2160h, is the add-on's default too. Past that, Agent Kourier gives the thread a
new context and never uses the old session again. A shorter value archives sessions a thread can still continue.
SESSION_IDLE_TTL does not free an idle sandbox's memory. The environment's own idle timeout does.
TASK_RETENTION deletes a settled task (completed, failed, canceled or rejected), with its message IDs, once its last
update is older than that, checked every 1m.
Replicas¶
SQLite (the default) is one replica. The add-on holds an exclusive lock on the file SQLITE_PATH plus .lock while
it runs, so a second add-on on the same file stops at start ("another adapter has the SQLite file open"). The lock is the
kernel's, so it goes with a process that dies.
The chart refuses addons.cma.replicaCount above 1 with SQLite, puts the
file on a ReadWriteOnce volume, and replaces the pod with the Recreate strategy, so the old pod has released the volume
before the new one starts. The add-on refuses LEASE_DURATION, LEASE_RENEW_DEADLINE and LEASE_RETRY_PERIOD with
SQLite.
The file is in WAL mode, with FULL synchronous commits and a busy timeout of
5s. The add-on's writes go through one connection, and its reads through a
pool of four beside it. Copy the file with its -wal file, which holds commits not yet written into it.
Postgres runs several replicas. Replicas that start together apply each migration once, under an advisory lock. The
chart gives them a rolling update that starts a new pod before it takes an old one away, and at 2 replicas and more a
PodDisruptionBudget with maxUnavailable: 1.
The replicas elect a leader through a lease row in the add-on's database, not a Kubernetes Lease, so the election needs
no RBAC. The leader serves A2A and writes the ClaudeManagedAgents' status, and every write it makes to its store checks
the lease's epoch in the same transaction, so a leader that has lost the lease cannot write.
Every replica reads the ClaudeManagedAgents and keeps its routes, so a standby that takes over serves at once. A
standby forwards each A2A request and agent card, of every agent, to the leader's ADVERTISE_URL, streaming the answer
through unbuffered. The caller check runs on the leader.
The add-on answers 503 with Retry-After (the election's retry period, at least 1 second):
- On a leader that has not finished taking over.
- On a standby that knows of no leader or cannot reach it.
- On a replica that is not serving when the request was already forwarded once: a request is forwarded once at most.
A leader that cannot renew the lease for LEASE_RENEW_DEADLINE, or whose renewal or write finds that another replica
has taken it, exits at once with code 5, without a drain, and Kubernetes restarts it. A leader that stops on SIGTERM:
- Drains its requests for at most
5s. - Cancels the turns still running and waits at most
5sfor them, leaving their tasks for the next leader to fail. - Hands the lease over, for at most
3s. Past that, a standby takes over once the lease has run out.
A replica that takes over runs the same start-up work as a restart, so a turn that was running on the old leader fails, and a paused approval survives.
Caller check¶
Each agent has a check of its own, and tasks are kept apart by caller: the caller a request passes as owns the tasks,
contexts and message IDs it creates, and every read and write made for a request is limited to its caller's. A
ClaudeManagedAgent is the caller claudemanagedagent:<namespace>/<name>/<uid>, and the single agent is the caller
agent-kourier. So tasks/get, tasks/list, a resubscribe, a cancel and a message with a known context ID see only
the calling agent's tasks and contexts, whatever IDs the request names, and a context ID another agent knows starts a
new session.
- A
ClaudeManagedAgent's callers are the tokens whose SHA-256 digests itsspec.callerTokenDigestslists. A request to its path, or to its card, must carry one. The add-on hashes the token it is given and compares the digest with each of the agent's in constant time. A token of another agent, or one inAUTH_TOKEN_FILE, is refused at its path. A change of the digests applies to the next request. - The single agent's callers are the tokens in
AUTH_TOKEN_FILE, at/a2aand its card. Every token in the file is the same caller, so any accepted token reaches every task of the single agent: the tokens exist to be rotated, not to tell callers apart. The add-on keeps only each token's SHA-256. - A refusal is 401 (with
WWW-Authenticate: Bearerwhen the header isAuthorization), logged asrefused an A2A requestwith the reasonmissingorinvalid, never the value it was given. - The header. With
AUTH_HEADERunset, the token comes asAuthorization: Bearer <token>(the scheme in any case), which is what a Binding'sidentity.tokenSecretRefsends. With another header name, the header's whole value is the token, which an AgentBackendheadersentry with avalueSecretRefsends. The one header serves every agent. The add-on does not start, and the chart's values schema refusesaddons.cma.auth.header, when the name is one of the other headers Agent Kourier reserves for the Binding's identity, in any case:Proxy-Authorization,Cookie,X-User-Id,X-Agent-Name,X-Share-TokenorX-Kagent-Insecure-Runtime-Identity. An AgentBackend may not set them, so none of them would ever carry the token. - The token file. One token per line. Lines that are blank or start with
#are skipped, and trailing whitespace (a CR included) is stripped. The add-on does not start with a file it cannot read or that holds no token. It reads the file again every5s, because a mounted Secret changes by swapping a symlink. A read that fails or finds no token keeps the last good tokens, and is logged once until the failure changes. - Agent Kourier sends the token when it fetches the card, as with every request to the endpoint.
/healthz,/readyzand/metricsneed no token.
Weak tokens. A digest is not a secret: anyone who can read the ClaudeManagedAgent can read it, and a short or
guessable token can be found from it offline. The add-on cannot tell a weak token from its digest. Make each token random
and long, at least 32 random bytes (openssl rand -hex 32).
With managed agents alone¶
With CMA_AGENT_ID and CMA_ENVIRONMENT_ID both unset, the add-on serves only ClaudeManagedAgents:
AUTH_TOKEN_FILEis not needed. When it is set, the add-on exits with code 1: withAUTH_TOKEN_FILE is set without CMA_AGENT_ID and CMA_ENVIRONMENT_IDonce it has opened its store, since its tokens would open nothing, or earlier, before it opens its store, when the file cannot be read or holds no token./a2aand/a2a/.well-known/agent-card.jsonanswer 404, on the leader and on a standby.AUTH_DISABLED=trueopens nothing. It is still refused unlessLISTEN_ADDRis a loopback address, and when it is accepted the add-on logs a WARN that it opens nothing. Each agent's path checks its digests whatever it is.
Turning the check off¶
AUTH_DISABLED=true turns off the single agent's check, and is refused unless LISTEN_ADDR is a loopback address
(127.0.0.0/8, ::1 or localhost) and AUTH_TOKEN_FILE is unset. It never turns off a ClaudeManagedAgent's. The
chart has the add-on listen on every interface of its pod and never sets it.
Kubernetes API and RBAC¶
With CMA_ALLOWLIST_FILE set, every replica calls the Kubernetes API with its ServiceAccount's token. It needs, and the
chart's ClusterRole <fullname>-cma-<namespace> grants:
listandwatchonclaudemanagedagentsin every namespace, for the informer every replica runs;patchonclaudemanagedagents/status, for the leader's status writes;geton the CRDclaudemanagedagents.cma.agentkourier.dev, by name, so that it can tell at start that the CRD is missing, and read its UID, the install's tag on the agents it defines.
It reads no Secret, in any namespace: a ClaudeManagedAgent holds digests, not tokens. With rbac.create: false, grant
the same rules yourself.
At start the add-on gets the CRD, lists one ClaudeManagedAgent and opens a watch, each within
10s. A CRD that is not installed, or a call the API server denies, stops it with
exit code 1 and an error that names the cause. Any other failure is logged at WARN, and the add-on starts.
Turn managed agents on in one add-on per cluster. Two add-ons that read ClaudeManagedAgents would both serve every
one, under the same owners, and both write its status.
Without CMA_ALLOWLIST_FILE the add-on never calls the Kubernetes API, and the chart mounts no token in its pod.
One workspace, many teams¶
The add-on has one ANTHROPIC_API_KEY, so every agent it serves creates its sessions in that key's workspace, and the
teams behind them share that workspace's billing and rate limits. The add-on bounds each agent's running turns
(CMA_MAX_RUNNING_TURNS_PER_AGENT), not its use of the API. With the same key the leader creates, updates and archives
the agents the resources define, and touches no other agent.
Two add-ons on one workspace, in two clusters, do not share a ClaudeManagedAgent's sessions, even under the same
namespace and name: each object's uid is part of its owner, and a restore leaves alone the sessions of an owner its store
does not hold. Nor do they share a defined agent: each install's agents carry the UID of its own CRD, and an add-on
reads, writes and archives only agents with its own. Two installs that serve the same single agent (the same
CMA_AGENT_ID and CMA_ENVIRONMENT_ID) on one workspace do share its sessions: a session without an owner on that agent is the single agent's in both, and a context
the store lacks adopts it.
Endpoints¶
All on one port, 8090 in the chart, named http on the Service:
| Path | What it serves |
|---|---|
/a2a/agents/<namespace>/<name> |
A ClaudeManagedAgent's A2A JSON-RPC, behind its digests; 404 while the agent is not served |
/a2a/agents/<namespace>/<name>/.well-known/agent-card.json |
Its agent card, behind its digests |
/a2a |
The single agent's A2A JSON-RPC, behind AUTH_TOKEN_FILE; 404 without a single agent |
/a2a/.well-known/agent-card.json |
The single agent's card, behind AUTH_TOKEN_FILE; 404 without a single agent |
/healthz |
200 once the add-on listens: the process is alive. The chart's liveness probe asks it. |
/readyz |
200 once the add-on serves, which on a leader is only after its start-up work, until it starts to stop. 503 before then. Once it stops, a request that was already read gets 503 while a new one is refused (the listener has closed). The chart's startup and readiness probes ask it. |
/metrics |
Prometheus metrics |
Any other path under /a2a/agents/ answers 404. On Postgres, /readyz answers 200 on a standby too, since a standby
forwards to the leader, so every replica is behind the Service.
Command line¶
The binary takes one flag, --version, which prints its version, and no argument. An argument, an unknown flag or a
setting it cannot use stops it with exit code 2. It exits with 1 for a failure once it runs, logged as
adapter stopped, with 5 when a leader on Postgres loses the lease, and with 0 once a stop has finished.
Some refusals of the settings come only once the add-on has opened its store, and exit with 1, logged as
adapter stopped with the error: AUTH_TOKEN_FILE set with no single agent; and, with CMA_ALLOWLIST_FILE set, a
PUBLIC_URL that does not end in /a2a, a Kubernetes client that cannot be made (outside a pod), a CRD that is not
installed, or an API server that denies the add-on.
Settings¶
The add-on reads its settings from its environment, and an empty value is an unset one. A setting it cannot use stops it
at start with an error that names the variable, with exit code 2, or with 1 for the refusals that
Command line names. The error never shows the value of POSTGRES_DSN or AUTH_HEADER, nor what the
allowlist file holds.
Every duration is a Go duration, such as 90s or 720h, of zero or more unless the row says otherwise.
The add-on's own¶
The add-on serves the single agent, ClaudeManagedAgents, or both. With neither CMA_AGENT_ID nor
CMA_ALLOWLIST_FILE it does not start, and its error names both ways.
| Variable | Default | What it does | Chart value |
|---|---|---|---|
CMA_ALLOWLIST_FILE |
None | The allowlist file. Set, the add-on serves the ClaudeManagedAgents it allows, and needs the Kubernetes API (RBAC) and a PUBLIC_URL that ends in /a2a. |
Set to the file of the ConfigMap <fullname>-cma-allowlist, from addons.cma.managedAgents.allowlist, with addons.cma.managedAgents.enabled |
CMA_MAX_AGENTS |
100 |
The most agents served, the single agent included (Places at the cap). A whole number from 1 to 500. |
addons.cma.managedAgents.maxAgents, with managedAgents.enabled |
CMA_MAX_RUNNING_TURNS_PER_AGENT |
8 |
The most turns each agent runs at once, the single agent included. A message that would start one more is answered busy (-32004). Each agent counts apart, so one agent at its bound holds back no other. A whole number from 1 to 100. |
addons.cma.managedAgents.maxRunningTurnsPerAgent, with managedAgents.enabled; otherwise addons.cma.extraEnv |
ANTHROPIC_API_KEY |
None | The API key, read by the Anthropic Go SDK, for every agent. The SDK reads its other ANTHROPIC_* variables too, such as ANTHROPIC_BASE_URL. |
addons.cma.anthropicApiKeySecret; the others through addons.cma.extraEnv |
TOOL_RESULT_TIMEOUT |
10m |
How long a turn waits, with no session event, on a tool the sandbox runs, or for the session to resume after a requires_action idle that came straight after its result (A sandbox that never starts). 0 waits for ever. Every agent alike. |
addons.cma.toolResultTimeout |
CMA_AGENT_ID |
None | Deprecated. The single agent, served at /a2a. Sessions use its latest version. Set with CMA_ENVIRONMENT_ID, or neither. |
addons.cma.agentId |
CMA_ENVIRONMENT_ID |
None | Deprecated. The environment the single agent's sessions run in. | addons.cma.environmentId |
CMA_VAULT_IDS |
None | Deprecated, with the single agent. The vaults each new session of the single agent is created with, separated by commas, in order: the Claude Managed Agents documentation says the first vault with a credential for an MCP server wins (not tested here). Space around an ID is dropped. Each ID is vlt_ and then letters and digits, none twice, at most 16. Refused without the single agent. |
addons.cma.vaultIds, a list |
While the single agent is served, the add-on logs at WARN at start that it is deprecated
(the single agent of CMA_AGENT_ID and CMA_ENVIRONMENT_ID is deprecated), and helm install and helm upgrade print a
note. It will be removed no earlier than two minor releases after the release that deprecated it. AUTH_TOKEN_FILE is its
caller check alone, and is required with it, unless AUTH_DISABLED=true.
Every add-on's¶
The variables every add-on reads. In the chart values, <name> is cma.
| Variable | Default | What it does | Chart value |
|---|---|---|---|
LISTEN_ADDR |
127.0.0.1:8090 |
Where the add-on listens, as host:port. |
Always :8090 |
PUBLIC_URL |
http:// + LISTEN_ADDR + /a2a |
The endpoint the agent card names: the URL Agent Kourier reaches. An http or https URL with a host. |
Always http://<fullname>-<name>.<namespace>.svc:8090/a2a |
AUTH_TOKEN_FILE |
None | The file of accepted tokens. The add-on does not start unless exactly one caller check is set: this file, AUTH_DISABLED, or a check of the add-on's own that its Caller check names. An add-on whose Caller check allows it may start with none: it then serves nothing at /a2a or its card, which answer 404. |
/etc/agent-kourier-<name>/auth/tokens, the key of addons.<name>.auth.tokenSecret, whenever the chart takes that Secret: always for ax, and for cma only with its single agent |
AUTH_HEADER |
Authorization |
The header that carries the token. Must be a header name, and not one of the reserved names in Caller check. | addons.<name>.auth.header |
AUTH_DISABLED |
false |
true turns the caller check off, on a loopback LISTEN_ADDR only. In an add-on that started with no caller check it turns nothing off, and an agent endpoint of an add-on's own, such as a ClaudeManagedAgent's, always checks its callers. |
Never set |
STORE |
sqlite |
sqlite or postgres. |
addons.<name>.store.type |
SQLITE_PATH |
<name>-addon.db |
The SQLite file, with STORE=sqlite. |
Always /data/<name>.db, on the claim <fullname>-<name>-data or addons.<name>.persistence.existingClaim |
POSTGRES_DSN |
Required with postgres |
The connection string, as pgx reads it. Refused with STORE=sqlite. |
addons.<name>.store.postgres.dsnSecret |
TASK_RETENTION |
720h |
How long a settled task and its message IDs are kept after its last update. 0 keeps them. |
addons.<name>.taskRetention |
SESSION_IDLE_TTL |
2160h |
How long a context may go without activity, with no turn running, before the add-on releases it (Sessions and their lifetime says what that deletes). 0 never releases one. |
addons.<name>.sessionIdleTTL |
LEASE_DURATION |
15s |
Refused with STORE=sqlite. More than zero, and longer than the renew deadline. How long a lease lasts without renewal. |
addons.<name>.leaderElection.leaseDuration |
LEASE_RENEW_DEADLINE |
10s |
Refused with STORE=sqlite. More than zero, and longer than 1.2 times the retry period. How long the leader keeps trying to renew. |
addons.<name>.leaderElection.renewDeadline |
LEASE_RETRY_PERIOD |
2s |
Refused with STORE=sqlite. More than zero. How often a replica tries to take or renew the lease. |
addons.<name>.leaderElection.retryPeriod |
ADVERTISE_URL |
Required with postgres |
An http or https URL with a host, where the other replicas reach this one. An IPv6 address without brackets is bracketed. |
Always http://$(POD_IP):8090, from the downward API |
POD_NAME |
The hostname | This replica's name as a lease holder. | The pod's name, with Postgres |
LOG_LEVEL |
info |
debug, info, warn or error. Logs are JSON on standard error. |
addons.<name>.logLevel |
The OpenTelemetry variables are the ones Agent Kourier reads (OTEL_SERVICE_NAME, OTEL_TRACES_EXPORTER,
OTEL_EXPORTER_OTLP_ENDPOINT and the rest; see Logs and traces), with the service name
agent-kourier-cma by default. The chart passes them through addons.cma.extraEnv.
Telemetry¶
The add-on logs JSON lines on standard error at LOG_LEVEL, with durations written as text (10m0s) and an error's
text cut to 300 bytes (Limits). It never logs a token
it was sent, a message's text or a tool's input.
Metrics are on /metrics, with the prefix agentkourier_cma_. With serviceMonitor.enabled the chart adds a
ServiceMonitor of the add-on's own. The families without an agent label count every agent together.
| Metric | Type | What it counts |
|---|---|---|
agentkourier_cma_turns_total{outcome} |
Counter | Turns, by how they ended: completed, input_required (paused on a tool approval), failed, canceled, timeout (no session event for TOOL_RESULT_TIMEOUT while the turn waited on a tool the sandbox runs, or on the session to resume after a requires_action idle that came straight after its result), or interrupted (failed by the leader after a restart or a takeover) |
agentkourier_cma_operation_duration_seconds{operation,outcome} |
Histogram | Calls to the Managed Agents API, create_session, stream (timed while it opens), send, list_sessions or archive, and, for the defined agents, create_agent, update_agent, list_agents or archive_agent, by success, cancelled, timeout, the HTTP status the API answered, or error |
agentkourier_cma_auth_refused_total{reason} |
Counter | Requests a caller check refused, by missing or invalid |
agentkourier_cma_sessions |
Gauge | Contexts with a session: on the leader, every context the store holds; on a standby, 0 |
agentkourier_cma_sessions_archived_total{reason} |
Counter | Sessions the add-on let go of, by idle (archived after SESSION_IDLE_TTL), superseded (a context's extra session, or one on an agent or environment its agent no longer runs, archived at start or takeover), gone (a stored session no longer listed, forgotten at start or takeover, not archived), removed (a session of an agent the add-on stopped serving) or retired (a session of an agent whose agent or environment changed) |
agentkourier_cma_agent_turns_total{agent,outcome} |
Counter | Turns, by agent and by the outcomes of agentkourier_cma_turns_total |
agentkourier_cma_agent_sessions{agent} |
Gauge | Contexts with a session, by agent, as agentkourier_cma_sessions counts them |
agentkourier_cma_agent_sessions_archived_total{agent,reason} |
Counter | Sessions let go of, by agent and by the reasons of agentkourier_cma_sessions_archived_total |
agentkourier_cma_agent_busy_total{agent} |
Counter | Messages answered busy (-32004) because their agent already ran CMA_MAX_RUNNING_TURNS_PER_AGENT turns |
agentkourier_cma_agent_auth_refused_total{agent,reason} |
Counter | Requests a ClaudeManagedAgent's check refused, by the agent whose path they reached, and by missing or invalid. Refusals at /a2a are counted only in agentkourier_cma_auth_refused_total. |
agentkourier_cma_agents{state} |
Gauge | Agents by state: served (the single agent, and each ClaudeManagedAgent this replica routes to), pending (accepted, not yet restored by the leader, or, for a defined agent, whose agent it has not yet made), invalid_spec, id_not_allowed and agent_limit_reached (not accepted, for the reason its Accepted condition names) |
agentkourier_cma_agent_writes_total{op,outcome} |
Counter | The leader's writes to the workspace's agents for the defined agents, by op (create, update or archive) and outcome: ok, refused (a 4xx other than 408, 409 and 429, a 404 to an update included) or error (any other failure, or a definition the add-on could not send) |
agentkourier_cma_foreign_agents{state} |
Gauge | Agents of the workspace that carry the add-on's owner tag and another install's tag, or none, as the leader's last listing found them; one state, orphaned. The add-on never writes or archives them (Archiving: sweeps). |
agentkourier_cma_message_replays_total |
Counter | Resent messages that joined their first send's task |
agentkourier_cma_tasks_interrupted_total |
Counter | Tasks a restart or takeover failed |
agentkourier_cma_leader |
Gauge | 1 on the leader (on SQLite, the only replica), 0 on a standby |
agentkourier_cma_leader_takeovers_total |
Counter | Times this replica became the leader |
agentkourier_cma_forwarded_requests_total{outcome} |
Counter | Requests a standby forwarded to the leader, or could not: forwarded, failed, cancelled, no_leader or loop (a request another standby forwarded) |
No label of the two definition families carries a namespace, a name, an ID or a prompt. The agent label is legacy
for the single agent and <namespace>/<name> for a ClaudeManagedAgent. The series of an
agent the add-on removes are dropped from the families with that label; the families without it keep their counts.
Each turn is a span, agentkourier.cma.turn, a child of the trace context Agent Kourier sends with the request, with the
attribute agentkourier.cma.agent (the agent label's value), and each call to the Managed Agents API a span
agentkourier.cma.backend.<operation> under it.
Limits¶
Limits has every limit of the add-on with its value. In short:
- Text only. Messages carry text and data parts; files and images are refused, and the agent's content blocks that are not text are not shown.
- Approvals need the buttons. A typed reply cannot approve or deny a tool call.
- No custom tools. A pause on a custom tool fails the turn.
- Mixed pauses. If one pause names both a call the sandbox runs and a call that needs approval, the turn that resumes after the approval did not see the first call start. If the session idles on that call again, the turn fails as an action the add-on cannot answer.
- Session errors are only logged. A
session.errorevent is written to the add-on's log; the turn goes on until the session idles or terminates. - A restart fails the turns in flight, and keeps paused approvals.
- A bounded number of agents and turns. At most
CMA_MAX_AGENTSagents, andCMA_MAX_RUNNING_TURNS_PER_AGENTrunning turns for each. - One workspace. Every agent shares the add-on's API key.
- One replica on SQLite.
- Self-hosted environments only. Cloud environments are untested.
- A defined agent's effort cannot be removed. Once
model.effortis set, an update without it keeps it whilemodel.idstays the same, as the Claude Managed Agents documentation says and a run against a live workspace confirmed. - A console edit of a defined agent lasts until the next write, at most
5m. - A deleted defined agent is archived after two sweeps at least
60sapart, and the archive is final. - A defined agent's MCP servers must be reachable from Anthropic, not only from the cluster (MCP servers).