Agents run into errors constantly: commands fail, APIs time out, files are missing, and models occasionally produce malformed tool calls. Robust harnesses expect this.
Return Errors to the Model
Tool errors should come back as informative observations. A clear message lets the model adjust its approach.
Retry Transient Failures
Network timeouts and rate limits can be retried automatically with backoff, without involving the model.
Validate Tool Calls
Check arguments against schemas before execution. Return validation errors so the model can correct them.
Detect Loops
Agents sometimes repeat the same failing action. Detect repetition and intervene: add a hint, change strategy, or stop.
Checkpoints
Save state at key points so work can resume after crashes, and changes can be rolled back if the agent makes a mess — version control is ideal for code.
Know When to Stop
Set limits on steps, time and cost. When the agent is stuck, it should report what it tried and what blocked it rather than continuing indefinitely or claiming success.
Honest Reporting
Instruct agents to report failures plainly. Evaluate for false claims of success — it's a common and costly failure mode.