AgentProfile CRD
The AgentProfile custom resource describes one kind of agent pod on the A2A bus: its persona, worker and tools images, its topic grants, the ServiceAccount it runs as, and how long one task may run. It is part of the A2A stack.
An AgentProfile is not a Hermes profile on its own: the platform and cluster templates the gateway scaffolds under $HERMES_HOME/profiles are unaffected by ordinary profiles. The one exception is a built-in optional specialist template shipped in the platform-agent image (tse, under /opt/tse-template): when a bound AgentProfile of that name resolves, the operator also passes its name in KUBE_AGENTS_ENABLED_PROFILES on the gateway Deployment so the entrypoint scaffolds and syncs $HERMES_HOME/profiles/tse on startup (and archives it to $HERMES_HOME/profiles/.deleted/tse when the AgentProfile is removed).
- API group / version:
kubeagents.x-k8s.io/v1alpha1 - Kind:
AgentProfile - Short Name:
apr - Source:
k8s-operator/api/v1alpha1/agentprofile_types.go - Samples:
k8s-operator/examples/agentprofile-chat.yaml,k8s-operator/examples/agentprofile-tse.yaml,k8s-operator/examples/agentprofile-cluster.yaml(the generic cluster agent and a pinned variant) - Fields: AgentProfile fields, every
specandstatusfield with its type, default and constraints, generated from the Go API types.
Specification
Section titled “Specification”apiVersion: kubeagents.x-k8s.io/v1alpha1kind: AgentProfilemetadata: # A dot-free DNS-1123 label: it is the addressee on the bus. The name plus its # longest listed tier is at most 54 characters. `platform` and `session` are reserved. name: auditor namespace: kubeagents-systemspec: description: Reads cluster state and reports findings. Never mutates. persona: image: registry.example.com/kube-agents/persona-auditor:1.0 harness: image: registry.example.com/kube-agents/agent-worker:1.0 model: model-default maxTurns: 50 # type: core-agent # optional; absent is core-agent, the harness the worker image carries tools: # optional - name: jq # at most 24 characters image: registry.example.com/kube-agents/tools-jq:1.7 # imagePullPolicy: IfNotPresent bus: publishTopics: - shared.annotations subscribeTopics: - shared.blueprint identity: {} # absent: the operator creates a ServiceAccount per tier, with no RBAC lifecycle: activeDeadlineSeconds: 1800 ttlSecondsAfterFinished: 600 concurrency: 2 allowedTiers: [read] # optional; absent means read alone parameters: # optional; the task parameters the persona declares - name: cluster required: true scripts: # optional; helper scripts a built-in schedule may run with no model - name: stall-watch path: /opt/kube-agents/scripts/stall_watch.py timeoutSeconds: 300 resources: requests: { cpu: 250m, memory: 512Mi } limits: { cpu: "1", memory: 2Gi }harness.type names the harness the worker image runs. Absent is core-agent, the harness the worker image carries; leave it out for core-agent. claude-code is still accepted so an existing profile validates, but the worker image no longer carries it, and the operator refuses such a profile with IdentityReady=False (HarnessNotSupported) until the field is removed or set to core-agent. The operator passes a set type to the worker as A2A_HARNESS. On an older CRD that lacks the field, a client that validates fields strictly, as kubectl does by default, refuses a manifest that sets it, and so does any server-side apply. Another client applies it with the field dropped, so the profile runs on the worker’s default harness.
The type is pod configuration only. It isn’t on the profile’s card, and no bus subject or permission depends on it. If a profile’s type is one this operator doesn’t render (an older, newer or edited CRD let it in), the operator refuses the profile: IdentityReady is False with reason HarnessNotSupported, and nothing is rendered for it.
The persona image and each tools image keep their content under a /files directory. The persona mounts read-only at /persona. Each tool mounts read-only at /opt/tools/<name>, and its /opt/tools/<name>/bin goes on PATH in list order, so put a tool’s binaries in /files/bin. Where the cluster can’t mount image volumes (GKE Autopilot, Kubernetes below 1.35), an init container copies /files into an emptyDir instead, so these images also need /bin/sh. A tools image holds no credentials: a tool that needs them gets them from the broker, per task.
Where an init container copies them, the persona’s /files and each tool’s must fit in 512Mi, and a profile can carry up to 10 tools. More would push a worker pod’s ephemeral-storage request past Autopilot’s 10Gi per pod, where the pod wouldn’t schedule. So on an install without image volumes, the operator renders no warm pool for a profile with more than 10 tools, and writes a ProfileNamespaceFailed Warning event on the PlatformAgent that names the profile.
Topic grants are written without the a2a.topics. prefix, as shared.{topic} or agent.{agent}.{topic}. Nothing else is accepted. A grant only works on a topic the install provisions, and the operator does not check that, so a grant on any other topic is refused by the bus at runtime. A profile may read any agent’s topics, but the only agent-scoped topics it may publish are its own (agent.<this profile's name>.{topic}), because an agent’s topics have one writer.
From the chart’s values
Section titled “From the chart’s values”The chart renders an AgentProfile for each entry of profiles.custom, beside its built-in tse, cluster and fleet-audit profiles:
profiles: custom: - name: finops description: Answers cost questions from billing and usage data. persona: image: registry.example/personas/finops:1.0 allowedTiers: [read]An entry needs name, description and persona.image. It may also set harness.image, harness.model, harness.maxTurns, allowedTiers (read, unattended or both), parameters, lifecycle, concurrency and resources; the chart’s values.yaml lists the defaults. persona.image is your image’s full reference, with a tag or a digest, and is used as written; harness.image is {repository, tag}, as for the chart’s other images. Any other field of the spec, such as a ServiceAccount, topic grants, tools, scripts, a clusterRef, a worker type or a tier that is a Tier, needs an AgentProfile manifest applied beside the release.
The chart refuses some entries the resource would take: a name longer than 44 characters, a persona.image with no tag or digest, an empty harness.model, and more than 32 entries. It also refuses the built-in names tse, cluster and fleet-audit, beside platform and session. The entries render only while platformAgent.enabled is set.
What the operator renders
Section titled “What the operator renders”A profile binds to the PlatformAgent in its own namespace. The operator renders three things per profile:
- A ServiceAccount per allowed tier,
agentprofile-<name>-<tier>, in the profile namespace (see below). Each has token automount off and no RoleBinding, and carries the profile’s name and UID, since an owner reference can’t cross namespaces. Ifspec.identity.serviceAccountNamenames an existing ServiceAccount in the profile namespace, that one is used and none is created. A named ServiceAccount can serve only one tier, so the CRD refuses it alongside more than one entry inallowedTiers. Naming a ServiceAccount does hand the profile’s pods whatever RBAC it holds. - A bus identity per tier in the auth callout’s identity map, user
profile-<name>-<tier>. Its pods may publish task events and read task input for this profile’s tasks, take work the dispatcher sends to that pod ona2a.dispatch.<name>.<tier>.<pod>, accept it and renew its lease there, and use the topics the profile names. Nothing else. The task-subject scope is the profile, not one task: two pods of the same profile can reach each other’s task subjects. - An agent card on
a2a.agents.<name>, rendered fromspec.description,allowedTiers,clusterRef,parameters,yieldToPinned,delegatesand the names ofspec.scripts(names only, never a path or a timeout). Deleting the profile publishes a tombstone in its place before the profile is removed. A profile deleted while its namespace holds no PlatformAgent or more than one, or while the operator has no bus identity, is removed without one.
When a bound AgentProfile’s name matches a built-in optional specialist template baked into the platform-agent image (tse), the operator also sets KUBE_AGENTS_ENABLED_PROFILES on the gateway Deployment (which triggers a gateway pod rollout when tse is added or removed so the entrypoint scaffolds or archives $HERMES_HOME/profiles/tse). Ordinary AgentProfile resources (such as chat or auditor) do not touch KUBE_AGENTS_ENABLED_PROFILES and do not roll the gateway pod.
Deletion waits on the kubeagents.x-k8s.io/agentprofile-finalizer finalizer, which every reconciled profile carries and which only the operator removes. Before rolling the operator back to a release without AgentProfiles, or uninstalling it, delete the profiles while the operator is still running. Otherwise kubectl delete agentprofile hangs, and so does deleting the CRD behind it. To clear one by hand (it publishes no tombstone, so the card stays on the directory), and then delete its ServiceAccounts in the profile namespace, which carry no owner reference and so outlive it. Left there, they’d make a profile re-created under the same name find them foreign and be refused:
kubectl patch agentprofile <name> -n <namespace> --type=merge -p '{"metadata":{"finalizers":null}}'kubectl delete serviceaccount -n <namespace>-profiles -l kubeagents.x-k8s.io/agentprofile=<name>A profile may not name default, a ServiceAccount name the operator uses for the PlatformAgent, or one another AgentProfile already holds. Such a profile renders nothing, and its IdentityReady condition says why.
A spec.identity.serviceAccountName is looked up in the profile namespace. A profile written when ServiceAccounts lived in the agent’s namespace reports ServiceAccountNotFound until that ServiceAccount is created in the profile namespace.
The operator looks for AgentProfiles once, at startup. If the CRD isn’t installed, or the operator’s ClusterRole predates AgentProfiles (the RBAC self-check reports the missing agentprofiles permissions), it skips the AgentProfile controller, renders no profile identities, and keeps running everything else. Restart the operator after installing the CRD or applying the current role.
Writing an AgentProfile grants a bus identity, so treat create and update on agentprofiles like create on RoleBindings in that namespace. A profile’s name is its addressee on the task subjects, the same space the gateway’s session pods use. A profile named exactly like a live session pod could write that session’s task events, so nobody who can’t already act as that session should be able to create profiles.
allowedTiers lists the tiers the profile may run at, at most four: the built-in read and unattended, or a Tier in the install’s namespace. A task runs at its requester’s tier, and the dispatcher will refuse one whose tier the profile doesn’t list. Work a scheduled run delegates runs at read, but the gateway hands it only to a profile that also lists unattended. Absent means read alone.
A listed tier name is at most 10 lowercase letters or digits, with no hyphen. It becomes part of the profile’s bus identity (profile-<name>-<tier>, one 63-character label) and of its queue names, so the cap keeps every derived name valid, and the missing hyphen keeps two profiles’ queue names from colliding. A longer or hyphenated Tier can exist, but no profile can list it.
The operator decides what each listed name renders, and reports it in the TiersRendered condition:
-
A name with no tier renders nothing (reason
TierUnknown). The profile’s other tiers render as usual, and a profile left with none renders nothing at all. -
At most one unattended-mode tier per profile, because unattended tasks run as Jobs from one template per profile. If a profile lists a second one, the one it already serves keeps serving and the newcomer renders nothing (reason
TierModeConflict). A new profile listing two renders neither until one is removed. -
A tier dropped from the list drains. That covers one whose
Tieris deleted, and one that stops rendering. The card stops advertising it, and nothing new starts at it at once. A task already queued at it is refused with the reasontier-withdrawn. A task already running at it keeps its ServiceAccount, queues and pool, and finishes. The tier drains for the longest deadline a task can carry plus 15 minutes, then everything it rendered is removed within seconds.TiersRenderednames each draining tier and when its drain ends.Listing the tier again ends the drain once it renders again: not while its
Tieris missing, and not while it conflicts with the profile’s live unattended-mode tier. A running task that delegates to its own profile at the draining tier is refused like any new task; delegating to another profile still works. A profile left with no tier that renders drains as a removed profile does. A profile on a named ServiceAccount (spec.identity) serves one tier, so its tier is replaced at once rather than drained.This is not an emergency revoke. Deleting a
Tier, or dropping it from a profile, doesn’t cut off work already running at it: that work carries on until the drain ends. To end a drain now, annotate the profile:Terminal window kubectl -n <namespace> annotate agentprofile <name> kubeagents.x-k8s.io/end-tier-drain=<tier>[,<tier>]The dispatcher ends each task it holds at a listed tier: the task ends
canceledwith reasontier-ended, and its worker drops it. The tier is then removed within two minutes, with its ServiceAccount, pool and Jobs.The annotation acts only on a tier the profile is draining. The operator removes each tier from the annotation once it has acted, and removes a listed tier that the profile runs or isn’t draining, with a Warning event, so a leftover entry never ends a later drain. Anyone who can update the AgentProfile can set it. It ends one tier’s drain on a profile that still runs another tier; a profile left with no tier drains as a whole, which this annotation doesn’t end. A task still being offered to a worker when you set it is ended once it starts; one whose Job is still coming up is ended there, without waiting for the Job.
status.renderedTiers records what the last pass rendered. The operator uses it to tell the tier a profile already serves from a newcomer. If status is lost (a restore, a GitOps apply), it reads the profile’s own ServiceAccounts once instead.
yieldToPinned hands a task addressed to this profile to the profile pinned (clusterRef) to its target cluster, when there is one. Set it on a generic profile whose pinned profiles are its per-cluster variants, as the chart does for cluster. A specialist leaves it unset and keeps the tasks addressed to it by name, pinned cluster or not. It has no effect on a pinned profile, or on one that takes no target.
delegates lets this profile’s tasks hand tasks on to other profiles. With it set, the profile’s worker offers each task a delegate tool. A task that delegates stays open until its children report back, or until its deadline is near, and then answers from their reports, which it reads as quoted data rather than instructions. A task that is itself a delegated child gets no tool. The gateway refuses a delegation from a task of a profile without it, and a child it starts is still held to the gateway’s delegation checks: tier, scope, chain and the target’s allow-lists. Leave it unset unless the profile is meant to fan work out.
After a rollback to a release before the field, that release’s operator doesn’t render it onto the card, so the gateway refuses the profile’s delegations, which fails safe. The field stays on the profile unless the older CRD is applied too, so it takes effect again on the next upgrade.
Before yieldToPinned, every profile that takes a target handed off to a pinned profile: a generic profile you created yourself, not the chart’s, needs yieldToPinned: true for its pinned profiles to keep receiving its tasks. The chart refuses to render its cluster profile against an AgentProfile CRD that predates the field, since the API server would drop it silently; apply charts/kube-agents/crds/ first, as upgrade.sh does.
parameters lists the task parameters the profile’s persona declares, at most 16, each a lower-case identifier the worker exports as PROFILE_TASK_<NAME>. The gateway and the dispatcher read it here because neither can read the persona image: the gateway sends cluster work to a profile that declares project, location and cluster, and the dispatcher refuses a submission missing a required one. The list must match the persona’s, and a worker refuses to run a task when they differ.
scripts lists the helper scripts the profile may run as a script-run task: a built-in schedule’s run that execs one of them with no model turn. A script runs only in Job mode, at an unattended tier, on a worker that verifies the task’s credential before it starts. There are at most 16, each with a unique name that is a DNS-1123 label. Each path lies under /opt/kube-agents/scripts/, the one place helper scripts ship in the worker image. Its segments start with a letter, digit or underscore and hold only those, dots and hyphens, so a path has no .., no empty segment and no shell metacharacter.
timeoutSeconds may not exceed lifecycle.activeDeadlineSeconds, and the operator lowers it to the install’s task-deadline cap when that is lower. The dispatcher refuses a task naming a script the list doesn’t hold, as script-not-allowed. The path comes from this list, never from the task.
Profile workers run in their own namespace, <agent-namespace>-profiles, which the chart creates (and a kustomize make deploy creates). The operator never creates it, and treats a namespace of that name as the profile namespace only when it carries the chart’s app.kubernetes.io/component: profiles label and its meta.helm.sh/release-namespace annotation naming the agent’s namespace. Into it the operator renders a pod quota and a NetworkPolicy. That policy lets its pods reach DNS, the bus, LiteLLM and the credential broker’s port, and nothing else until the Kubernetes API proxy is opened to them as described below.
Deleting the PlatformAgent removes its quota from that namespace, and the kube-proxy Role, RoleBinding and CA bundle copy described below. If the delete is refused, the operator retries for two minutes and then lets the PlatformAgent go, leaving the quota and a ProfileQuotaLeft Warning event that names it. A later PlatformAgent in the same namespace removes the leftover quota when it renders its own (a ProfileQuotaAdopted event); one of the same name takes it over as its own. The NetworkPolicy stays until the chart’s uninstall deletes the namespace, since removing it first would leave the namespace admitted to the bus without its own policy.
Only once that policy is in place does the operator admit the namespace on the bus’s and LiteLLM’s own policies. The broker admits it on its own policy once a bound profile has a ServiceAccount for it to serve. LiteLLM is reached without a key, so anyone who can create a pod in that namespace can use the install’s model credentials. Treat pod create there like pod create in the agent’s own namespace.
Once both hold, the Kubernetes API proxy (kube-proxy) admits the namespace on its policy too. The operator then renders into the namespace a Role and RoleBinding that give that proxy get on pods, and a copy of its CA bundle ConfigMap. Changing the set of profiles or their tiers restarts the proxy one replica at a time, which ends the watches and log follows open on the restarting replica. When no profile is bound, the operator removes the Role and RoleBinding. The copy stays until the PlatformAgent is deleted, because a worker pod may still mount it.
Once those are applied and the proxy has finished restarting, the operator points profile workers’ kubectl at the proxy, and the worker pools restart once more. The namespace’s NetworkPolicy then also lets pods reach the proxy’s port. The proxy holds each request to the cluster named in the task’s credential, under its read-only policy. gcloud still goes through the broker. While the proxy is restarting, or after a failed write in the namespace, existing pods, Job templates and the policy keep what they have. A KubeProxyProfileRouteWaiting event on the PlatformAgent says when the operator is waiting for the proxy. A pool or Job template first created in that window starts on the broker and changes when the route turns on.
Setting A2A_PROFILE_KUBE_PROXY on the operator (operator.extraEnv in the chart) to any value but true keeps workers’ kubectl on the broker. Unset or empty leaves the route on. The policy still lets pods reach the proxy’s port while the proxy admits profile workers, so a running task finishes. The proxy’s own credential check remains the control.
The profile’s ServiceAccounts live there too. While the namespace is missing, or doesn’t carry the chart’s markers, a profile renders no identity and withdraws its card, and IdentityReady says ProfileNamespaceAbsent.
A profile task’s log read leaves out the container logs of the profile namespace and of the agent’s namespace. The broker adds a clause that drops them to the filter of a task’s gcloud logging read, and refuses a read whose filter cannot take the clause. It refuses a task’s kubectl logs in either namespace, and with --all-namespaces. Each refusal carries the rule caller.profile-log-read. The rule goes by the namespace’s name, so a namespace with either name on another cluster that a task reads is left out too.
The dispatcher, <agent>-a2a-dispatcher, reads the profiles’ submissions and hands each to a ready worker. It is the only component that publishes directly to a profile task’s supervisor subject, because the bus’s config denies the A2A gateway each profile’s by name. An install runs it by default; the chart’s operator.profileDispatcher.enabled: false switches it off.
Binding or removing a profile, or one finishing its drain, changes the bus’s config, whether or not the dispatcher runs. Every bus server reloads it in place, on one server or three, without a restart or a roll, usually within a minute. The operator confirms the reload on each server separately. Session pods’ bus connections drop and reconnect at the reload, within a second, and their tasks carry on.
If a server’s reload can’t be confirmed within three minutes, the operator restarts that server’s pod, one server at a time and only while the others are Ready, and records a BusConfigReloadFailed Warning on the PlatformAgent. Two profile changes that reach a pod in one kubelet write can’t be told apart in place, so they also end in that restart, recorded as a Normal BusConfigReloadFolded Event. A session task running on a restarted server at that moment fails, as on any bus restart. A newly bound profile stays held (BusConfigPending) until every server is confirmed on the new config, including while a server restarts or can’t be read.
The dispatcher has a ceiling, set by whichever of two limits comes first. Its bus identity names every profile’s durable and has to fit in one shard of the callout’s identity map, which comes to about 650 profiles at two tiers. Its config holds an entry per profile and has to fit in one ConfigMap. Under Job mode, each profile that allows unattended keeps its Job template in its own DispatchJobTemplate, and the config carries only a reference. So the identity limit usually comes first, though profiles that declare many parameters can fill the config sooner.
The operator binds profiles oldest first, by creation time with name breaking ties, while both fit. A newer profile past that isn’t bound: its IdentityReady reads DispatcherCeiling, it gets no identity, pool or card, and the dispatcher keeps serving the rest. The PlatformAgent’s DispatcherCeiling condition warns at four fifths of either limit, with a Warning event, and reads ProfilesRefused while any profile is left out. Its message says which limit it ran into and names the issue that tracks lifting it.
Near the ceiling, a profile’s share can move it. Adding a tier to an older profile grows that profile’s share, which can leave the newest bound profile out. Deleting a profile only ever brings refused ones back, oldest first.
With the dispatcher on, each admitted profile also gets a warm pool for each of its interactive tiers: a Deployment agentprofile-<profile>-<tier> in the profile namespace, running its warm worker pods plus one surge pod during a rollout. The profile quota budgets those pods. The pods hold the profile’s bus and broker tokens, and the operator copies the bus CA bundle beside them. A worker empties its writable directories after every task, so nothing one task leaves reaches the next. Turning the dispatcher off, or removing or refusing the profile, removes its pools.
The operator also copies the agent’s gitops state into the profile namespace, and each worker, pooled or in a Job, mounts it read-only at /etc/gitops. The copy holds only managed_repos, context_repos, gitops_repo and github_host, with any userinfo cut out of the repository URLs, and follows the source without restarting a pod. It and the CA bundle’s copy go when the last pool and Job template do.
How many warm pods a pool runs follows the route the operator resolved (spec.harness.tuning.defaultRoute). On session, every session pod hands its cluster reads to a profile as children, which run only on that pool. So there the profile’s pools run its concurrency pods, split over its interactive tiers (rounding up, at least one each) and held to the profile ceiling. The bound is per profile, so several profiles’ idle pools may together exceed the ceiling. Otherwise it runs 1. Setting spec.harness.tuning.profiles.warmReplicas sets every pool’s count on either route.
Status
Section titled “Status”AgentProfile fields → Status lists the status fields. The conditions carry the detail:
| Condition | Meaning |
|---|---|
IdentityReady condition |
The ServiceAccount and bus identity are rendered, or why not (NoPlatformAgent, MultiplePlatformAgents, InvalidProfile, ServiceAccountRefused, ServiceAccountNotFound, ProfileNamespaceAbsent, DispatcherCeiling, HarnessNotSupported, TierUnknown or TierModeConflict when no listed tier renders). |
TiersRendered condition |
Every listed tier renders (AllTiersRendered), or which don’t and why (TierUnknown, TierModeConflict). Its message names the tiers that render. |
CardPublished condition |
The agent card is on the directory, or why not (BusUnavailable, OperatorBusIdentityUnconfigured, IdentityNotRendered, BusConfigPending while the bus loads a new profile’s config, or the same mode and binding reasons as IdentityReady). DurableRecheck means a durable that existed can’t be found, and waits a pass before it’s re-created. |