Agents & Tool Calling
Observe. Repeat
until done.↘
What is the repeating loop an agent runs,
and when does it stop?
An agent runs the ReAct loop. A Thought reasons about what to do next, an Action calls a tool, and an Observation feeds the result back.
It keeps cycling through think, act, observe, think again, building up what it has learned, and it stops when it has gathered enough to write a final answer. A safety cap like a step limit forces a stuck run to stop.
That loop is why an agent can answer things it couldn't possibly know up front: it discovers the pieces one at a time.
looping forever?”
→ A safety cap. A hard step limit
forces a stuck run to stop.
In tool calling, what does the model emit, who runs the function,
and how does the result get back?
The model emits a request, the tool's name plus filled-in arguments as JSON, and then pauses. It never executes anything itself.
Your code sees that request, runs the real function, and appends two things to the conversation: the model's own request and a tool_result tied to it by an id.
Then you call the model again with the longer message history, and now it can read the result and decide the next move. The growing transcript is the agent's working memory.
+ JSON args
nothing itself
picks next move
function
tool_result by id
again
What do the Thought, Action, and Observation steps of ReAct
each correspond to?
Thought is the model reasoning out loud about what to do next, the "reason" half of ReAct. Action is the "act" half: an actual tool call, a function name plus arguments.
Observation is what your code hands back, the tool's result.
The model reads the observation, forms the next thought, and the cycle continues. The 2022 ReAct paper found that interleaving reasoning with actions beats doing either alone.
This is a small sample.
600+ interview questions live inside Skillumen.
Every concept card carries its own interview questions, graded as you answer.
Free to start.