promptdojo_

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.

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.