Reliable Agent Control Loops
An agent is a control loop:
text
goal -> plan -> act -> observe -> update state -> repeat or stop
Reliable agents make this loop explicit and bounded.
The minimum loop state
Track:
- original goal
- current plan
- completed steps
- pending steps
- tool results
- errors
- budget remaining
- confidence
- stop condition
Common failure modes
| Failure | Symptom | Fix |
|---|---|---|
| tool loop | calls same tool repeatedly | max call count and state diff checks |
| bad observation | trusts broken tool output | validate tool results |
| goal drift | solves a different task | keep objective visible |
| over-agency | takes risky actions | permission gates |
| under-specification | guesses missing inputs | ask or escalate |
| partial success hidden | claims done too early | verification step |
Recovery pattern
When an action fails:
text
1. classify the failure
2. decide if retry is safe
3. try a different tool or plan
4. preserve useful partial work
5. escalate if repeated failures happen
Budgeting
Every agent should have budgets:
- max turns
- max tool calls
- max wall-clock time
- max cost
- max file changes
- max external actions
Budgets are not just cost controls. They prevent runaway behavior.
Verification
Before an agent says "done," require evidence:
- tests passed
- file exists
- API returned success
- answer cites sources
- human approved action
- diff matches expected scope
Knowledge check
Q1: Why should an agent track budget?
To prevent infinite loops, surprise cost, and unsafe repeated actions.
Q2: What should happen before an agent claims completion?
It should verify the expected outcome with evidence.