Skip to content

Connect Claude Managed Agents

For a platform team that runs Agent Kourier, and the teams that have agents in Claude Managed Agents. At the end, the chart runs the Claude Managed Agents add-on, each team declares its agent as a ClaudeManagedAgent in its own namespace, and a Binding there sends its threads to that agent.

Each thread is one session of the agent, and a tool call whose permission policy asks first waits on Approve and Deny in the thread. The add-on is experimental.

Add-ons says what an add-on is. The Claude Managed Agents add-on reference has how the add-on maps A2A to sessions, the resource's fields and status, every setting, and what a restart keeps.

Why Claude Managed Agents behind a Binding

Claude Managed Agents runs the agent: Anthropic runs the model loop, and an agent is a stored, versioned object with its own tools, permission policies and skills. Each session gets a sandbox, which a self-hosted environment runs in your own cluster, next to the systems it works on.

What it does not have is a way into chat: putting such an agent in a channel means writing a chat app, with its threads, approval buttons and audit.

Agent Kourier is that way into chat. A Binding gives the agent a session per thread, audit, metrics and traces, and triggers such as the alerts another app posts.

It runs on Slack, and on Microsoft Teams and webhooks (both experimental). On Slack and Teams, tool approvals are buttons.

The add-on sits between the two: an A2A server in front of the agents, each at a path of its own, so the broker needs no change. A tool set to always_ask in the agent's permission policy becomes Approve and Deny in the thread, so a command in your cluster runs only after a person approves it.

Who does what

  • The platform team runs one add-on for the cluster, with an allowlist that says which agent, environment and vault IDs each namespace may name, and which namespaces may define their agents, with which models and MCP server hosts.
  • A team makes a caller token, declares its agent as a ClaudeManagedAgent with the token's digest, and points an AgentBackend and a Binding at the URL the add-on writes to the resource's status. It needs no change to the release.

A ClaudeManagedAgent either references an agent made in the Claude console, by its ID (spec.agentId), or defines the agent itself (spec.agent): its model, system prompt, tools and MCP servers. The add-on makes a defined agent in the workspace, writes the resource's definition to it on every change, and archives it once the resource is gone, so the agent's prompt and tools live in Git and go through review like the rest of the team's resources.

Every team's agent runs on the add-on's one Anthropic API key, so the teams share that workspace's billing and rate limits. With that key the add-on creates sessions, and for the teams that define their agents it also creates, updates and archives agents in the workspace: only the agents it made, which carry its tags.

Before you start

  • An agent in Claude Managed Agents for each team that references one, and its ID. Give each tool that a person should approve first the always_ask permission policy. A team that defines its agent needs none.
  • A self-hosted environment whose worker runs in your cluster, and its ID. Cloud environments have not been tested with the add-on and are not supported. The add-on does not refuse one.
  • An Anthropic API key for the organization that holds the agents.
  • Agent Kourier installed with the Helm chart (Install with Helm) on custom resources, the chart's default route, so that a team can write its own Binding. Use a release whose release notes list the ClaudeManagedAgent.
  • For more than one replica of the add-on, a Postgres database of its own, apart from Agent Kourier's.

The commands below use the release agent-kourier in the namespace agent-kourier, and a team in the namespace team-a. The add-on's Service is then agent-kourier-cma. In general it is <fullname>-cma.

The platform team: run the add-on

1. Create the API key's Secret

kubectl -n agent-kourier create secret generic anthropic \
  --from-literal=apiKey="${ANTHROPIC_API_KEY}"

With Postgres, create a second Secret with the add-on's DSN:

kubectl -n agent-kourier create secret generic cma-postgres \
  --from-literal=dsn='postgres://cma:[email protected]:5432/cma'

2. Turn the add-on on, with managed agents

Add the block to your values file:

