kagent

How to Troubleshoot Agent Substrate with kagent: A Field Guide#

When you troubleshoot Agent Substrate with kagent, the first problem is usually finding the error at all. In kagent 1.x, every agent runs on Agent Substrate. Agent Substrate runs each conversation as an Actor inside a gVisor or micro-VM sandbox. It suspends that Actor to object storage between turns, and it blocks all outbound traffic unless a policy allows it. These defaults make agents safe to run, but they also hide failures. Some failures look healthy, and others look like a different problem entirely.

Here are four failures that confuse people the first time they see them:

  • A Harness with a typo and a Harness that works look the same in kubectl get.
  • A WorkerPool that is too small produces a request timed out error and logs nothing about capacity.
  • A sandbox that is blocked from reaching pypi.org reports a DNS error, not a 403.
  • An edit to an AgentTemplate does nothing in the conversation you're testing with.

Each symptom below comes with its cause and the command that confirms it. If you haven't installed Agent Substrate yet, start with Install Agent Substrate on Any Kubernetes Cluster or Install Agent Substrate in One Command with the kagent CLI.

Key takeaways#

  • Check the Agent, not the Harness. Harnesses and AgentTemplates report no status. Their health shows up only in the conditions of an Agent that references them.
  • Read the first False condition that isn't Blocked. Every condition after it is a consequence.
  • A generic request timed out is often a full WorkerPool. Check the pool's READY count and its capacity before anything else.
  • A SandboxTemplate needs a guest image. The chart doesn't set config.sandboxes.guestImage, so no template becomes ready until you do.
  • A DNS error inside a sandbox usually means a missing egress policy. Check EgressPoliciesApplied and the atenet-egress log before you debug DNS.
  • Sessions and Sandboxes keep their original revision, so start a new one to pick up an edit.

In this guide#

  1. A 60-second refresher
  2. Where status lives
  3. Troubleshoot kagent Harness and Agent errors
  4. Troubleshoot WorkerPools, Actors, and timeouts
  5. Troubleshoot SandboxTemplates
  6. Troubleshoot kagent Sandboxes
  7. Troubleshoot egress policies
  8. Collect evidence
  9. Cheat sheet and FAQ

A 60-second refresher: what you're actually debugging#

Two different sets of resources can run code on Agent Substrate. The two sets have different lifecycles and different status surfaces.

The agent path uses three resources:

  • Harness: Sets what runs the agent loop (kagent, claude, codex, or byo), which image it uses, which WorkerPool it runs on, and where its snapshots go.
  • AgentTemplate: Holds the agent's behavior: the system prompt, the ModelConfig, and the tools and skills.
  • Agent: Pairs one AgentTemplate with one Harness. It is the only one of the three that reports a status.

The sandbox path uses two resources:

  • SandboxTemplate: Holds the tools image (pinned by digest), the WorkerPool, the snapshot location, and any egressPolicyRefs. It has its own Ready condition.
  • Sandbox: A scratch environment that a person, an application, or an agent creates from a template through the CLI, gRPC, or the kagent MCP server. It has no harness, no model, and no conversation. It reports a state and an operation through the API, not through kubectl.

For a deeper look at how these pieces fit together, see Kagent and Agent Substrate: Running AI Agent Sandboxes on Kubernetes. Both paths need a working WorkerPool, snapshot storage, and the egress gateway. Most of the problems in this post come from those three shared pieces.

Before you debug: where status lives#

ResourceWhere its health is reported
Harness, AgentTemplateNowhere on the resource itself. Read the conditions of every Agent that references it.
Agentstatus.conditions (Accepted, ResolvedRefs, Compatible, Ready), plus EgressPoliciesApplied, status.warnings, and the revision fields.
SandboxTemplatestatus.conditions: Ready (with reason Preparing, Prepared, or ActorTemplateRetrying) and EgressPoliciesApplied.
Sandboxstate and operation, from kagent sandbox get or GetSandbox.
Actors, WorkersThe controller's SystemService gRPC API (GetSubstrateSummary, ListSubstrateActors, ListSubstrateWorkers).
Denied egressThe agentgateway container log of atenet-egress in ate-system.
Everything elsekagent-controller logs, which include one rpc completed line per API call, with its grpc_code.

