Zenaique

Describe each step of the agent loop and explain which component, LLM or runtime, is responsible for it

Short answer·Medium·4.0 · 0·~3 min·Asked atAdobePaytmSiemens·Relevant atAi21AndurilAnthropicBytedance
Attempt it

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.

Free · 2 AI evals / day
TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

The agent loop is the control structure that turns one LLM call into a multi-step process, and the most useful way to understand it is as a partnership between two components with strictly different jobs. The language model reasons and decides. The runtime observes and acts. Neither is an agent on its own.

This question probes whether you actually understand that split, because it is the thing most candidates blur. They say the agent searches the web or the model runs the code. It does not. The model emits text that names an action, and a separate piece of software interprets that text and performs the action. Getting this boundary right is what separates a precise mental model from a hand-wavy one, and it directly explains why the loop, not a single call, is the defining property of an agent.

The five steps and who owns each

The canonical loop has five steps, and each belongs to exactly one component.

  • Observe (runtime): the runtime assembles the current state and places it in the model's context. On turn one this is just the user goal. On later turns it is the goal plus every prior action and observation.
  • Reason (LLM): the model reads the context and decides what to do next. This is pure inference; nothing in the world changes.
  • Act (LLM): the model emits its decision as output, either a structured tool call or a final-answer signal. Crucially, this is still just text or a typed object, not an effect on the world.
  • Execute (runtime): the runtime parses the tool call, validates the arguments against the tool schema, and runs the real function, for example an HTTP request or a database query.
  • Observe result (runtime): the runtime captures whatever the tool returned, including errors, and appends it to the state as the next observation.

The pattern is symmetric. The model brackets the middle, owning reason and act. The runtime brackets the outside, owning observe and execute. Then the loop closes: the new observation becomes the input to the next reason step, and the cycle repeats until the model signals completion or a budget is hit.

A useful sanity check is to ask, for any claim about an agent, which component the verb belongs to. The agent searched the web means the runtime executed a search the model requested. The agent decided to stop means the model emitted a final answer. The agent retried means the runtime re-ran a call after the model emitted it again. Keeping the verbs assigned to the right owner prevents the most common confusion, which is imagining a single magical entity that both thinks and acts. There is no such entity. There is a thinker that emits text and an executor that turns some of that text into effects.

Why the LLM cannot execute anything
Why the loop, not a single call, defines an agent
Shared control of termination
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

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.
Sign in to see more production examples.

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?
A

Modern APIs return a typed tool-call object with a distinct field, not free text. Discuss function-calling schemas versus ReAct text parsing, and how a stop reason or sentinel field signals a final answer versus a pending call.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • The five steps of the loop and their order.

  • State which steps the LLM owns and which the runtime owns.

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
What is the Model Context Protocol (MCP) and what problem does it solve?
MCQ·Easy