Wire it all together — a CLI agent in 12 steps — step 10 of 12
Cursor wrote an agent loop without a max-turns guard. The fake LLM in
this snippet always returns tool_use (it never produces an
end_turn), so the loop would run forever in real life. Convert the
while True on line 14 into a bounded loop that stops after exactly
3 turns and prints the turn count.
Expected output:
bailed after 3 turns
The break is on line 14 — but read the whole snippet first.
⌘↵ runs the editor.read, then continue.
Cursor wrote an agent loop without a max-turns guard. The fake LLM in
this snippet always returns tool_use (it never produces an
end_turn), so the loop would run forever in real life. Convert the
while True on line 14 into a bounded loop that stops after exactly
3 turns and prints the turn count.
Expected output:
bailed after 3 turns
The break is on line 14 — 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.