Keep this condition dump handy. You'll use it more than any other command in this post:

kubectl get agent <name> -n kagent \
-o jsonpath='{range .status.conditions[*]}{.type}{"="}{.status}{" "}{.reason}{": "}{.message}{"\n"}{end}'

Most of the deeper checks go through the controller's gRPC API, so start a port-forward in a second terminal. The API needs config.server.grpcReflection=true for grpcurl to discover its methods.

kubectl port-forward -n kagent svc/kagent-controller 8083:8083

Rule #1: read the first False that isn't Blocked#

The four Agent conditions form a pipeline. Each condition is evaluated only when the one before it is True.

ConditionWhat it checks
AcceptedThat the Agent selects a template and a Harness. kagent always sets it to True.
ResolvedRefsThat the AgentTemplate, Harness, ModelConfig, tool servers, and the Harness's WorkerPool all exist.
CompatibleThat the Harness accepts the resolved configuration.
ReadyThat the golden snapshot of the generated ActorTemplate exists.

When one stage fails, kagent sets every later stage to False with the reason Blocked. Only the first failure describes the real problem:

Accepted=True Accepted: Agent explicitly selects its template and harness
ResolvedRefs=False ReferenceResolutionFailed: resolve ModelConfig "does-not-exist": not found
Compatible=False Blocked: blocked by ResolvedRefs
Ready=False Blocked: blocked by ResolvedRefs

In this example, the ModelConfig is the only problem. Don't spend time on the two conditions that follow it.

Here's what the pipeline looks like on a real cluster. The first capture is a healthy Agent, and the second is an Agent whose AgentTemplate names a ModelConfig that doesn't exist:

A healthy kagent Agent with Accepted, EgressPoliciesApplied, ResolvedRefs, Compatible, and Ready all True
A kagent Agent with ResolvedRefs False because a ModelConfig is missing, and Compatible and Ready Blocked

Part 1: Troubleshoot kagent Harness and Agent errors#

"My Harness looks fine but nothing works"#

A Harness has no status, so a broken Harness and a working one look the same:

$ kubectl get harness -n kagent
NAME AGE
claude-harness 5m

You find out whether a Harness works only by reading the conditions of an Agent that uses it. If no Agent references the Harness, the controller never checks it. The same is true of an AgentTemplate. A template that no Agent references is never prepared, and when you try to use it you get this error:

ERROR:
Code: FailedPrecondition
Message: Agent does not have a ready prepared revision

In the following capture, the bad-env and crash Harnesses are both broken. Only the Agent list shows it.

kubectl get harness shows no status column, so the broken bad-env and crash Harnesses look the same as working ones, while kubectl get agents shows READY False

Fix: List which Agents reference which templates and Harnesses, and create an Agent for any template that has none:

kubectl get agents -n kagent \
-o jsonpath='{range .items[*]}{.metadata.name}{" template="}{.spec.template.ref.name}{" harness="}{.spec.harnessRef.name}{"\n"}{end}'

ResolvedRefs=False with WorkerPoolNotFound#

This is the most common failure on a new Harness. spec.substrate.workerPoolRef.name must name a WorkerPool in the same namespace as the Harness. If you created a Harness in a new namespace, such as team-a, and pointed it at kagent-default, the reference fails because kagent-default exists only in kagent.

kubectl get workerpools -A
Agent with ResolvedRefs False and reason WorkerPoolNotFound because the Harness is in a namespace that has no WorkerPool

Fix: Point the Harness at a pool that exists in its own namespace, or create one. If you manage the pool yourself instead of through the chart, it must carry both placement labels kagent.dev/worker-pool-name and kagent.dev/worker-pool-namespace, with values that match its own name and namespace.

Compatible=False: the Harness doesn't support what you asked for#

The claude, codex, and byo harnesses each run their own agent loop, so each one supports less than the built-in kagent harness. These are the messages you'll see most often:

