promptdojo_

Reading the response — content blocks, stop_reason, usage — step 7 of 9

Cursor wrote this loop with if response["stop_reason"] == "stop":. But Anthropic's actual stop reason is "end_turn", not "stop". The condition never fires; the loop runs to its iteration cap and returns "capped" even though the model finished cleanly on turn 1.

Fix the comparison to use the correct stop_reason string.

Expected output:

result: done in 1 turns
The break is on line 10 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.