Agent Loops
Treat an agent as a state machine you can observe.
Diagnose
Trace:
goal → decision → tool call → tool result → state update → next decision
Look for repeated state, repeated tools, hidden errors, and missing terminal conditions.
Fix → Verify → Prevent
Bound retries and steps, make tool failures explicit, and add loop-detection telemetry. Verify that the same scenario terminates predictably.