Message (or symptom)CauseFix
Harness runtime "<name>" does not support structured outputThe AgentTemplate requests structured output on a claude, codex, or byo harness.Use the kagent harness, or remove the structured output setting.
Harness env "<name>" conflicts with Claude-owned runtime configurationThe Harness spec.env sets a variable that the Claude adapter reserves, such as ANTHROPIC_API_KEY or CLAUDE_CONFIG_DIR.Remove it. Put credentials in the ModelConfig.
Harness env "<name>" conflicts with Codex's compiled configurationThe same problem on codex, with a variable such as OPENAI_API_KEY, CODEX_HOME, or one of the AWS_* credential variables.Remove it.
runtime environment "<name>" conflicts with gateway trustAny harness sets SSL_CERT_FILE, REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS, or another certificate-trust variable.Remove it. The egress gateway intercepts TLS, so kagent sets these variables itself.
runtime revision has <n> environment variables; Substrate supports at most 32kagent adds its own variables to every revision, and the total, including yours, is over 32.Remove some spec.env entries.
A codex agent fails every turn with Codex execution failedThe ModelConfig doesn't set openAI.apiFormat: responses, or the API key isn't entitled to the model.Set apiFormat: responses and check that the key has access to the model.
A codex agent is rejected for its MCP serverThe RemoteMCPServer uses SSE.Codex supports only STREAMABLE_HTTP.
A Vertex AI or SAP AI Core ModelConfig is rejectedThese providers authenticate with a mounted file or an OAuth exchange, which the egress gateway can't inject.Use a provider that authenticates with a header. For Bedrock, use an AWS_BEARER_TOKEN_BEDROCK Secret, not IAM access keys.

Here's the reserved-variable case on a real cluster. Setting SSL_CERT_FILE on a kagent Harness fails at the Compatible stage:

Agent with Compatible False and reason ActorTemplateInvalid because the Harness sets the reserved SSL_CERT_FILE variable

Also check status.warnings. A warning doesn't stop an Agent from becoming ready, but it records a choice kagent made for you. The most common one is that the Claude harness binds every tool on an MCP server, because Claude doesn't support selecting only some of them:

kubectl get agent <name> -n kagent -o jsonpath='{.status.warnings}'

Ready=False with ActorTemplateRetrying#

The references resolved and the configuration is compatible, but Agent Substrate couldn't build the golden snapshot. kagent retries the build after about 15 seconds, 1 minute, and 4 minutes, and then about every 10 minutes indefinitely. The condition message deliberately leaves out the underlying error, because that error can quote your configuration:

Ready=False ActorTemplateRetrying: golden build failed (GoldenActorCrashed), retry 1 at 2026-11-18T21:05:03Z

To see the full error, read the controller log:

kubectl logs -n kagent deploy/kagent-controller | grep "golden build failed"

Here's a real example. The Harness runs a byo image (BusyBox running /bin/false) that exits right away. The condition says only GoldenActorCrashed. The controller log shows the cause: the container never answered its readiness probe.

Agent Ready False with ActorTemplateRetrying, and the controller log showing the container never answered its readiness probe

The usual causes are:

  • Image pull failures. The Workers can't pull workload.image. If the image is in a private registry, make sure the WorkerPool's ServiceAccount has the pull secrets. The chart adds imagePullSecrets only to a ServiceAccount that it creates.
  • A tag without a digest. The API server rejects workload.image unless it's pinned with @sha256:. If you see a schema error when you apply the resource, this is the cause.
  • A byo image without workload.command. kagent can't infer the entrypoint of an image it didn't build.
  • An image that crashes on startup. For byo, check that your image implements kagent's A2A contract and doesn't exit right away.

If a configuration fault causes the failure, kagent keeps retrying until you edit the Agent or the Harness, so waiting won't help.

"I edited the AgentTemplate and nothing changed"#

There are two possible causes, and the Agent shows you which one applies:

kubectl get agent <name> -n kagent \
-o jsonpath='{"desired="}{.status.desiredRevision}{" latestSuccessful="}{.status.latestSuccessfulRevision}{"\n"}'
  • The values differ. Your edit produced a new revision that isn't ready yet. Read the conditions to find out why.
  • The values match. This is expected behavior: a Session runs the revision it was created from for its entire life. Start a new Session to pick up your edit. The same rule applies when you change a RemoteMCPServer.

Part 2: Troubleshoot WorkerPools, Actors, and timeouts#

actor "..." request timed out#

ERROR:
Code: Internal
Message: actor "ai-01a087c0-1d72-775a-9a32-566acac7b685" request timed out

This error doesn't tell you its cause. Check the following possibilities in order.

