Skip to content

Medical: usage, exposure and quarantine

Medical watches the health of Agents. The watchdog catches a Run that stalls or loops. This page covers the rest: what Runs consume, which Runs have read input an attacker could have written, and how an Agent that misbehaves is stopped everywhere. Every setting here has a default and can be overridden; weakening a default is a choice the configuration makes visible, never a silent one.

Usage

Handlers report what the provider reports. Claude Code's result events carry token counts and total_cost_usd; Codex reports tokens per model request (it reports no cost, so Codex Runs are limited by tokens only). The Station turns the reports into additions and keeps one ledger per Mission in the shared Registry (usage/<operation>/<mission>.json), so every Station sees the same spend and a resumed Run is never counted twice.

Measuring is always on. The Mission detail of Universal Exports shows the ledger:

GET /v1/operations/G/missions/mission-7
{ "usage": { "total": { "input": 1200, "output": 340, "cache_read": 90000,
                         "cache_write": 6000, "cost_micro_usd": 48000 },
             "runs": { "<run id>": { "...": 0 } },
             "daily_cost_micro_usd": { "2026-10-26": 48000 } } }

Money is an integer count of millionths of a dollar. A token budget counts input, output and cache-write tokens; cache reads re-count the same context on every turn, so they stay visible but are not counted against a limit.

Budgets

Limits are set per Operation and per Agent (the Agent's keys layer over the Operation's, and over the Agent it extends):

[operation.G.budget]
mission_cost_usd = 5.0
operation_cost_usd_per_day = 40.0 # a UTC day, summed over the Operation's Missions
warn_at = 0.8                     # fraction of a limit that raises a warning

[agent.007.budget]
run_tokens = 2000000
mission_tokens = 5000000
Key Default Meaning
run_tokens unset Tokens one Run may use
mission_tokens unset Tokens all of a Mission's Runs may use
mission_cost_usd unset Dollars all of a Mission's Runs may spend
operation_cost_usd_per_day unset Dollars an Operation's Missions may spend per UTC day
warn_at 0.8 Fraction (above 0, at most 1) of a limit that raises a warning
preset none strict sets conservative limits (2M tokens per Run, 5M per Mission, $10 per Mission, $50 per Operation per day); keys written beside it override it

No limit is set unless you set one or choose strict: subscription quotas are already handled by parking. A negative, fractional (for token counts) or non-numeric value fails the load with an error naming the key.

Crossing warn_at emits a budget event on the Mission and writes an audit record (budget.warn). Reaching a limit writes budget.limit, interrupts the Run and moves the Mission to blocked with blocked_reason: "budget", never failed. The safe house and the Run stay, so an operator who raises the limit can resume the same work. When a Mission cost limit is set, Claude Code is also started with --max-budget-usd for what the Mission may still spend, as a second stop.

Exposure

A Run is exposed once it has read input someone else could have written:

Source When
brief:source The Mission came from a Source item
brief:registry_drop Its brief was found in the queue with no provenance
brief:compartment Its Mission was proposed from another Operation through a compartment
product:OPERATION It read a brief or a product of that Operation through a compartment
tool:NAME It called a tool the Operation lists (default WebFetch and WebSearch)
cable:SENDER It read a Cable from another Operation or from an exposed Run
issue:TRACKER It was given a reply from a linked issue of that tracker instance, or read an issue's text with issue_read
review It read review text written by someone else

This is for an Agent doing work: Moneypenny's conversations carry no exposure, and a Cable from her exposes no one.

Exposure is recorded in the Run's Registry record, never goes away, and is inherited by a later run at the same Mission. Outer Office shows an EXPOSED chip on the Run and ai6ctl lists the sources. Marking is always on; what an exposed Run may then do is the Operation's policy:

[operation.G.exposure]
preset = "strict"                      # default; "observe" only marks; "strict-except-secrets" leaves leases alone
restrict = ["proposals", "cables"]     # choose restrictions one by one (optional)
tools = ["WebFetch", "WebSearch", "Browse"]
Restriction Effect on an exposed Run
proposals Mission proposals carry its exposure into the Mission they become, so they are never auto-promoted
cables It may send a Cable only as a reply inside an existing conversation (send_cable is refused, naming the exposure)
approvals Its requests for authorization always go to a human, never to a class authorization
secrets It is given no new secret leases, except the credential its harness reaches its model with: its pool account, or a loadout secret in a provider credential variable. Without that one it could not run. A loadout's env is no secret and stays
issues It posts directly only on the issue whose text exposed it (the source) and the children it created; any other post waits for a person's green ink (issue-comment)

strict applies all five; strict-except-secrets applies all but secrets, for an Operation whose exposed Runs must keep drawing leases (tracker writes from Runs that read untrusted text); restrict replaces the preset's set. The Station enforces proposals, cables and approvals (a green ink request from an exposed Run waits for a person even when a class authorisation would cover it) itself; secrets is carried by ExposureGate::restricts for the part of AI6 that issues leases to ask.

Quarantine

A quarantine stops an Agent in an Operation (or in every Operation). It is a record in the shared Registry, so it takes effect on every Station:

  • the Agent's running Runs are interrupted and its Missions become quarantined, with their safe houses kept (never finished or cleaned up);
  • Cables the Agent sends are held until an authorized release;
  • the roster skips the Agent, so the next qualified Agent takes new briefs and queued Missions.

An Operation's settings trigger it automatically from the Agent's recent incidents in that Operation:

[operation.G.quarantine]
stalls = 3          # stalls or loops within the window; 0 turns the trigger off
budget_stops = 2    # budget hard stops within the window; 0 turns it off
blown = true        # one blown cover
window_hours = 24
reroute = true      # move its Missions to the next qualified Agent for their role

An operator can quarantine an Agent at any time:

ai6 quarantine add 007 "writes outside its brief" --operation G
ai6 quarantine list
ai6 quarantine release 007 --operation G --reason "checked its page history"

or through Universal Exports (needs agent.configure on the Operation):

POST /v1/user/operations/G/quarantine/007           { "reason": "..." }
GET  /v1/user/operations/G/quarantine
POST /v1/user/operations/G/quarantine/007/release   { "reason": "..." }
GET  /v1/user/quarantine                                 (every record, with the Missions it holds)
POST /v1/user/quarantine/007/release                     { "reason": "..." }   (the record of every Operation)

The last two need agent.configure on config:agent. A lift states why (1 to 512 characters): the reason and who lifted it are audited as agent.quarantine.release and kept in the Registry's audit history. ai6ctl quarantine list [--operation OP] and ai6ctl quarantine lift AGENT --reason TEXT (--operation OP | --all) do the same from a workstation, and the Agents view of an Operation shows quarantined (why, who, when) for an Agent held.

By default a quarantine reroutes: a Mission of the Agent that has a role moves to the next qualified Agent (the timeline says rerouted), and a brief pinned to the Agent is placed on the next one. With reroute = false, or when nobody else qualifies, the Mission stays quarantined with Agent "007" quarantined: <reason> on it and the Station reports quarantine-held until an operator lifts the quarantine.

Only an operator releases a quarantine. Releasing it returns each stopped Mission to the queue, assigned to the next qualified Agent when there is one; an operator can instead abandon the Mission. A quarantine of every Operation (ai6 quarantine add without --operation) is released with ai6 quarantine release AGENT --all --reason TEXT on a Station, or with the gateway route above.