addons:
  cma:
    enabled: true
    anthropicApiKeySecret: {name: anthropic, key: apiKey}
    sessionIdleTTL: 2160h # (1)!
    managedAgents:
      enabled: true
      allowlist: # (2)!
        team-a:
          agentIds: [agent_0123456789]
          environmentIds: [env_0123456789]
          vaultIds: [vlt_0123456789]
          agentDefinitions: # (3)!
            models: [claude-sonnet-5-5, claude-haiku-5-5]
            mcpServerHosts: [mcp.github.example.com]
        team-b:
          agentIds: [agent_9876543210]
          environmentIds: [env_0123456789]
      maxAgents: 100 # (4)!
      maxRunningTurnsPerAgent: 8 # (5)!
  1. Set it to the Bindings' session.threadTTL (Match the session lifetimes).
  2. Each namespace whose ClaudeManagedAgents the add-on may serve, with the IDs they may name. A namespace left out may still create one, which is refused with IDNotAllowed. There are no wildcards. An edit needs an upgrade of the release and no restart of the add-on, and takes effect in two steps: the kubelet first updates the file mounted in the add-on's pod, after a sync delay of its own, and the add-on's next read of the file, every 5 seconds, then picks it up: about a minute on the repository's kind tier (The allowlist has the measurement). An edit that drops an agent's namespace or ID stops serving it: its running turns fail and its sessions are archived.
  3. Lets team-a define its agents in the resource; team-b, without the key, may only reference. models lists the model IDs such an agent may run on, 1 to 64 of them. mcpServerHosts lists the hosts its MCP server URLs may name, up to 64; a host matches exactly, ignoring letter case, its port is ignored, and a subdomain of a listed host does not match. Without mcpServerHosts a defined agent may name no MCP server. A defined agent needs no agentIds, and its environment and vaults are checked as any other's. A namespace without agentDefinitions may only reference agents. Taking the key, a model or a host away stops serving the agents that need it, as any allowlist refusal does, and keeps their agents in the workspace: allowed again, a resource is served on the agent it had.
  4. The most agents the add-on serves. An agent already served keeps its place, and a free place goes to the oldest waiting one (Places at the cap).
  5. The most turns each agent runs at once. A message past it is answered busy; one agent at its bound holds back no other.

With managedAgents.enabled the chart also renders:

  • The ClaudeManagedAgent CRD, kept on helm uninstall and when managed agents are turned off. If your CRDs are applied by GitOps, set crds.install: false and apply the file the chart carries, files/addons/cma/crds/cma.agentkourier.dev_claudemanagedagents.yaml, yourself, with kubectl apply --server-side. The add-on exits at start when the CRD is not installed.
  • The ClusterRole <fullname>-cma-<namespace> and its binding, with rbac.create: list and watch on claudemanagedagents, patch on their status, and get on the CRD by name. No Secret. With rbac.create: false, grant the same rules yourself.
  • The ConfigMap <fullname>-cma-allowlist, which holds the allowlist, and the ServiceAccount's token in the add-on's pod.

Turn managed agents on in one release per cluster: two add-ons would both serve every ClaudeManagedAgent and both write its status.

For more than one replica, keep the state in Postgres. The replicas elect a leader through the database, and a standby forwards what it receives to the leader:

addons:
  cma:
    replicaCount: 2
    store:
      type: postgres
      postgres:
        dsnSecret: {name: cma-postgres, key: dsn}

With SQLite, the default, the chart refuses replicaCount above 1, keeps the database on a ReadWriteOnce volume, and replaces the pod with the Recreate strategy.

With networkPolicy.enabled, the add-on gets a NetworkPolicy of its own, whose egress includes the Kubernetes API server at networkPolicy.kubeApiServer, and Postgres needs addons.cma.networkPolicy.postgres.to. Helm values has every value of the block.

Upgrade the release with the file, then wait for the add-on:

helm upgrade agent-kourier oci://ghcr.io/agentkourier/charts/agent-kourier --version <version> \
  -n agent-kourier -f my-values.yaml
kubectl -n agent-kourier rollout status deployment/agent-kourier-cma
kubectl -n agent-kourier logs deployment/agent-kourier-cma | grep 'adapter listening'