1. Is the WorkerPool healthy and large enough? An undersized pool produces exactly this error, and no component logs a capacity message.

kubectl get workerpools -n kagent
NAME DESIRED REPLICAS READY SANDBOXCONFIG RESOLVED AGE
kagent-default 1 1 1 gvisor-default True 3h
kubectl get workerpools with matching DESIRED, REPLICAS, and READY counts, and GetSubstrateSummary showing one Actor in ACTOR_STATE_CRASHED

To read this output:

  • A gap between DESIRED and REPLICAS means the controller isn't creating Worker pods.
  • A gap between REPLICAS and READY means the pods exist but aren't starting. Check the Worker image and the sandbox class, which are covered later in this post.
  • If all three numbers match, compare them with your load. Size the pool for the number of turns that run at the same time, not for the number of Sessions. kagent suspends Actors between turns, so an idle Session uses no Worker capacity. Under mild pressure, a pool still serves most requests and only drops the ones that wait too long, so you see intermittent timeouts when concurrency rises. To confirm, watch Agent Substrate's at_capacity Worker state and its no_capacity placement outcomes. To scale the pool:
kubectl scale workerpool kagent-default -n kagent --replicas=4

Sandboxes fail differently. When a pool has no ready Workers at all, kagent sandbox create fails immediately with a generic Unavailable error instead of waiting and timing out. The error doesn't mention capacity either:

A WorkerPool scaled to zero Workers, and kagent sandbox create failing with Unavailable: Sandbox operation failed

2. Is the model provider slow or unreachable? A turn that waits on the model times out the same way. The agent's own log names the provider error.

3. Is the Actor stuck? An Actor in ACTOR_STATE_RESUMING or ACTOR_STATE_CRASHED never answers:

grpcurl -plaintext -d '{"atespace":"kagent"}' \
localhost:8083 kagent.api.v1.SystemService/ListSubstrateActors \
| jq '.actors[] | {name: .metadata.name, state: .status.state}'

For a quick overview of the whole runtime, run GetSubstrateSummary. It counts Actors by state for each pool:

grpcurl -plaintext -d '{"namespace":"kagent","atespace":"kagent"}' \
localhost:8083 kagent.api.v1.SystemService/GetSubstrateSummary \
| jq '{actorCount, workerCount, actorStatusCounts}'

Workers never become ready: sandbox class mismatch#

A pool's sandboxClass, its workerImage, and the cluster's SandboxConfig must all name the same class. Each kind of mismatch fails in a different way:

What disagreesWhat you see
The Worker image was built for another class, for example ateworker-gvisor in a microvm poolThe Workers never register, so READY stays below REPLICAS.
The SandboxConfig is missingThe pool's Resolved condition is False, with the reason SandboxConfigNotFound or DefaultConfigNotFound. A default install creates only gvisor-default.
The ActorTemplate's class doesn't match the poolRevisionInvalid with unsupported sandbox class "<value>", and placement fails with WorkerPoolNotFound.
kubectl get sandboxconfigs
kubectl get workerpools -n kagent -o yaml | grep -A5 sandboxClasses

Two more things to know about sandbox classes:

  • Snapshots can't move between classes. If you change the class of a pool that hosts live Actors, those Actors lose their state.
  • gVisor nodes download their runtime files from a public Google Cloud Storage URL that the SandboxConfig names. In an air-gapped or egress-restricted cluster, Workers fail until you allow that URL or host your own copy of the files.

Sessions suspend but never resume: snapshot storage#

Agent Substrate writes every suspended Actor to object storage. If that storage is broken, the first turn of a Session works and the second one fails. Snapshot storage is configured in two places that must agree:

  1. In the Agent Substrate Helm values: atelet.storageBackend in the substrate release, and objectStore in the substrate-atelet release.
  2. In each Harness and SandboxTemplate: spec.substrate.snapshotPolicy.location.

If they don't agree, for example when the backend uses your S3 bucket but a Harness still points at s3://ate-snapshots/..., Actors suspend and then can't resume. To check, send a message, then read where the snapshot was written:

grpcurl -plaintext -d '{"atespace":"kagent"}' \
localhost:8083 kagent.api.v1.SystemService/ListSubstrateActors \
| jq '.actors[] | {name: .metadata.name, state: .status.state, snapshotUri: .status.snapshots[-1].durableSnapshot.object.snapshotUri}'

