For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Agent harness
Configure a Harness, the resource that defines which runtime executes an agent and what infrastructure it runs on.
Review configuration guidelines and reference for the Harness resource: every field it takes, the four runtimes it can select, and what each runtime supports. To understand a Harness and why an Agent, rather than the Harness itself, names the AgentTemplate that runs on it, see the core concepts.
Configure a Harness
The following configuration is for a complete Harness resource. Only workload, substrate, and one runtime block are required.
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: Harness
metadata:
name: my-harness
namespace: kagent
spec:
# Exactly one runtime block: kagent, codex, claude, or byo.
kagent: {}
workload:
image: ghcr.io/kagent-dev/kagent/golang-adk@sha256:ae01c3a6d7e0ed2e044253a26abbfb1a9426f3176363842ca9a954762c274d36
env:
- name: OTEL_BSP_SCHEDULE_DELAY
value: "2000"
substrate:
workerPoolRef:
name: kagent-default
snapshotPolicy:
location: s3://ate-snapshots/kagent/
EOFReview the following table to understand this configuration. For more information, see the API reference.
| Field | Required | Description |
|---|---|---|
One of kagent, codex, claude, byo | Yes | The runtime that executes the agent. Naming none, or more than one, is rejected. For the available runtimes, see Choose a runtime. |
workload.image | Yes | The runtime image, pinned by sha256 digest. A tag alone is rejected, because a revision must be reproducible. |
workload.command | For byo | Overrides the image entrypoint, up to 32 entries. Required for the byo runtime, optional otherwise. Every runtime honors an explicit value, the kagent runtime included, regardless of the language its image is written in. |
workload.args | No | Overrides the image arguments, up to 64 entries. An override that you omit stays unset rather than taking a default. |
env | No | Environment variables for the runtime, up to 100. Each entry sets a literal value, which is required and can be an empty string. The schema does not define a secret-backed source, so the API server rejects a credentialRef entry as an unknown field. Put credentials on a ModelConfig or a RemoteMCPServer instead. For more information, see About model providers. Note that the kagent installation’s settings, such as the runtime log level, come from the Helm chart’s config.runtimeDefaults block rather than from this setting. |
substrate.workerPoolRef.name | Yes | The WorkerPoolWorkerPoolA Kubernetes custom resource declaring how many Workers to keep running and which sandbox class they use. An operator must provision one before any Agent can compile.Learn more that this Harness’s Actors are scheduled onto. An operator must provision one before any agent can run. |
substrate.snapshotPolicy.location | Yes | The object storage location for Actor snapshotsSnapshotThe stored state that an Actor suspends to, held in object storage. Resuming restores the Actor from its most recent snapshot, which is what makes suspending idle agents cheap.Learn more. |
A Harness names no AgentTemplate. An AgentAgentA Kubernetes custom resource that pairs one AgentTemplate with one Harness. Each side takes either an inline spec or a reference to an existing resource, and the controller compiles the pair into a revision.Learn more pairs the two through spec.harnessRef, so whoever writes the Agent decides which template runs on which Harness. spec.harnessRef takes a reference only, so a Harness must exist before an Agent can name it. For more information about the pairing, see Core concepts.
A command or argument override belongs to the revision that kagent prepares. Changing one prepares a new revision rather than altering a running agent. A SessionSessionA running conversation with one Agent. Unlike the resources it is built from, a Session is not a Kubernetes resource: kagent's gRPC API creates it and its PostgreSQL database tracks it.Learn more pinned to an earlier revision keeps the command it was prepared with until it moves to the new one.
Choose a runtime
A Harness names exactly one of the following four runtimes, and that choice decides what executes an agent and how much of kagent’s feature set the agent can use.
| Runtime | What it runs | When to use it |
|---|---|---|
kagent | kagent’s own Go and Python engines | You want the full feature set: every model provider, agent-as-tool composition, skills, plugins, and long-term memory. |
codex | The Codex coding agent | You want Codex to do the work, and your model is OpenAI or an OpenAI-compatible Bedrock deployment. |
claude | The Claude coding agent | You want Claude to do the work, with Anthropic, Bedrock, or Anthropic on Vertex AI as the model. |
byo | Any container image of your own that implements kagent’s A2A contract | You have an agent framework kagent does not adapt, and you would rather bring the image than the integration. For more information, see Bring your own agent. |
The kagent and byo runtimes compile through the same path, so they accept the same model providers and the same AgentTemplate features, except structured output, which only the kagent runtime supports. The codex and claude runtimes are purpose-built adapters, and each accepts a narrower slice.
The agent chat in the kagent UI allows file attachments only on the kagent runtime, so an agent on a byo, codex, or claude Harness has no attachment option in the chat. For the file types and size limits that the UI enforces, see Attach files to a message.
Runtime-specific settings
spec.kagent is the only runtime block that takes settings of its own. The rest are empty.
spec:
kagent:
memory:
modelConfigRef:
name: embedding-model-config
ttlDays: 30| Field | Description |
|---|---|
memory.modelConfigRef.name | The ModelConfig supplying the embedding model, in the Harness’s namespace. Required when memory is set. |
memory.ttlDays | How many days a stored memory entry stays valid. Minimum 1. When omitted, the server applies a default of 15 days. |
Setting memory gives every agent on this Harness memory that persists across conversations. For how agents store and retrieve it, see Agent memory.
Setting compaction summarizes older session events so an agent’s prompt stays bounded as a conversation grows. For the two strategies and the rules the API server enforces, see Context management.
Codex and Claude examples
A codex or claude Harness has the same shape as a kagent one, and differs in the runtime block, the image, and the ModelConfigs that it accepts. For the providers and settings that each runtime accepts, see Model provider support, and for the limits each one places on an AgentTemplate, see Tool and skill support.
The ModelConfig reads its API key from the kagent-openai Secret that the OpenAI guide creates. The key must be entitled to the model that you name. A key without access to it fails the turn with Codex execution failed.
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: ModelConfig
metadata:
name: codex-model-config
namespace: kagent
spec:
apiKeySecret: kagent-openai
apiKeySecretKey: OPENAI_API_KEY
model: gpt-5.2-codex
provider: OpenAI
openAI:
apiFormat: responses
---
apiVersion: api.kagent.dev/v1alpha3
kind: Harness
metadata:
name: codex-harness
namespace: kagent
spec:
codex: {}
workload:
image: ghcr.io/kagent-dev/kagent/codex-harness@sha256:04788e85c9e1ef98b3f568b9aa749a5e16d2250d115449332dba98baa26305fa
substrate:
workerPoolRef:
name: kagent-default
snapshotPolicy:
location: s3://ate-snapshots/kagent/
---
apiVersion: api.kagent.dev/v1alpha3
kind: AgentTemplate
metadata:
name: codex-template
namespace: kagent
spec:
modelConfig:
name: codex-model-config
systemPrompt: You are a concise, helpful coding assistant.
---
apiVersion: api.kagent.dev/v1alpha3
kind: Agent
metadata:
name: codex-agent
namespace: kagent
spec:
template:
ref:
name: codex-template
harnessRef:
name: codex-harness
EOFModel provider support
The runtime that a Harness selects decides which ModelConfig an Agent that runs on it can use. This table covers every value that the ModelConfig provider field accepts, including the four that kagent 1.0 rejects on every runtime.
| Provider | kagent | byo | codex | claude |
|---|---|---|---|---|
OpenAI | ✅ | ✅ | ✅ | ❌ |
Anthropic | ✅ | ✅ | ❌ | ✅ |
Bedrock | ✅ | ✅ | ✅ | ✅ |
AnthropicVertexAI | ❌ | ❌ | ❌ | ❌ |
GeminiVertexAI | ❌ | ❌ | ❌ | ❌ |
AzureOpenAI | ✅ | ✅ | ❌ | ❌ |
Gemini | ✅ | ✅ | ❌ | ❌ |
Ollama | ✅ | ✅ | ❌ | ❌ |
SAPAICore | ❌ | ❌ | ❌ | ❌ |
Foundry | ✅ | ✅ | ❌ | ❌ |
Mistral | ❌ | ❌ | ❌ | ❌ |
kagent rejects AnthropicVertexAI, GeminiVertexAI, and SAPAICore on every runtime, because each authenticates with a credential that the egress gateway cannot place in an HTTP header. No agent can use these providers. For the alternatives, see About model providers.
kagent rejects Mistral for a different reason. The controller does not resolve the provider at all, so a Mistral ModelConfig reports unsupported model provider: Mistral.
Some supported combinations still carry restrictions.
| Combination | Restriction |
|---|---|
codex with OpenAI | Requires openAI.apiFormat: responses, and does not accept any other openAI setting beyond baseUrl. |
codex with Bedrock | Accepts only OpenAI gpt-* model IDs, and no bedrock settings beyond region. |
claude with Anthropic | Accepts no anthropic settings beyond baseUrl. |
claude with Bedrock | Accepts no bedrock settings beyond region. |
Bedrock on any runtime | The Secret must hold an AWS_BEARER_TOKEN_BEDROCK key. A Secret of IAM access keys is rejected, because IAM signs each request locally. |
Important
Neither codex nor claude accepts a ModelConfig that sets defaultHeaders, tls, or apiKeyPassthrough. Separately, every runtime rejects a credential that the egress gateway cannot place in an HTTP header, such as an IAM key pair or a Google service account key. For more information about that limitation, see About model providers.
Tool and skill support
The coding-agent runtimes also constrain what an AgentTemplate can ask for.
| Constraint | Applies to |
|---|---|
| A subagent binding cannot itself carry tools, skills, plugins, or nested agents, and must use the same provider and credentials as the agent that binds it. | codex, claude |
| An MCPMCPModel Context Protocol, an open protocol for exposing tools and resources to a model. kagent reaches an MCP server through a RemoteMCPServer resource, and an AgentTemplate binds individual tools from it.Learn more server is bound whole. Claude does not support partial tool selection, so the agent sees every tool the server offers rather than only the ones a binding names. The compiler warns rather than failing. | claude |
A RemoteMCPServer must use the STREAMABLE_HTTP protocol. SSE is rejected. | codex |
The kagent and byo runtimes take the full set. For more information about what an AgentTemplate can bind, see About tools.
Telemetry content settings
Tracing carries the prompts and replies that an agent exchanges with a model, and so does log export on the claude runtime. Two settings in the kagent Helm chart decide whether that content leaves the runtime, and each one reaches a different set of runtimes. Both default to false, and both take effect only where tracing or log export is already enabled.
config:
runtimeDefaults:
telemetry:
captureContent: false
captureRawApiBodies: false
maxCaptureBytes: 16384| Setting | What it includes | Applies to |
|---|---|---|
config.runtimeDefaults.telemetry.captureContent | Prompts and assistant replies in the runtime’s telemetry. On the kagent runtime, the content appears in the span for each model call. That runtime records a tool call’s arguments and reply on the span for the tool call instead, regardless of this setting. On the claude runtime, tool results require tracing, and assistant replies require log export through config.runtimeDefaults.telemetry.logs. | kagent, codex, claude |
config.runtimeDefaults.telemetry.captureRawApiBodies | The complete provider API request and response bodies. This setting returns more than captureContent does, and it takes effect only when you set the logs endpoint. | claude |
config.runtimeDefaults.telemetry.maxCaptureBytes | The budget for each captured prompt or reply, in bytes. Defaults to 16384, with a maximum of 65536. | codex, claude |
The controller sets OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT in every compiled runtime from config.runtimeDefaults.telemetry.captureContent, so a Harness cannot change the capture decision for itself. Naming that variable in the Harness spec.env field fails the claude and codex runtimes outright, and is discarded on the kagent runtime. For the rest of the variables that behave this way, see Controller-owned telemetry variables.
The controller compiles the telemetry environment into the byo runtime as well whenever any signal is enabled, so OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT reaches a byo image. The byo runtime is the exception to the ownership rule. The controller applies the Harness spec.env field after the telemetry environment, so a spec.env entry wins where the two name the same variable, and an image that exports to its own backend keeps doing so. Whether the image acts on either setting depends on its own instrumentation. For more information, see Tracing.
Controller-owned telemetry variables
The controller compiles an installation’s telemetry decisions into every runtime revision, so a Harness cannot override them through its spec.env field. The controller owns the following variables.
OTEL_SDK_DISABLEDandOTEL_SERVICE_NAMEOTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_PROTOCOL, andOTEL_EXPORTER_OTLP_TIMEOUTOTEL_TRACES_EXPORTER,OTEL_METRICS_EXPORTER, andOTEL_LOGS_EXPORTEROTEL_EXPORTER_OTLP_<SIGNAL>_ENDPOINTandOTEL_EXPORTER_OTLP_<SIGNAL>_PROTOCOL, where<SIGNAL>isTRACES,METRICS, orLOGSOTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT
A runtime that meets one of these names in spec.env either refuses the Harness or discards the entry, as described in the following table.
| Runtime | Result of naming a controller-owned variable in spec.env |
|---|---|
claude | Every Agent on the Harness reports Compatible as False, and the controller reports Harness env "<name>" conflicts with Claude-owned runtime configuration. |
codex | Every Agent on the Harness reports Compatible as False, and the controller reports Harness env "<name>" conflicts with Codex's compiled configuration. |
kagent | The entry is dropped and the controller’s own value is compiled in its place. No error is reported. |
Two further variables fall outside that table:
OTEL_RESOURCE_ATTRIBUTESis merged rather than refused. The value inspec.envis kept, and the agent identity attributes that the controller adds win where the two name the same attribute.OTEL_EXPORTER_OTLP_HEADERSis neither owned nor rendered. No Helm setting produces it, so the controller never adds it to a runtime, but a value in the Harnessspec.envfield reaches every runtime unchanged. To attach headers without holding them in an Actor environment, export to an in-cluster collector that adds them.
Every other OTEL_* variable, such as the OTEL_BSP_* batch span processor settings, stays available for per-Harness tuning.
Baggage propagation
Baggage is a W3C header that travels with a request alongside its trace context. Each entry in that header is a member, which pairs a name with a string value. Every service that the request reaches can read the members that it carries.
When the environment leaves OTEL_PROPAGATORS unset, kagent runtimes set it to tracecontext. A caller’s baggage does not reach the tools that an agent calls or the agent’s model provider, but trace context still propagates. To carry baggage as well, set OTEL_PROPAGATORS to tracecontext,baggage in the Harness spec.env field. The kagent controller reads its own value only from the controller.env Helm value, so enabling baggage on a runtime does not enable it on the kagent controller.
OTEL_PROPAGATORS is a list of wire formats that apply to both incoming and outgoing requests. If an incoming request has a format that is not in the list, the format is not read. Similarly, the runtime does not write an omitted format to an outgoing one. When the list omits baggage, the runtime’s own members are dropped too.
When baggage is listed, the kagent runtime adds the request’s identity to the baggage of each model call and each MCP tool call.
| Member | Model calls | MCP tool calls |
|---|---|---|
gen_ai.agent.name | Yes | Yes |
gen_ai.conversation.id | Yes | Yes |
a2a.task.id | Yes | Yes |
gen_ai.tool.call.id | No | Yes |
These members serve as identifiers only, and the runtime can replace a caller’s member of the same name.
Warning
Enabling baggage sends the caller’s own members to your model provider. A caller baggage member that kagent does not replace is forwarded unchanged in the baggage header of each model API request and each MCP request. This means that a caller controls what reaches those external services in the header. Enable baggage only where you trust what your callers attach.
Review and plan for the following considerations.
- The
claudeandcodexruntimes receiveOTEL_PROPAGATORS, but kagent does not add identity to their model and tool calls. The Python runtime does not add any either, so the four members reach thekagentruntime alone. - kagent never copies a baggage member onto a span. To make these values searchable, add a baggage-to-attributes span processor to the service that receives the request or to its OpenTelemetry Collector.
When an agent requires an MCP server, the first tool listing or tool call opens a session with the MCP server, and every later request to that server shares it. The session makes three requests: the event stream, the replies to server requests, and the close. These requests do not carry trace context or baggage, because these name a request that has already ended.
Check that a Harness is ready
The READY column reports whether a Harness’s dependencies resolved.
kubectl get harness -n kagentA Harness that is not Ready most often names a WorkerPool that does not exist yet. For the specific reason, read its conditions with kubectl describe harness <harness-name> -n kagent.
Ready covers the Harness’s own dependencies, not whether a given agent runs on it. Whether a template compiles against this Harness is reported on the Agent that pairs the two, because an AgentTemplate does not report status of its own. For that check and the conditions it reports, see Your first agent.