Published
Writing an agent loop by hand: what does it need at a minimum?
An agent loop of about 200 lines on the Anthropic Messages API, without a framework: when the loop stops, why a failed or declined tool call goes back to the model with is_error, and how to run several tool calls from one turn. Five experiments with Claude Haiku 5.5 record the token counts, how the model recovered from errors, and one claim of mine they proved wrong.
- Agent loop
- Tool use
- Anthropic API
- Python