If snapshots don't get written at all, check the objectstore-plugin sidecar on the atelet DaemonSet and the ate-api-server Deployment. That sidecar is the only container that reads the storage variables: ATE_STORAGE_BACKEND, AWS_REGION, AWS_ENDPOINT_URL, AWS_S3_USE_PATH_STYLE, and the credentials. Two mistakes are common:

  • Setting ATE_STORAGE_BACKEND directly on the main container, which stops that container from starting.
  • Putting S3-compatible endpoint settings in atelet.extraEnv instead of objectStorePlugin.extraEnv. The atelet container doesn't read storage settings, so the change has no effect.

Part 3: Troubleshoot SandboxTemplates#

SandboxTemplates fail in different ways from Agents. For background on why kagent's sandboxes are built this way, read Not All Agent Sandboxes Are Created Equally.

The template is stuck in Preparing or ActorTemplateRetrying#

kubectl get sandboxtemplate python -n kagent \
-o jsonpath='{range .status.conditions[?(@.type=="Ready")]}{.status} {.reason} {.message}{end}'

The healthy result is True Prepared Sandbox runtime is prepared. The first preparation can take about a minute while a Worker pulls the image. If the template stays in ActorTemplateRetrying, these are the usual causes, from most to least common:

  1. No guest image is configured. This is the most common failure for new users. The chart doesn't ship a default config.sandboxes.guestImage, so no SandboxTemplate becomes ready until you set one. The guest image supplies kagent's process and file service. Your tools image can't replace it.

    config:
    sandboxes:
    guestImage: ghcr.io/kagent-dev/kagent/sandbox-guest@sha256:<digest-for-your-release>
    cpu: "1"
    memory: 1Gi
    defaultTtl: 3600s
    maxTtl: 86400s

    Check the current value with helm get values kagent -n kagent --all -o json | jq '.config.sandboxes'.

  2. The Workers can't pull the tools image. This happens when the image is in a private registry and the pool's ServiceAccount doesn't have the pull secrets.

  3. The image reference has no digest. The API server rejects it with spec.workload.image in body should match '^[^[:space:]@]+@sha256:[a-f0-9]{64}$'. For a multi-architecture image, use the digest of the image index:

    docker buildx imagetools inspect python:3.13-slim --format '{{json .Manifest.Digest}}'
    kubectl apply rejects a SandboxTemplate whose image uses a tag without a sha256 digest

To see the full error, use the same command as for Agents: kubectl logs -n kagent deploy/kagent-controller | grep "golden build failed".

The template is Ready, but the sandbox can't do anything useful#

These problems come from the tools image, not from kagent:

SymptomCause
Your image's ENTRYPOINT or CMD never runskagent replaces the entrypoint with its guest program. A SandboxTemplate has no startup command, so start processes with exec or start_sandbox_process.
Files you put under /data in the image are missingkagent mounts a durable volume at /data, which hides those files. Install tools under /opt or /usr/local instead.
The Sandbox never becomes ready when the image runs as a non-root userThe guest creates /data/workspace and /data/guest-logs, so the image's user must be able to write to /data.
pip install, npm install, or git clone failsOutbound traffic is blocked by default. See Part 5.
A credential in env is rejected as an unknown fieldSandboxTemplate env accepts only literal values. Inject credentials at the egress gateway with an EgressPolicy instead.

"I edited the template but my Sandbox didn't change"#

This is the same rule that applies to Sessions. Each Sandbox stays on the revision it was created from. An edit to the template affects only Sandboxes that you create afterward. If the new revision fails to prepare, new Sandboxes keep using the last revision that succeeded, so a broken edit doesn't take anything down, but it isn't applied either. Read the Ready condition to find out why.

Deleting a template stops new Sandboxes from being created from it. Existing Sandboxes keep running until you delete them or they expire.

Part 4: Troubleshoot kagent Sandboxes#

FailedPrecondition: Sandbox is not ready or has expired#

Error: start process in sandbox 01a1f073-...: command may have started; do not blindly retry:
rpc error: code = FailedPrecondition desc = Sandbox is not ready or has expired