The add-on serves only after its start-up work: it reads every ClaudeManagedAgent, reads its store, checks each thread's session against the sessions in Claude Managed Agents, and fails the turns a restart cut off. A setting it cannot use stops it at start, with an error that names the variable.

3. Let the team write its resources

The chart aggregates no right on claudemanagedagents into a namespace's admin role, so a team cannot create one until a Role gives it that right. Give it one in the team's namespace, beside the one for its Bindings and AgentBackends (Let a team add its own Binding):

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: {name: claude-managed-agents-writers, namespace: team-a}
rules:
  - apiGroups: [cma.agentkourier.dev]
    resources: [claudemanagedagents]
    verbs: [get, list, watch, create, update, patch, delete]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: {name: claude-managed-agents-writers, namespace: team-a}
roleRef: {apiGroup: rbac.authorization.k8s.io, kind: Role, name: claude-managed-agents-writers}
subjects:
  - {kind: Group, name: team-a, apiGroup: rbac.authorization.k8s.io}

The Role grants no right on the status subresource: only the add-on writes it.

A team: connect its agent

1. Make a caller token, and let the broker read it

The token is what Agent Kourier presents to the add-on for your agent. Make it random and long: the digest you put in the resource can be read by anyone who can read the resource, and a short or guessable token can be found from it.

token="$(openssl rand -hex 32)"
kubectl -n team-a create secret generic pr-reviewer-token --from-literal=token="$token"

--from-literal stores the value with no trailing newline. Keep it that way: Agent Kourier sends the token as the Secret holds it, and refuses to send a value with a control character, a newline included.

Let the broker read the Secret, with a Role in your namespace that names it and a RoleBinding to the broker's ServiceAccount (agent-kourier in agent-kourier for this release):

kubectl -n team-a create role agent-kourier-secrets-team-a --verb=list,watch --resource=secrets --resource-name=pr-reviewer-token
kubectl -n team-a create rolebinding agent-kourier-secrets-team-a --role=agent-kourier-secrets-team-a --serviceaccount=agent-kourier:agent-kourier

Let a team add its own Binding says how to find the ServiceAccount's name and check the grant. The add-on itself never reads the Secret.

2. Compute the token's digest

The digest is sha256: and then the 64 lower-case hex digits of the token's SHA-256, taken over the token exactly as the Secret holds it:

echo "sha256:$(printf '%s' "$token" | sha256sum | cut -d' ' -f1)"

On macOS, use shasum -a 256 in place of sha256sum.

3. Apply the ClaudeManagedAgent

This step references an agent made in the Claude console. To define the agent in the resource instead, follow Define your agent in place of this step and the next, then come back to step 5.

apiVersion: cma.agentkourier.dev/v1alpha1
kind: ClaudeManagedAgent
metadata:
  name: pr-reviewer
  namespace: team-a
spec:
  agentId: agent_0123456789 # (1)!
  environmentId: env_0123456789
  vaultIds: [vlt_0123456789] # (2)!
  callerTokenDigests:
    - sha256:<the 64 hex digits from step 2> # (3)!
  1. The agent's ID, as Claude Managed Agents shows it. Sessions run its latest version. The allowlist must let your namespace name it, and the environment and each vault too.
  2. Optional: the vaults each new session is created with, in order, for an MCP server that needs a credential. A session keeps the vaults it was created with (Vaults).
  3. One to four digests. Every token whose digest is listed is the same caller.
kubectl apply -f pr-reviewer.yaml

The CRD's schema refuses a resource with a malformed ID or digest, or too many of either.

4. Read its status

kubectl -n team-a wait --for=condition=Ready claudemanagedagent/pr-reviewer --timeout=120s
kubectl -n team-a get claudemanagedagent pr-reviewer
kubectl -n team-a get claudemanagedagent pr-reviewer -o jsonpath='{.status.url}'

