The agent loop and the cockpit
Chat is not only a question-and-answer surface. From the same conversation you can hand the agent a loop or a goal and let it iterate, and you can set how much it is allowed to do without stopping to ask you. The important property is that every one of these controls narrows autonomy, it bounds how far a run goes and how often it pauses, but none of it can widen what the agent is permitted to reach. The hard gates decide that, and they are untouched.
This page covers the governed /loop and /goal commands, the cockpit permission
modes, and the streaming endpoint that bounds a single completion, plus what
differs on a device.
Three nested bounds on autonomy
A chat-driven agent run is bounded at three scales at once, and it is worth seeing them together before the detail:
| Bound | Scope | What it limits |
|---|---|---|
| Stream token budget | One completion | Aborts the model mid-stream at a token (or token-rate) cap |
| Per-turn governance | One turn | Residency, the NPG gate, classification, budget, and Prove-It, the same guards a typed message passes |
| Loop budget | A multi-turn run | An iteration cap and a metered token budget across the whole /loop or /goal |
And orthogonal to all three, the cockpit permission mode decides, within the permitted ceiling, how often a human is asked before a consequential step runs.
Running a loop from chat: /loop and /goal
Two chat commands turn a conversation into a bounded, governed agent loop:
/loop <n>runs up to n iterations (capped at the platform maximum of 8, so/loop 50runs 8)./loop until-doneiterates until a done-predicate holds, still bounded by the iteration cap and the token budget./goal <condition> :: <prompt>pursues a prompt until a stated condition is met.
The load-bearing design choice is that each iteration is one ordinary governed turn, the exact same gated, metered send path a typed message takes:
N loop iterations meter N turns, and every per-turn gate, residency, NPG, classification, budget, and Prove-It, fires on each one.
On top of the per-turn gates, three loop-level bounds stack, checked between turns:
- An iteration cap (default 8): an open-ended loop still terminates.
- A metered token budget (default 100,000 tokens), summed from each turn's recorded token count and read live, so an operator's budget change takes effect mid-loop.
- Cancellation: a loop can be cancelled through its session, checked first on each iteration.
The completion predicate for until-done and /goal is a sentinel the model
emits ([[LOOP-DONE]]), injected into the turn prompt.
until-done completes when the model emits the done sentinel; it is a substring
test, not a semantic evaluation of whether the goal was truly met. A model that
never emits the sentinel runs to the iteration or budget bound, which is the safe
failure, a loop always terminates, it never runs forever waiting to be convinced.
The cockpit permission modes
The cockpit is where you set how much autonomy a chat agent has. A permission mode decides, for a consequential tool call inside the permitted ceiling, whether to run it, ask you first, or refuse. The workspace console carries five modes:
| Mode | Behavior |
|---|---|
| default | Follow explicit rules; otherwise ask |
| accept | Auto-run (accept edits) |
| plan | Propose only; ask for everything |
| auto | Auto-run reads; ask before writes and other consequential calls |
| locked | Refuse anything not explicitly allow-listed |
Per-tool rules (globs) layer on top: the first matching rule wins, and the mode is the fallback when no rule matches.
The cockpit is an advisory layer. It can only move a call from run to ask
or deny, it can never grant one. The hard gates, the
NPG gate, the per-agent cryptographic
tool allowlist, and
role-based access control, are unchanged and still decide every consequential
call. A permissive mode buys fewer interruptions, not more reach. The mode is
session-scoped and off by default (default with no rules).
This is the same layer-3 permission mode in the four-layer permission gate: it governs prompting, never possibility.
Bounding a single completion: the streaming endpoint
Underneath a turn, the model is served through a streaming inference endpoint
(/model-serving/inference/stream) that enforces a token budget as it streams.
The request carries a maximum total token count and an optional per-second rate,
and for every chunk, before it is emitted, the running total is charged against
the budget:
- Exceeding the total aborts the stream with a stable terminal reason
(
budget_exceeded). - Exceeding the per-second rate aborts with
rate_limit_exceeded. - A caller that aborts gets
caller_aborted.
The discipline is fail-closed: there is no "just one more token", and if no inference producer is available the endpoint returns a typed error rather than silently falling back. This is the per-completion bound in the table above, the innermost of the three scales.
Across the deployment matrix and the edge
- Single-cell / multi-cell: the loop runs its turns on the residency-correct cell; the streaming budget and the cockpit apply per turn.
- Sovereign / air-gapped: everything here is local, loop control, the cockpit, and the budget bound run with no cloud.
- Core vs edge: these surfaces differ across the two runtimes, each shaped to its environment:
| Surface | Cell (core) | Device (Edge Agent) |
|---|---|---|
| Loop and goal commands | Chat-typed /loop and /goal | The device drives its agent loop engine directly; the chat-typed commands are a cell surface |
| Permission modes | Five advisory modes (default / accept / plan / auto / locked), narrow-only UX | Four hard modes (plan / ask / accept-edits / auto) enforced as an attenuation gate |
| Streaming token budget | Per-chunk budget abort as the stream runs | The sampling limit caps the completion, and spend is metered fail-closed when it finishes |
The two permission-mode sets are shaped to their runtimes: the cell's cockpit is an advisory layer that narrows prompting, while the device's modes are a hard attenuation gate on the action kind. Both bound how much runs without a human, and neither can widen what the agent is permitted to reach.
Related topics
- Chat and conversation, the governed turn each loop iteration runs.
- Chat on core and edge, the four-layer permission gate and what a device refuses.
- Agent runtime, the loop and goal controller and the autonomy controls underneath chat.
- The cost cascade, how the model behind a turn is chosen cheapest-sufficient first.
- Tools & MCP, the cryptographic tool allowlist the cockpit can never widen.