FDE Foundations · Module 8: Agents & Tools
Loop Limits and Guardrails
Unbounded agent loops are how demos become incidents. Bound steps, wall time, and spend; detect cycles; and make giving up gracefully a designed outcome.
10 min reading
Objectives
- Bound agent loops by steps, time, and cost
- Detect and break degenerate cycles
- Design the graceful handoff when the agent gives up
Three budgets
Every agent run carries three budgets: maximum steps, maximum wall-clock time, maximum spend (model plus tool side effects). Exceeding any budget stops the run and reports state. Budgets turn runaway behavior into a bounded, observable event.
Cycle detection
Log the sequence of (tool, normalized arguments). A repeated signature within a run is a cycle: break it, note it, and route to the fallback. The classic degenerate loop, calling the failing tool with the same arguments and the same error, is cheap to detect and embarrassing to ship.
Giving up is a feature
Define the handoff: a clear summary of what was attempted, what failed and why, what the human should do next, with links to the artifacts. A run that ends with "I could not complete X; here is the state and the person to ask" is a successful system. A run that improvises is a liability.
Observability
Trace each run: steps, tool calls, token and time spend, outcome class (success, gave up, budget-stopped, error). These outcome classes drive your weekly agent report, and the report drives what you fix next.
Quick check
An optional 2-3 question self-check. Answers never leave your device, are not stored, and never count toward any assessment.
Exercise
Set the guardrails for a fictional research-and-draft agent: three budget numbers with reasons, the cycle detection rule, and the give-up message template.
Pass criteria
Budgets numeric and justified, cycle detection on normalized arguments, and the template includes attempts, failure reason, next step, and artifacts.