The add-on's leader writes the status, at most every 10 seconds per resource:

  • Accepted=True and Ready=True (reason Served): the add-on serves the agent, and status.url is its URL, such as http://agent-kourier-cma.agent-kourier.svc:8090/a2a/agents/team-a/pr-reviewer.
  • Accepted=False: the reason says why, and the message names the fields. IDNotAllowed means the allowlist does not name your namespace or one of your IDs: ask the platform team. AgentLimitReached means every place is taken; the agent is served once one is free. InvalidSpec names the fields that are wrong.
  • Ready=False with the reason Pending: accepted, and the add-on is still restoring the agent's sessions.

Conditions has every reason.

5. Declare the AgentBackend and the Binding

The AgentBackend names the agent's URL, from status.url, with the a2a dialect. The Binding sends the token through identity.tokenSecretRef, as Authorization: Bearer:

apiVersion: agentkourier.dev/v1alpha1
kind: AgentBackend
metadata:
  name: pr-reviewer
  namespace: team-a
spec:
  dialect: a2a
  url: http://agent-kourier-cma.agent-kourier.svc:8090/a2a/agents/team-a/pr-reviewer # (1)!
---
apiVersion: agentkourier.dev/v1alpha1
kind: Binding
metadata:
  name: pr-review
  namespace: team-a
spec:
  agent:
    backendRef: {name: pr-reviewer}
    namespace: team-a # (2)!
    name: pr-reviewer
  identity:
    userId: agent-kourier-cma
    tokenSecretRef: {name: pr-reviewer-token} # (3)!
  chat:
    connectionRef: {namespace: agent-kourier, name: slack} # (4)!
    channel: C0123456789 # the channel's ID, not its name
    output: live
  interactions:
    toolApprovals: true # (5)!
  session:
    threadTTL: 2160h
  1. The URL the agent card names too. Agent Kourier fetches the card at this URL plus /.well-known/agent-card.json.
  2. On the a2a dialect agent.namespace and agent.name are labels: the URL selects the agent, and they are not sent.
  3. The Secret of step 1, in the Binding's namespace.
  4. A ChatConnection of another namespace must allow yours and be named with its namespace.
  5. Without it, Agent Kourier denies every tool call that asks for approval, with the reason that the Binding does not allow tool approvals. approverGroups limits who may decide. See Let the agent ask questions.
kubectl apply --dry-run=server -f pr-review.yaml
kubectl apply -f pr-review.yaml
kubectl -n team-a wait --for=condition=Ready akbinding/pr-review --timeout=120s

A token of another team's agent is refused at your agent's path, and yours at theirs, with 401: each agent accepts only the digests its own resource lists.

Or send the token in a header of your own

To keep identity for something else, the AgentBackend can carry the token in a header instead. The platform team names the header for the whole add-on, and every agent reads its token from it:

addons:
  cma:
    auth:
      header: X-Cma-Token

Your AgentBackend then has an entry with that name in headers, whose value comes from the Secret:

spec:
  dialect: a2a
  url: http://agent-kourier-cma.agent-kourier.svc:8090/a2a/agents/team-a/pr-reviewer
  headers:
    - name: X-Cma-Token
      valueSecretRef: {name: pr-reviewer-token}

The header's value is then the whole token, with no Bearer. The header cannot be one that carries the Binding's identity: Authorization, Proxy-Authorization, Cookie, X-User-Id, X-Agent-Name, X-Share-Token or X-Kagent-Insecure-Runtime-Identity.

The Secret is read in the AgentBackend's namespace, and the Binding's identity still needs a userId or a tokenSecretRef.

Define your agent

A ClaudeManagedAgent can define its agent in spec.agent instead of naming one made in the Claude console. The field has the structure of the Agents API's create request, with the field names in camelCase: mcp_servers is mcpServers, default_config is defaultConfig, permission_policy is permissionPolicy, mcp_server_name is mcpServerName and allowed_domains is allowedDomains, so an agent written for Anthropic's documentation maps over one field at a time.

The add-on's leader makes the agent in the workspace, serves the resource on it, writes the resource's definition to it again on every change and every 5 minutes, and archives it once the resource is gone. Serving, sessions, the caller check and the cap are the same as for an agent you reference.

