Name the five steps of the canonical agent loop and, for each step, state whether the LLM or the runtime is responsible. Then explain why the loop, rather than a single LLM call, is the defining property of an agent.
The agent loop is observe, reason, act, execute, observe again. The LLM owns reason and act; the runtime owns observe and execute. The loop, not one call, makes it an agent.
Imagine a blindfolded chess coach giving moves to an assistant. The coach is brilliant at deciding moves but cannot touch the board. The assistant cannot decide anything but can move pieces and report what the opponent did. So they take turns. The assistant describes the board, the coach thinks and names a move, the assistant makes that move and watches the reply, then describes the new board. They keep trading turns until the game ends. An AI agent works exactly like this. The language model is the coach: it reasons and decides the next move but cannot act on the world. The runtime is the assistant: it executes the move and reports back what happened. Neither one alone is an agent. The agent is the turn-taking loop that connects a thinker who cannot act to an actor who cannot think.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Name the five steps in order, assign each to the LLM or the runtime, stress that the model emits a call but never executes it, then explain that the loop creates the feedback channel a single call lacks and close on shared control of termination.
Real products, models, and research that use this idea.
- Claude's computer use mode runs this exact split: the model emits a click or keystroke action, and the runtime executes it against the desktop and returns a fresh screenshot as the next observation.
- LangGraph models the loop as a StateGraph where each node is one iteration; the model node decides, a tool node executes, and a conditional edge checks the termination condition.
- The OpenAI and Anthropic function-calling APIs return a structured tool-call object that your runtime must run yourself; the model never touches the function, it only names it.
- Cursor and Cline run code agents where the model proposes an edit, the runtime applies it and reruns the test suite, and the test output becomes the next observation that drives the following decision.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf the LLM only emits text, how does the runtime reliably tell a tool call apart from a final answer?
QWhere exactly does the feedback enter the model, given a transformer is stateless across calls?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying the LLM executes the tool. The model can only output a tool call as text. The runtime parses that text, runs the real function, and feeds the result back as the next observation.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.