Agents, tools and the loop interview questions
6 questions with model answers
- junior 1
- mid 3
- senior 2
6 agents, tools and the loop questions asked in AI engineer, ML engineer and applied AI engineer interviews, each with a model answer you can say out loud in a minute or two: 1 junior, 3 mid-level and 2 senior. The lesson Agents, Tools and the Loop teaches the ideas behind them.Updated
Model answer
Something that perceives its environment and acts on it, defined by that environment and the actions its tools allow.
In an AI agent the model plans the next step, reads the results, and decides when the task is done. By that definition, a RAG system is a simple agent.
Model answer
The model reads the context and writes a step: a thought and a tool call, or a final answer. The harness parses and runs the call and appends the result as an observation. Repeat.
Scroll sideways to see the whole diagram
Each turn, the model reads the whole context and writes its next step. ReAct (Yao et al., 2022) interleaves a reasoning trace with each action.
Text version
- Each turn, the model reads the whole context and writes its next step. ReAct (Yao et al., 2022) interleaves a reasoning trace with each action.
- If the step is a tool call, the model doesn't run it. The harness, your code, parses it, checks it, and executes it.
- The result is appended to the context as an observation, and the loop goes round again.
- It ends when the model writes a final answer instead of a tool call.
- Or when the harness ends it. Anthropic recommends stopping conditions such as a maximum number of iterations.
It ends when the model answers or the harness stops it: step limits, budgets, errors.
Model answer
Knowledge augmentation (retrievers, SQL, web search), capability extension (calculators, code interpreters), and write actions (send email, update a database, move money).
Reads change what the agent knows; writes change the world, so writes need the most trust and guarding.
Model answer
About 60%, if every step must succeed and failures are independent: 0.95¹⁰. At 100 steps, about 0.6%.
The levers: fewer model decisions (fixed code where judgment isn't needed), checks between steps, and limits on how far it runs alone.
Model answer
Mostly the harness: the code that defines the tools, validates and runs calls, handles failures, manages the context, enforces limits and records everything.
Scroll sideways to see the whole diagram
The model makes the judgment calls, one step at a time, from what's in its context.
Text version
- The model makes the judgment calls, one step at a time, from what's in its context.
- Everything else is ordinary software around it: the harness. This module is mostly about that column, because it's where reliability comes from.
A prompt makes a mistake rarer; a check in code makes it impossible. Anthropic's principles point the same way: keep it simple, make planning visible, and design the agent-computer interface carefully.
Model answer
Start with the simplest solution and add complexity only when needed. If the steps are known in advance, fixed code can run them, with the model doing only the parts that need judgment.
An agent earns its extra cost, latency and compounding risk when the path can't be written down beforehand.