A free-running loop is a budget bonfire waiting to happen. The difference between a demo and a production agent is the set of guardrails around the loop: hard limits, human checkpoints, and input/output validation. Tune the dials below and watch an agent run safely — or spiral.
Below, an autonomous agent is chewing through a task. Each turn costs tokens and might be a wasted retry. Set the guardrails and run it. Watch which stop condition fires first — a successful finish, a hard limit, or a budget cap. The goal of Domain 1 isn't to make agents that never stop; it's to guarantee they always stop, for a reason you chose.
| Guardrail | Stops… | Layer |
|---|---|---|
| Max turns / steps | infinite loops where the model keeps "almost" finishing. | harness |
| Token / cost budget | a correct-but-expensive run that quietly burns $$$. | harness |
| Human-in-the-loop | irreversible actions (refunds, deletes, emails) going out unreviewed. | before the tool runs |
| Input guardrail | prompt injection / off-topic / unsafe requests entering the loop. | before the model turn |
| Output guardrail | unsafe, off-policy, or malformed answers reaching the user. | after the model turn |
| Tool allow-list / scoping | the agent reaching tools it shouldn't have for this task. | tool layer |
Curated companion: Anthropic — Building Effective Agents (stop conditions & human oversight).