A Sandbox accepts process and file operations only when state is RUNTIME_STATE_READY and operation is RUNTIME_OPERATION_NONE. Check both:

kagent sandbox get $SANDBOX_ID

There are three usual causes:

  • The Sandbox is suspended. kagent never resumes a Sandbox automatically. Run kagent sandbox resume $SANDBOX_ID.
  • The Sandbox expired. Every Sandbox has a fixed expires_at. Running commands doesn't extend it, and neither does a resume. The default lifetime is one hour and the maximum is 24 hours. Copy your results out before the Sandbox expires.
  • A lifecycle operation is still pending. Each lifecycle call makes one attempt. If that attempt hits a temporary error, the change stays pending, and only repeating the same call continues it. GetSandbox and ListSandboxes only read state and never move pending work forward.

Duplicate Sandboxes, AlreadyExists, or FailedPrecondition on create#

CreateSandbox deduplicates requests by request_id:

RequestResult
Same request_id and same inputReturns the same Sandbox. This is the safe way to retry.
Same request_id with different inputAlreadyExists: request_id was used for different input.
request_id of a Sandbox that was deleted or expiredFailedPrecondition. A new display name doesn't help. Generate a new ID.
New request_idCreates a new Sandbox. If you generate a new ID on every retry, you get a new Sandbox each time.
kagent sandbox create returning the same Sandbox on retry, AlreadyExists for different input, and FailedPrecondition after the Sandbox is deleted

Agents cause this problem most often. If the system prompt doesn't tell the model to reuse its request_id, the model can create a new Sandbox on every attempt and leave each one running until it expires. Name the template in the prompt, tell the model to retry with the same request_id, tell it to always call delete_sandbox, and set a short ttl_seconds so that any Sandbox the model forgets to delete doesn't run for long.

"My files and processes are gone after resume"#

This is expected behavior. A suspend saves only /data, using a Data-scope snapshot.

WhatKept across suspend and resume?
Files under /data, including the default working directory /data/workspaceYes
Files anywhere else, such as /tmpNo
Running processes and their IDsNo. An old process ID returns process ... not found.

Here's the whole sequence on a real Sandbox. The file in /data/workspace survives, the file in /tmp doesn't, and a process ID from before the suspend is gone:

A Sandbox suspended and resumed: exec fails with FailedPrecondition while suspended, the /data file survives, the /tmp file and the old process are gone

A suspend also doesn't wait for running work to finish, so a command or file write can be cut off partway through. Suspend a Sandbox only when you can repeat whatever it was running.

kagent sandbox list is empty, but the agent created Sandboxes#

Each Sandbox belongs to the identity that created it, and a list returns only the caller's own Sandboxes. An agent creates Sandboxes under the identity of its MCP connection, not under the identity of the person it's talking to. In the default insecure auth mode, the agent and the CLI share one default identity, so you see the agent's Sandboxes. When authentication is on, you don't. A Session share token never grants access to a Sandbox.

To have an agent create Sandboxes as the user who invoked it, turn on token propagation:

config:
runtimeDefaults:
tokenPropagation:
enabled: true

This setting forwards the caller's credentials to every MCP server that agents on the kagent harness call, not only to kagent-api. Turn it on only if you trust all of those servers with your users' tokens.

The agent has no sandbox tools#

The chart installs a RemoteMCPServer named kagent-api in the controller's namespace. An AgentTemplate can reference only an MCP server in its own namespace, so an agent in another namespace needs its own RemoteMCPServer that points at http://kagent-controller.kagent.svc.cluster.local:8083/mcp.

kubectl get remotemcpserver kagent-api -n kagent

If the server is accepted and the tools are still missing, check the agent's runtime log. When an MCP server doesn't answer, kagent drops that server's tools for the current execution and logs a warning instead of failing the turn:

kubectl logs -n kagent -l ate.dev/worker-pool=kagent-default --tail=-1 | grep "omitting toolset"

Also check the binding's mcp.tools list. A tool that isn't in the list never reaches the model.

Sandbox MCP tool calls fail on large files#

The MCP tools pass data through the model's context, so their limits are much smaller than the CLI's or the gRPC API's:

