# opencode · Budget enforcement

> Levels are per column and must not be summed, averaged or ranked. A level states which written criterion the runtime's source meets. It is not a measure of quality or task success. Higher is not always preferable.

Source: "Agent runtime comparison: ten open-source agent runtimes, source review", study of 2026-11-28. Mark notation: `3` is the level in the default deployment; `1→4 [opt: …]` is level 1 by default and level 4 in the named configuration; `s` source-verified, `d` documented or test only. Service dependencies are classes (E embedded, O on demand, R resident service, X external server required), not levels.

- Runtime: [opencode](https://ai-agents-review.com/runtime/opencode.md)
- Column: [Budget enforcement](https://ai-agents-review.com/column/budget-enforcement.md) (Execution controls)
- Mark: 1→2 [opt: per-agent steps] s
- Default deployment: 1
- Best supported configuration: 2 (opt: per-agent steps)
- Page: https://ai-agents-review.com/cell/opencode/budget-enforcement

## Rationale

steps unset by default, cost reporting only; setting the named per-agent steps key gives a level-2 work limit (R3)

## Rubric criteria for this column

- 0: No limits of any unit, and no usage reporting
- 1: Usage or cost reported only, **or** only coarse safety caps (retry counts, iteration ceilings ≥1000, wall-clock timeouts ≥ hours)
- 2: An enforced work limit (turns/steps/iterations at a practical default) **or** a $/token limit checked after each step, per run
- 3: A $ or token limit checked **before** the model call (admission) for a run, **or** a post-step $ limit covering descendants
- 4: Pre-call admission across the whole delegation tree, with stated settlement of in-flight calls

## Review finding

Per-agent `steps` (unset by default) forces a final tool-less step; it counts per agent loop and does not include descendants. No local $/token cap: cost is computed after each call from the provider-reported figure, else the models.dev catalog. OpenCode Console spend limits are enforced provider-side and surface as errors. Goal loop capped at 50 rounds. [X105][X106][X107][X108][X109]

## Evidence cited by the mark

- [X105] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/session/runner/llm.ts#L263-L283 — steps limit forces final tool-less step — [S]
- [X106] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/session/usage.ts#L21-L50 — cost after call: provider-reported else catalog — [S]
- [X108] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/plugin/goal.ts#L16-L17 — goal loop MAX_ROUNDS 50, MAX_STALLS 3 — [S]

## Evidence also cited by the review finding

- [X107] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/session/to-session-error.ts#L40-L58 — Console usage/spend-limit errors surfaced — [S]
- [X109] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/schema/src/config/flag.ts#L6-L44 — feature flags on in dev, off in release (full Code Mode, codemode_agents...) — [S]

## Grading record

- Grader A (default / best): 1 / 1
- Grader B (default / best): 1 / 1
- Adjudication: R3 (agreed cell changed from 1/1). steps unset by default, cost reporting only; setting the named per-agent steps key gives a level-2 work limit (R3)
