agent loops — tool_use and the request/tool/respond cycle6 / 9
stop_reason, tool_use, tool_result — the loop every agent runs
The agent loop built a tool_result with a hardcoded tool_use_id
of "1", but the model emitted "toolu_42". The fake server raises
a ValueError on mismatch. Fix line 9 so the id is read from the
tool_use block dynamically.
Expected output:
matched
The break is on line 9 — but read the whole snippet first.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _