How-to

Set a budget

Cap what a Kno run may spend, consent to estimates, and read the exit codes that tell CI whether a run completed or stopped at a cap.

Every path in Kno that can call a provider goes through a budget guard: estimate, confirm, checkpoint. Caps are enforced before the call, not discovered at settlement. A cap whose cost cannot be estimated is refused up front.

The flags

kno baseline --evals cases.jsonl --agent openai:gpt-4.1 \
  --max-cost-usd 2.00 --yes
  • --max-cost-usd, hard cap on the run. 0 (default) means unlimited.
  • --yes, consent to the printed estimate without a prompt. Without it, Kno asks interactively above $1.00, with [c] to change the cap.
  • --cost-per-call-usd, --max-calls, --concurrency, --max-output-tokens, finer controls; see reference.

Resuming is free

Work checkpoints as each case completes, in one transaction with its result. --resume skips what finished and reconstructs prior spend from disk, an interrupted run cannot pay twice.

Exit codes, a contract, not an afterthought

Code Meaning What CI should do
0 Completed Continue
1 Failed Fail the build, something is broken
2 Stopped at a budget cap Not a failure. The run did what you configured
3 Validation failed Fail the build (reserved for kno validate)
4 Interrupted by signal or deadline Not a failure. Resume it

Codes 2 and 4 both leave a resumable run. Reporting either as 1 would train people to ignore 1, the code that actually means something is wrong.

Gate a deploy on Kno

Kno’s exit codes make it a CI gate without extra plumbing. The full recipe: Gate a deploy on Kno in CI.

← All docs