Skip to lesson
Exit
Building AI-Native Workflows1 / 2

2 min lesson

Agent loops and tool calling

Take this case and make the call. "A coding agent loop has run 6 of its 12 allowed steps. The model keeps proposing edits but the diff and test results haven't changed for the last three steps. What should the loop do?"

Step 1 of 2

An agent that can edit code is a loop with a kill switch, not a magic box.

Every coding agent, Cursor's included, runs the same skeleton. The model proposes an action, a tool executes it, the result feeds back and the model decides whether to continue or stop. When you build an AI-native workflow for a customer, you own that skeleton and need to know exactly where it breaks. The term means a workflow where an agent does a step a person used to do, with checks around it.

THE AGENT LOOP, END TO END

Interactive diagram. Step through it with the Next and Previous controls below, or Tab to a region to read its detail.

diagram: flow

The verify step is the gate: nothing counts as done until a tool confirms it.

Learn more

Optional practice

Test yourself on Agent loops and tool calling

QOn step 4 of 12 the agent reports that the task is done, but run_tests still shows two failing tests. What should the loop do?