Skip to content

Interview question · Agent Loops & the Harness

What is an AI agent? Explain how it differs from a chatbot and from a workflow that happens to call a model.

The definition question, asked to see whether you can draw the line in code rather than in marketing. The strong answer says who chooses the next step, shows one run as a trace, and names the loop, the tools and the harness that make the difference.

easyNewUpdated Nov 2026

TL;DR: An agent is a system in which the model chooses the next action at run time, by asking for tool calls in a loop, and the code around it runs those calls and decides when the run ends. A chatbot answers and stops; the model chooses words, not actions. A workflow calls a model at steps the code chose in advance; the path is fixed. The test is one question: who picks the next step? If the model does, from a menu of tools, with the result fed back to it, you have an agent, and you also have every problem this site teaches: termination, budgets, bad calls and authority.

How to approach it

Give the definition in one sentence, then make it operational: what you would see in the code. Draw the three systems as a spectrum and say which problems appear only on the agent end. Show one run as a trace, four or five steps, so the interviewer can see the model proposing and the harness executing. Finish with when you would choose each.

A strong answer

The defining property is who chooses the path. In a chatbot, the model produces a reply and the turn ends; the only decision it makes is what to say. In a workflow, the code decides the sequence: fetch the order, call the model to classify the complaint, branch on the label, call the model again to draft a reply. The model is a step, and the steps are fixed. In an agent, the request to the model includes a list of tools, and the model's reply can ask for one or more of them to be called. The code runs the call, appends the result, and asks again. The model is choosing what happens next, and the code is finding out one step at a time (Workflows and Agents).

Here is the smallest run that is an agent:

user      "Why was order 4471 charged twice?"
step 1    model -> tool call get_order(id=4471)
          harness runs it -> {status: shipped, charges: [c_1, c_2]}
step 2    model -> tool call get_charge(id=c_2)
          harness runs it -> {status: pending_capture, created: ...}
step 3    model -> tool call get_charge(id=c_1)
          harness runs it -> {status: captured}
step 4    model -> text: "One capture, one pending authorisation that
          will expire. No double charge." stop_reason = natural end

Nobody wrote "look up both charges" in code. The model decided that from the first result. A different order would have produced a different path, and that is the point and the risk at once.

Three things make the agent real, and all three live outside the model (The Agent Loop). The loop: call, dispatch, append, repeat. The tools: a menu of actions with names, descriptions and schemas that the model picks from. The harness: the code that validates each requested call, runs it, enforces budgets and decides that the run is over. The model never executes anything. It proposes, in a structured form, and the harness decides. That sentence is the authority line, and every design answer on this site states it.

Who chooses the next stepHow it endsWhere failure enters
ChatbotNobody; one reply per turnThe reply endsWrong or made-up words
WorkflowThe code, in advanceThe last step runsA branch the author did not foresee
AgentThe model, from the tools offeredThe harness stops itBad calls, loops that never settle, actions nobody authorised

The spectrum view explains why agents are not always the answer. If the path is known, a workflow is cheaper, testable and faster, and it fails in ways you can list. An agent earns its cost when the path depends on what the tools return, when the space of cases is too wide to enumerate, or when a person would need to look at intermediate results to decide. "Our refund process has four steps" is a workflow. "Find out why this customer is upset and fix what you can" is an agent.

What interviewers probe next

"A chatbot with retrieval, which searches a knowledge base before answering: agent or not?" If the code always searches first and then answers, it is a workflow with one fixed tool step. It becomes an agent when the model decides whether to search, what to search for, and whether to search again after reading the result.

"The model calls exactly one tool and then answers. Agent?" Yes, barely, and that is often the right design. The question is still who chose the call. One model-chosen step already needs validation of the arguments and a result fed back; it does not yet need loop detection.

"Why not make everything an agent, since the model can handle fixed paths too?" Because you pay for the choice on every step: tokens for the tool list and transcript, latency per round trip, and a path you cannot fully test in advance. Fixed paths are free in a workflow and expensive in an agent.

How it's scored

Weak: Defines an agent by autonomy or intelligence, or lists products instead of a mechanism.

Hire: Says the model chooses the next step from tools in a loop, contrasts it with a chatbot and a fixed workflow, and names the harness as the part that runs calls and ends the run.

Strong Hire: Also shows a run as a trace, states the authority line, lists the failure modes that appear only on the agent end, and says when a workflow is the better choice.

Common mistakes

  • Defining an agent by what it is for rather than by who chooses the path.
  • Saying the model "executes" tools.
  • Treating a fixed retrieve-then-answer pipeline as an agent.
  • Leaving out the harness, so termination and authority have no owner.
  • Recommending an agent for a process whose steps are already known.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.