Do steps 1 and 2 of A team: connect its agent first: the caller token, its Secret, the broker's Role and the token's digest are the same for a defined agent. Then:

1. Make each MCP server reachable from Anthropic

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. An MCP server must therefore be reachable from Anthropic: at a public URL, or through an MCP tunnel, which the same documentation calls a research preview. A server in your cluster at a .svc name or another private address is not reached, even though the agent's sandbox runs beside it. The documentation also 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 does not refuse a private host name, since a tunnelled server may use one. What it checks is the host: each server's URL is https:// and then a host that your namespace's mcpServerHosts lists.

2. Get a vault for each MCP server that needs a credential

A vault holds the credentials an agent's MCP servers need, such as a bearer token. 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 resource holds only the vault's ID: the add-on creates each new session with the vaults of spec.vaultIds, in order, and never sees a credential (Vaults).

For each server that needs a credential, ask whoever holds the workspace for a vault with a credential for that server's URL, and ask the platform team to add the vault's ID to your namespace's vaultIds. A server that needs no credential needs no vault.

3. Get the environment ID and your allowlist entry

The environment is where the agent's built-in tools run: a self-hosted environment whose worker runs in your cluster. Its ID, env_ and then letters and digits, comes from whoever made it in the workspace.

Ask the platform team for your namespace's entry in the allowlist (Turn the add-on on, with managed agents), with:

  • the environment's ID in environmentIds, and each vault's ID in vaultIds;
  • agentDefinitions, with the model your agent runs on in models, and each MCP server's host in mcpServerHosts.

4. Write the resource

apiVersion: cma.agentkourier.dev/v1alpha1
kind: ClaudeManagedAgent
metadata:
  name: pr-reviewer
  namespace: team-a
spec:
  agent: # (1)!
    name: team-a PR reviewer # (2)!
    description: Reviews pull requests for team-a's services. # (3)!
    model:
      id: claude-sonnet-5-5 # (4)!
      effort: high # (5)!
    system: | # (6)!
      You review pull requests for team-a. Read the diff, run the tests with bash,
      and reply with a short verdict and the findings that block a merge.
    mcpServers:
      - type: url # (7)!
        name: github
        url: https://mcp.github.example.com/mcp # (8)!
    tools:
      - type: agent_toolset_20260401 # (9)!
        defaultConfig:
          permissionPolicy: {type: always_allow} # (10)!
        configs:
          - name: bash
            permissionPolicy: {type: always_ask} # (11)!
          - name: web_search
            enabled: false
          - name: web_fetch
            allowedDomains: [docs.example.com, pkg.go.dev] # (12)!
      - type: mcp_toolset # (13)!
        mcpServerName: github
        defaultConfig:
          permissionPolicy: {type: always_ask}
        configs:
          - name: get_pull_request
            permissionPolicy: {type: always_allow}
  environmentId: env_0123456789 # (14)!
  vaultIds: [vlt_0123456789] # (15)!
  callerTokenDigests:
    - sha256:<the 64 hex digits from step 2> # (16)!
  1. In place of agentId: set exactly one of the two.
  2. Optional: the agent's name in the workspace, at most 256 characters. Left out, the add-on names it after the resource, <namespace>/<name>: here team-a/pr-reviewer.
  3. Optional: at most 2,048 characters.
  4. Required, and listed in your namespace's agentDefinitions.models: lower-case letters, digits, . and -, at most 128 characters. The model's object form only: a bare string is refused.
  5. Optional: low, medium, high, xhigh or max; left out, the model's default. Once set, removing it does not take it back: an update without effort keeps the agent's last one while the model stays the same, so set another level instead (Edit it). speed, standard or fast, is optional too, and standard when left out.
  6. Optional: the system prompt, at most 100,000 characters.
  7. url, the only type, and the default. At most 20 servers, each with a name of its own, 1 to 255 characters.
  8. https:// and then a host your namespace's mcpServerHosts lists, at most 2,048 characters. Anthropic connects to it (step 1), and a vault of vaultIds supplies its credential.
  9. The built-in tools: bash, edit, read, write, glob, grep, web_fetch and web_search. At most one such entry. Without tools, the agent has no tools.
  10. What applies to every tool of the set that configs does not name: enabled, and permissionPolicy, which is always_allow, always_ask or auto. Left out, the API's default applies: always_allow for the built-in tools, always_ask for an MCP server's.
  11. Each call of bash waits for Approve or Deny in the thread: Agent Kourier shows the buttons for a call whose policy asks first. Each tool is named at most once.
  12. Only web_fetch and web_search take allowedDomains or blockedDomains, not both: 1 to 64 lower-case domain names each. A path or a wildcard is refused.
  13. The tools of one server of mcpServers, which mcpServerName names. Each server is named by exactly one mcp_toolset, and its configs name at most 64 of the server's tools.
  14. The environment of step 3, listed in your namespace's environmentIds.
  15. Optional: the vaults of step 2, in order, each listed in your namespace's vaultIds.
  16. One to four digests, as for an agent you reference.