InterfaceLimit
write_sandbox_file, read_sandbox_outputs1 MiB per call, base64-encoded. A write replaces the whole file and can't append.
read_sandbox_file (text)2,000 lines or 32 KiB per page
kagent sandbox upload/download, gRPC FileSystemService64 MiB per file, streamed

Two other points about MCP tool calls:

  • A failed MCP tool call can return HTTP 200 with isError: true. If your client reads only structuredContent, it never sees the error.
  • Models often produce invalid base64 for data_base64. A good agent recovers by running python3 -c "..." directly, so don't treat one failed write as a broken tool.

gRPC: exactly one kagent-sandbox-id metadata value is required#

The process and file services (ateenv.v1alpha.ProcessService and FileSystemService) use the Agent Substrate guest protocol unchanged. They select the Sandbox from a metadata header, not from a request field:

grpcurl -plaintext -H "kagent-sandbox-id: $SANDBOX_ID" \
-d '{"command":["python3","--version"]}' \
localhost:8083 ateenv.v1alpha.ProcessService/StartProcess

StartProcess has no request ID. If a start call times out, the process might still have started, so call GetProcess before you start it again.

Part 5: Troubleshoot egress policies: the DNS error that isn't DNS#

Agent Substrate blocks all outbound traffic unless a policy allows it. Inside a Session or a Sandbox, a host that no policy allows doesn't resolve, so the failure looks like a DNS problem:

ClientWhat a blocked host looks like
curlCould not resolve host, exit code 6
PythonName or service not known
BusyBox wgetbad address
Plain HTTP to an IP address403 Forbidden
HTTPS to an IP addressTLS handshake failure
Inside a Sandbox, a request to pypi.org fails with Name or service not known, and a plain HTTP request to an IP address gets 403 Forbidden

Don't start by debugging CoreDNS. Check the policy first. If you prefer the UI to YAML, the Policies page walkthrough shows how to create and attach an EgressPolicy from the browser. For a worked example of one agent with one narrow policy, see Build a CVE Agent with kagent and Agent Substrate in a Secure Sandbox.

Step 1: Did kagent admit the grant? The EgressPoliciesApplied condition is separate from Ready. An Agent or SandboxTemplate with a missing policy still reports Ready=True, and the UI doesn't show it as failed.

kubectl get sandboxtemplate python -n kagent \
-o jsonpath='{range .status.conditions[?(@.type=="EgressPoliciesApplied")]}{.status} {.reason} {.message}{end}'
A SandboxTemplate reporting Ready True while EgressPoliciesApplied is False because the allow-pypi EgressPolicy does not exist yet
ReasonMeaning
EgressPolicyNotFoundThe policy doesn't exist in the template's or Agent's namespace, or it's being deleted.
InvalidEgressPolicyA policy, a Secret reference, or the egressPolicyRefs list is invalid. One invalid name in the list, such as Node-Deps, revokes every grant in that list.
EgressGrantConflictTwo policies set different credentials for the same origin and header, a grant adds a credential to an origin that a model or tool already sets one for, or the compiled policy is over 256 rules.

Step 2: What did the gateway actually see? The gateway logs every request, allowed or denied:

kubectl logs -n ate-system deploy/atenet-egress -c agentgateway --tail=100
atenet-egress log showing a 403 with reason Authorization for a request to an IP address, and an allowed 200 request to files.pythonhosted.org

reason=Authorization means a policy denied the request. http.host is the host the Actor tried to reach. A 503 is different: it means the gateway couldn't reach its control plane or a credential provider. That's an installation problem, not a denied request.

Step 3: Check the problems that catch most people:

  • Redirects. Package registries often serve downloads from a different host. For example, pypi.org sends downloads to files.pythonhosted.org. Allow both. The following capture shows pip install failing with only pypi.org allowed, then succeeding after the second origin is added to the same policy, without recreating the Sandbox:

    pip install failing to resolve files.pythonhosted.org when only pypi.org is allowed, then succeeding after the origin is added
  • Wildcards. https://*.example.com matches api.example.com, but not example.com or a.b.example.com. A wildcard origin can't carry a credential.

  • Origins. An origin is a scheme, a host, and a port only. The API server rejects paths, queries, and IP addresses.

  • Credentials. EgressPoliciesApplied=True means the Secret and key exist, not that the value is valid. An empty Secret value produces a 503 from the gateway. A request that doesn't send the placeholder header is forwarded without the credential instead of being denied.

  • When changes apply. Policy changes apply to running and suspended Sandboxes without recreating them. For agents, starting a new Session is still the most reliable way to confirm a change.

