Agent jobs and runtimes
How Wardn runs an agent for one piece of work in a sandbox, what it may read and report, how to connect Claude Code or your own image, and how to stop it.
An agent is an identity. A job is one piece of work it is asked to do: read an incident, explain drift, look at why a test fails, read a snapshot for the person who signs it off. Wardn starts the agent's runtime in a sandbox for the length of the job, hands it a task and a short-lived token, and collects one report. The agent then goes away, and its box with it.
Jobs read and report, and a few may also propose. A triage, a drift explanation, a test run read and a sign-off read hold a read-only token: no proposal, no release, no change to a cluster. A root-cause (rca) or test fix job also holds the right to propose a fix with propose_remediation, which Remediations describes: the proposal waits for a person, the person who asked for the job cannot approve it, and Wardn, not the agent, makes the change with its own credentials. The agent's roles still decide what it may propose and where, and what it may do beyond proposing is limited by its autonomy, which is recommend unless you raised it.
The kinds of job
| Kind | About | Started by |
|---|---|---|
triage | An incident | Wardn when an incident opens and a triage rule names an agent for its severity, or a person |
rca | An incident | A person: start a job |
drift_explanation | A deployment | A person |
test_fix, test_run | A test run | A person |
snapshot_read | A snapshot in a stage | Wardn, for reads for sign-off |
An incident shows the likely cause from a finished RCA, or failing that a finished triage. Each kind starts from a task text that says what to find and how to report. The agent reads with the same MCP tools any agent has (get_app, list_deployments, read_logs, read_events and the rest of the tool list), under the roles it was given. An agent that was never given the right to read a deployment cannot read it in a job either, and a place it cannot see answers as if it did not exist.
Start a job
POST /agent-jobs asks an agent to do a job now:
curl -fsS -X POST "$WARDN_API_URL/api/v1/agent-jobs" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"agentId":"'"$AGENT_ID"'","kind":"rca","subject":{"kind":"incident","id":"INC-12"}}'The subject's kind follows the job's: an incident (its id or its number, INC-12) for triage and rca, a deployment for drift_explanation, a test_run for test_fix and test_run. The answer is the job, queued. Re-run is the same call again with a finished job's kind and subject: each call makes a new job, and a repeated Idempotency-Key makes one.
Starting a job spends your model key, so it takes more than reading:
| Check | Refusal |
|---|---|
You may see the agent: agent:read for its team | 404 |
You may manage the subject: incident:manage on a deployment the incident affects, deployment:manage, or test:run on the test run's app | 403, or 404 when you cannot even read the subject |
| The agent is not paused, and every agent is not | 403 agent.paused |
| The agent's own roles let it read the subject. An agent with no read role could not do the job, so it is not started | 403 job.agent_cannot_read |
The kind is one a person starts (not snapshot_read) and the subject is of the right kind | 400 |
| This server has a sandbox | 503 job.sandbox_off |
The start is in Activity with who asked and what the job is about.
Read jobs
GET /agent-jobs lists the jobs of the agents you may read, newest first, with agentId, kind and status filters. Each has its number (J-311), its agent and runtime, what it is about (with a name a person would say, such as INC-12), its status and reason, and the fixes it proposed. GET /agent-jobs/{jobId} adds what the agent concluded (the conclusion, how sure it was, the timeline and the evidence) and every call it made to Wardn, in order. The same pages are in the web app: Agents › Jobs lists them and starts one, and a job's page re-runs it, stops it, and posts its summary to PagerDuty.
Cancel a job
POST /agent-jobs/{jobId}/cancel stops the agent's process and removes its box, by the same stop the kill switch uses, and the job ends cancelled. Cancelling a job that has ended, or cancelling twice, does nothing. It needs agent:manage for the agent's team and is in Activity.
What an agent reports
A job ends when the agent calls the report_result tool, once:
| Field | Meaning |
|---|---|
conclusion | What the agent found, in plain text |
confidence | A number from 0 to 1 |
timeline | Steps in order, each with a time (or none) and a line of text |
evidence | Links that show the claim: a Wardn page or an outside one, with a label |
recommendation, reasons | For a snapshot read only: recommend or hold, and why. A hold must give reasons |
The report is the agent's own words, stored and shown to people, so it is bounded: at most ten reasons of 500 characters each, text cleaned of control characters, and links limited to the two kinds a screen can open. A report that breaks a limit is refused with job.result_invalid and the agent can correct it and report again. report_result needs no role, because it changes only the job's own result and the token already names the job and the attempt.
A job's life
A job is queued, running, then ends succeeded, failed or cancelled. A job that ends without a result says why with a reason:
| Reason | What happened |
|---|---|
cancelled | It was cancelled |
agent_paused | The agent was paused, or every agent was, while it ran |
timed_out | One attempt ran longer than WARDN_AGENT_JOB_TIMEOUT |
no_result | The agent finished without calling report_result |
agent_failed | The runtime exited with an error |
sandbox_failed | The box could not be made or its policy could not be built |
not_read_only | A call that changes something got through for a read-only job, which should never happen and is treated as a failure. A kind that may propose is not checked this way: its proposals are in the record and a person decides each |
Jobs are durable. Each job is a workflow in Postgres, and each attempt is one step of it. If the worker running a job stops, whether it is restarted or killed outright, another worker takes the job when the lease runs out, removes the old attempt's box and runs the agent again under a new token. The old token is refused from then on, and only the running attempt can report, so a job has one result however many attempts it took. A job started twice for the same cause (the same incident, the same snapshot) is stored once.
A running job asks the database once a second whether it was cancelled or its agent paused, so pause and the kill switch work on whichever replica holds the job. See Stopping jobs.
Runtimes
A runtime is the program that does the thinking. Wardn starts it for you, so you choose a kind and give the agent a model key; you do not run anything yourself.
| Runtime | Runs | Model key goes to |
|---|---|---|
| Claude Code | The claude CLI, headless, with the task as its prompt and Wardn's MCP endpoint as its only tool server | api.anthropic.com |
| Codex | The codex CLI | api.openai.com |
| Hermes | The hermes CLI | openrouter.ai |
| OpenClaw | The openclaw CLI | api.anthropic.com |
| Grok bot | Runs in the cloud, not in a Wardn sandbox. Wardn gives it only the task and the job token | its own service |
| Custom | Your own image and command | nothing: see below |
Check Codex, Hermes and OpenClaw against your install
Claude Code and Custom are the two runtimes used end to end today. The Codex, Hermes and OpenClaw command lines and config files are written from those tools' documented shapes and are tested only against fakes: a fake runtime, not yet the real tools. Try one on a harmless incident before you rely on it.
Every runtime reaches Wardn the same way: an MCP endpoint, a job token as the bearer, and a task file in the box. Which tools it may call is decided by Wardn's permission check, not by the runtime.
Connect Claude Code
Create the agent
Make an agent with the runtime Claude Code, an owning team and the roles it needs to read what you want it to look at. A triage agent usually holds the read roles on the deployments of its team and nothing that writes. See Agents.
Give it your model key
Put your Anthropic API key in the secret store, then point the agent's model key at it by name. The API carries only the name, never the value; see Credentials are references.
curl -fsS -X PUT "$WARDN_API_URL/api/v1/agents/$AGENT_ID/credentials/model_key" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"ref":"agents/triage/model-key"}'Turn the sandbox on
The worker runs jobs only when it has a sandbox. Set WARDN_SANDBOX_PROVIDER and WARDN_MCP_URL as described in Setting up the sandbox and restart it.
Point a rule at it
Make it the agent for the severities you want triaged, see Triage rules, or choose it as the reader of a pipeline stage. Open a test incident and watch the job appear on the incident.
Connect a Custom image
A Custom agent runs an image you built, with a command you choose. Use it for a model or a framework Wardn has no adapter for.
- Build an image that can be pulled by the sandbox. It needs your agent program and whatever that program needs; it does not need a Wardn SDK.
- Set the agent's
image(a reference such asregistry.example.com/triage-bot:1.4, not a URL, up to 300 characters) andcommand(the program and its arguments, up to 32 arguments of 500 characters) when you create or update it. The settings screen does not offer these two fields yet, so use the API:
curl -fsS -X PUT "$WARDN_API_URL/api/v1/agents/$AGENT_ID" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d '{"image":"registry.example.com/triage-bot:1.4","command":["/app/triage","--once"]}'- Make your program read its inputs and report:
| It gets | Where |
|---|---|
| The task text | The file /sandbox/task.md |
| Wardn's MCP endpoint | The variable WARDN_MCP_URL |
| The job token | The variable WARDN_MCP_TOKEN (a placeholder, see credentials) |
Call the endpoint with Authorization: Bearer $WARDN_MCP_TOKEN, read with the tools you need, and finish by calling report_result once. The program ends when it is done.
A Custom image gets no model key, because Wardn cannot know which host your model lives on. If your program calls a model, its host has to be allowed and its key has to reach it some other way; ask for that to be supported if you need it. A Custom agent saved without an image or a command fails its jobs at once with a clear error rather than sitting queued.
The sandbox
Every attempt runs in its own box, started with a deny-by-default network policy. The only hosts it may reach are Wardn's MCP endpoint and the model host of its runtime. Files in the box are the task, the MCP config and the agent's state directory. The box is removed when the attempt ends, whatever its outcome.
Two sandboxes are supported:
| Provider | For | Notes |
|---|---|---|
openshell | Production | Through an OpenShell gateway with client certificates. Attaches credentials on HTTPS |
docker | Development and tests | Each box is a container with a policy proxy and a shim. Attaches credentials on plain HTTP |
none | The default | Starts no job. Triage and reads for sign-off do nothing |
Setting up the sandbox
| Variable | Meaning |
|---|---|
WARDN_SANDBOX_PROVIDER | openshell, docker or none (the default) |
WARDN_MCP_URL | The address a box reaches Wardn's MCP endpoint at, such as https://wardn.example.com/mcp. Required with a provider |
WARDN_SANDBOX_OPENSHELL_ADDRESS, WARDN_SANDBOX_OPENSHELL_TLS_DIR | The gateway and the directory with ca.crt, client/tls.crt and client/tls.key |
WARDN_SANDBOX_DOCKER_SHIM, WARDN_SANDBOX_DOCKER_STATE_DIR | The shim binary and a short directory for each box's socket and policy |
WARDN_AGENT_MODEL | The model a job asks its runtime for. Default claude-sonnet-5-5 |
WARDN_AGENT_MODEL_URL | A model gateway every runtime reaches instead of its vendor, such as https://models.example.com (no path). The agent's model key is attached for that host |
WARDN_AGENT_JOB_TIMEOUT | How long one attempt may run, from 1m to 6h. Default 10m |
The full list, with defaults, is in Configuration.
Credentials reach the boundary, not the agent
The model key, the job token and any token the agent needs are never in the agent's environment, its files or its arguments. Wardn resolves each secret from the store when the box starts and gives the sandbox the value together with the host and header it belongs to; the sandbox adds it to requests for that host as they leave the box. The agent holds only a placeholder in the variable, so a prompt that tricks it into printing its environment, or a tool that logs it, reveals nothing usable. The test suite runs the Claude Code adapter in both sandboxes and checks that the agent finds neither value while the MCP endpoint and the model host receive theirs.
Triage rules
A triage rule says which agent triages incidents of a severity. There is at most one rule per severity, and a severity with no rule is not triaged by an agent.
# Sev 1 and Sev 2 incidents are triaged by the on-call agent
for s in 1 2; do
curl -fsS -X PUT "$WARDN_API_URL/api/v1/incident-triage-rules/$s" \
-H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
-d "{\"agentId\":\"$AGENT_ID\"}"
done
curl -fsS "$WARDN_API_URL/api/v1/incident-triage-rules" -H "Authorization: Bearer $WARDN_TOKEN"Setting a rule needs agent:manage for the agent's team and writes an Activity entry. There is no screen for rules yet. When an incident opens, from Wardn or from PagerDuty, Wardn looks up the rule for its severity and starts a triage job. Opening the same incident twice starts one job. The result shows on the incident.
The read for sign-off
A pipeline stage can name an agent in its Reads for sign-off setting (Stage rules). When a snapshot gets a verdict in that stage, the agent reads it and tells the person who signs it off whether to recommend it or hold it, with its reasons. Its read is advice shown on the sign-off page. It is never a sign-off, no agent can sign off, and no rule of the stage depends on it.
A read goes stale when the snapshot's verdict or the state of any check differs from when it was read; progress inside a running check does not count. A stale read is not counted as a recommendation, and Wardn reads again. Reads start when the verdict changes (including the first verdict a snapshot has in the stage) and on a periodic pass for a check that changed without the verdict moving.
Stopping jobs
| To stop | Do |
|---|---|
| Every job of one agent | Pause the agent. Its running jobs end agent_paused |
| Every job of every agent | Turn on the kill switch (PUT /agent-kill-switch). Calls are refused on every replica within seconds, and each running job stops and its box is removed |
| One job | Cancel it |
Pausing and the kill switch also stop new jobs from starting. A job whose agent is paused when it would start is not started, and its incident is not held up.
Who can see and do what
| Action | Needs |
|---|---|
| See an incident's agent work | incident:read on a deployment the incident touches |
| Post a job's summary to PagerDuty | incident:manage, see Incidents |
| Set or list triage rules | agent:manage and agent:read for the agent's team |
| Set an agent's image and command | agent:manage |
| Start a job | see Start a job |
| Cancel a job | agent:manage |
What is not built yet
- Screens for managing triage rules, and the image and command fields of the agent settings screen. Both work through the API.
- The incident list's "Agent work" column has no data from the list API yet; the incident page has it.
- Codex, Hermes and OpenClaw have not been run against their real CLIs.