The CRD's schema refuses a resource that breaks one of these rules, or that sets both agentId and agent, or neither. It has no field for the API's other settings (skills, multiagent, executionIdentity, metadata, the model's inferenceGeo, the web tools' other settings), nor for a custom tool: kubectl apply refuses an unknown field with its default strict field validation. Limits has every bound of the field.

5. Apply it, and watch Synced

kubectl apply -f pr-reviewer.yaml
kubectl -n team-a wait --for=condition=Synced claudemanagedagent/pr-reviewer --timeout=120s
kubectl -n team-a wait --for=condition=Ready claudemanagedagent/pr-reviewer --timeout=120s
kubectl -n team-a get claudemanagedagent pr-reviewer -o jsonpath='{.status.agentId} {.status.agentVersion}{"\n"}'

The leader makes the agent only once the resource is accepted: valid, allowed and within the cap. A resource refused gets no agent, and Accepted=False says why, as for an agent you reference. IDNotAllowed names the fields the allowlist does not let you use: define agents (spec.agent) when your namespace has no agentDefinitions, spec.agent.model.id, spec.agent.mcpServers[<i>].url, spec.environmentId or spec.vaultIds[<i>]. Change the field, or ask the platform team.

Once it is accepted, a defined agent has a third condition, Synced, which says whether the agent in the workspace holds the resource's generation:

Status Reason Message What to do
True Synced The agent in the workspace holds this generation of spec.agent. Nothing.
False Pending The add-on has not yet written this generation of spec.agent to the workspace. Wait: the leader writes it.
False AgentRefused The workspace refused the agent definition (HTTP 400, invalid_request_error). Read the definition against Anthropic's documentation of the agent: the HTTP status and the API's error type are all the message gives. Fix it and apply.
False AgentRefused The add-on cannot write this agent definition. Change the definition and apply: it is tried again only for a new generation.
False WorkspaceError The workspace call failed; the add-on tries again. Nothing: a network failure, a 5xx, 408, 409 or 429 is tried again.

The message never quotes the definition or the workspace's answer. A write that fails is tried again after 10 seconds, then twice as long each time up to 5 minutes, and a new generation is written at once.

Until the agent exists, the add-on does not serve the resource: Ready is False with the reason Pending, its message points at Synced, and its path answers 404. Once the agent is made, status.agentId is its ID and status.agentVersion the version the add-on last wrote, Synced is True and Ready turns True:

status:
  url: http://agent-kourier-cma.agent-kourier.svc:8090/a2a/agents/team-a/pr-reviewer
  agentId: agent_01HXYZ
  agentVersion: 1
  conditions:
    - {type: Accepted, status: "True", reason: Accepted, observedGeneration: 1}
    - {type: Ready, status: "True", reason: Served, observedGeneration: 1}
    - {type: Synced, status: "True", reason: Synced, observedGeneration: 1}