Part 6: Collect evidence#

If none of the previous checks explains the problem, collect evidence in this order.

Find the failing call in the controller log. Every API call is logged with its gRPC code:

kubectl logs -n kagent deployment/kagent-controller | grep '"rpc completed"' | grep -v '"grpc_code":"OK"'
kagent controller log lines for rpc completed calls with grpc_code NotFound, AlreadyExists, and Unavailable

To get more detail, raise the log level with config.logging.level: debug in your Helm values.

After an upgrade, read the previous container. A failed database migration crash-loops the controller, so the current container's log never shows the error:

kubectl logs -n kagent deployment/kagent-controller --previous | grep -i migration

Check that Agent Substrate itself is healthy. If Agent Substrate isn't ready when kagent starts, the kagent controller can crash-loop. Fix ate-system first:

kubectl get pods -n ate-system

Collect a bug report. A bug report covers kagent's own resources but not the Agent Substrate resources underneath them, so add those yourself:

kagent bug-report -n kagent
kubectl get workerpools,sandboxconfigs -n kagent -o yaml > substrate-resources.yaml

Cheat sheet#

SymptomFirst thing to check
Harness or AgentTemplate looks fine but doesn't workThe conditions of an Agent that references it
Agent does not have a ready prepared revisionNo Agent references the template, or Ready=False
WorkerPoolNotFoundThe pool must be in the Harness's namespace
Compatible=FalseReserved env variables, provider support, or structured output on a non-kagent harness
ActorTemplateRetryingkubectl logs deploy/kagent-controller | grep "golden build failed"
Edit has no effectdesiredRevision vs. latestSuccessfulRevision, then start a new Session or Sandbox
request timed outWorkerPool READY and capacity, then the model provider, then the Actor state
Second turn failsSnapshot backend vs. snapshotPolicy.location
SandboxTemplate never readyconfig.sandboxes.guestImage is set
Sandbox is not ready or has expiredSuspended (resume it), expired, or a pending operation (repeat the call)
Files gone after resumeOnly /data is kept
Can't see the agent's SandboxesIdentity of the MCP connection, or turn on token propagation
Could not resolve host inside a sandboxEgressPoliciesApplied, then the atenet-egress log

FAQ#

Why does my kagent Harness show no status?#

A Harness and an AgentTemplate have no status field. kagent checks them only when an Agent references them, and it reports the result in that Agent's conditions. Run kubectl get agent <name> -n kagent -o yaml and read status.conditions.

Why does my kagent agent time out with request timed out?#

The most common cause is a WorkerPool without enough ready Workers. Agent Substrate doesn't log a capacity error, so the turn waits and then times out. Check kubectl get workerpools -n kagent, then check the model provider and the Actor state.

Why is my SandboxTemplate never ready?#

Usually because config.sandboxes.guestImage isn't set in the kagent Helm values. The chart ships no default guest image. Other causes are a tools image that isn't pinned by digest and an image that the Workers can't pull.

Why can't my sandbox reach the internet?#

Agent Substrate blocks all outbound traffic by default, and a blocked host fails to resolve, so it looks like a DNS error. Attach an EgressPolicy that allows the host to the SandboxTemplate's egressPolicyRefs, then check the EgressPoliciesApplied condition.

Which files survive when a kagent Sandbox is suspended?#

Only files under /data, which includes the default working directory /data/workspace. Files elsewhere and running processes are lost.

Wrapping up#

When you troubleshoot Agent Substrate, check the place that reports status instead of the resource you suspect. For agents, that's the Agent's conditions, read from the first False that isn't Blocked. For sandboxes, it's the template's Ready condition and the Sandbox's state and operation. Network failures show up in the atenet-egress gateway log, and capacity problems in the WorkerPool counts and the SystemService API.

Bookmark the cheat sheet, and the next time an agent misbehaves, run the condition dump from Where status lives before you change anything.

For more detail, see these kagent docs:

Which Agent Substrate failure cost you the most time? Tell us in the kagent Discord or open an issue on GitHub, and we'll add it to this guide.