In the workspace the agent carries two metadata keys: kourier_owner, the resource's <namespace>/<name>/<uid>, and kourier_install, the UID of the cluster's ClaudeManagedAgent CRD. The add-on reads only agents with its own install's tag as its own, so an add-on in another cluster on the same workspace never touches them.

With Ready=True, declare the AgentBackend and the Binding: step 5 of A team: connect its agent, unchanged.

6. Edit it

Change the resource and apply it. The leader writes the new generation to the agent: status.agentVersion moves to the agent's new version, and Synced comes back to True with the new observedGeneration.

  • Threads keep their version. An edit does not end any session. A session created with an agent's ID gets the agent's latest version at that moment, and keeps it, which a run against a live workspace confirmed: a thread that already has a session goes on with the version it started on (in the run, the old prompt), and a new thread gets the new version.
  • The resource wins. Each write sends the whole definition: a field you remove is sent null or empty (the description, the system prompt, the tools, the MCP servers), and the settings the resource has no field for are sent too, on every write: no skills, the default execution identity (the service account), and, on an update, a null multiagent. The Claude Managed Agents documentation says a null or empty value clears a field, and the Anthropic Go SDK's that the service account is the default identity; this has not been tested here.
  • Effort is the exception. The Claude Managed Agents documentation says that an update without model.effort 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. To change it, set another level.
  • An edit made in the Claude console lasts until the next write: the leader writes every definition again every 5 minutes, whether or not the resource changed. The Claude Managed Agents documentation says that an update that changes nothing makes no new version, which a run against a live workspace confirmed: a second write of the same definition kept its version.
  • A refused edit keeps the agent served on the version it has, with Synced=False and the reason AgentRefused. Fix the resource and apply.
  • Moving between agentId and agent, either way, changes the agent the resource is served on, and so archives its sessions, each once its running turns end, as a new agent ID does. A defined agent left behind is archived as a deleted resource's is.

7. Delete it

kubectl -n team-a delete claudemanagedagent pr-reviewer

The path stops at once, as for any agent: the running turns fail and the sessions are archived. The agent itself is archived about a minute later: the leader archives an agent it made once two of its sweeps, at least 60 seconds apart, find no resource that defines it. An archive cannot be undone. A resource applied again under the same name is a new resource, with a new agent.

An allowlist edit that no longer allows the resource, or a resource held out by the cap, stops serving it and keeps the agent: allowed again, the resource is served on the same agent.

Match the session lifetimes

Agent Kourier gives a thread a new A2A context once it has had no activity for the Binding's session.threadTTL (default 2160h).

The add-on archives a context's session once the context has had no activity, with no turn running, for sessionIdleTTL (SESSION_IDLE_TTL, the same default), for every agent alike. For the add-on, activity is a message accepted for the context, or a turn of it starting or ending. An archived session cannot be used again.

Keep the two equal:

  • Shorter than threadTTL, the add-on archives sessions that a thread can still continue, and the thread's next turn starts a new session without the old history.
  • Longer than threadTTL, sessions that no thread will use again stay unarchived until it passes.

sessionIdleTTL does not free an idle sandbox's memory: the environment's own idle timeout does that, and the session stays resumable.

Set toolResultTimeout above your slowest command. A turn that waits on a tool the sandbox runs, or for the session to resume after a requires_action idle that came straight after its result, with no event from the session for that long, is interrupted and fails with Agent Kourier's timeout notice. That is how a sandbox that cannot be scheduled shows up, and a command that runs silently for longer is cut off the same way.

Check it

Mention the bot in the channel. The answer streams into the thread, and replies in the thread continue the same session. Ask for something that runs a tool set to always_ask: the thread shows Approve and Deny, and the command runs only after a press.

If the thread shows nothing, read the resource's status and the two logs:

kubectl -n team-a get claudemanagedagent pr-reviewer -o yaml
kubectl -n agent-kourier logs deployment/agent-kourier | grep 'session turn'
kubectl -n agent-kourier logs deployment/agent-kourier-cma

refused an A2A request in the add-on's log, with the reason missing or invalid, means Agent Kourier sent no token, or one whose digest the agent's resource does not list. Compute the digest of the Binding's Secret again and compare, and check that the Secret has no trailing newline. agentkourier_cma_agent_auth_refused_total{agent="team-a/pr-reviewer"} counts these refusals.

Rotate a caller token

The add-on accepts every digest the resource lists, so a new token can be added before the old one is removed:

  1. Make a new token, and add its digest to spec.callerTokenDigests. The next request is checked against the new list.
  2. Change the Binding's Secret to the new token (Rotate the Binding token).
  3. Remove the old digest. The next request with the old token is refused.

Change or remove an agent

Each change applies without a restart of the add-on, and none cuts another agent's turns (Changes while it is served).

  • A new agent or environment ID archives the agent's sessions, each once its running turns end. A thread's next turn runs in a new session under the same thread, without the old history and with no notice in the thread.
  • New vaults reach the sessions created from then on.
  • Deleting the resource, or an allowlist edit that no longer allows it, stops serving it at once: its running turns fail with "The agent was removed from the adapter, so the adapter ended this turn.", and its sessions are archived. A resource made again under the same name is a new agent, with none of the old one's sessions.
  • A defined agent's definition is written to its agent without ending any session, and a deleted resource's agent is archived about a minute later (Edit it and Delete it).

The single agent (deprecated)

Before the ClaudeManagedAgent, the add-on served one agent, named in the release's values, at /a2a. It still does, beside the managed agents or alone, and keeps every thread's session across the upgrade, but it is deprecated: it will be removed no earlier than two minor releases after the release that deprecated it. While it is set, the add-on logs a deprecation WARN at start, and helm install and helm upgrade print a note. Its turns count toward maxRunningTurnsPerAgent and its place toward maxAgents, as any agent's.

Its values, which a new install should not use:

addons:
  cma:
    enabled: true
    agentId: agent_0123456789
    environmentId: env_0123456789
    vaultIds: [vlt_0123456789]
    anthropicApiKeySecret: {name: anthropic, key: apiKey}
    auth:
      tokenSecret: {name: cma-token} # (1)!
rbac:
  secretNames:
    agent-kourier: [cma-token] # (2)!
  1. The Secret, in the release namespace, of the tokens the single agent accepts, one per line. The add-on reads it again every few seconds. Any accepted token reaches every task of the single agent.
  2. On custom resources, the chart grants Agent Kourier only the Secrets it can see. A Binding you apply yourself that names cma-token needs it granted here.

Its AgentBackend's url is http://agent-kourier-cma.agent-kourier.svc:8090/a2a, and its Binding sends one of those tokens through identity.tokenSecretRef. Without managed agents, the chart requires agentId, environmentId and auth.tokenSecret. With them, it refuses auth.tokenSecret and vaultIds when no agentId is set.

Move from the single agent

  1. Turn on managed agents beside the single agent, and allowlist the namespace with the same agent and environment IDs.
  2. Apply a ClaudeManagedAgent with a new token's digest, and wait for its Ready condition.
  3. Change the AgentBackend's url from /a2a to the resource's status.url, and the Binding's Secret to the new token.

A thread whose AgentBackend moves from /a2a to the new URL starts a new session in its next turn, without the old history: the new agent is another caller, and has none of the single agent's sessions. Move when threads can start fresh.

Once no AgentBackend uses /a2a, unset agentId, environmentId, vaultIds and auth.tokenSecret. When it restarts without them, the add-on archives the single agent's stored sessions and forgets their contexts, as for any agent it no longer serves, and /a2a answers 404.

Turn it off

addons.cma.replicaCount: 0 stops the add-on and keeps its volume or database. addons.cma.enabled: false removes its objects. The SQLite volume's claim is kept unless addons.cma.persistence.retainOnUninstall is false, the ClaudeManagedAgent CRD and resources are kept, and the sessions in Claude Managed Agents stay until they are archived there.