# Agents, tools and the loop interview questions

> 6 agents, tools and the loop interview questions for AI and ML engineer roles, each with a model answer.

Canonical: https://llmdojo.dev/interview/topic/agent-loop
Last updated: 2026-10-23

6 questions: 1 junior, 3 mid-level and 2 senior. Taught in [Agents, Tools and the Loop](https://llmdojo.dev/learn/agents-harness-engineering/agents-and-the-loop).

## [What is an AI agent?](https://llmdojo.dev/interview/q/what-is-an-ai-agent)

Level: Junior

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.

## [Walk me through the agent loop.](https://llmdojo.dev/interview/q/walk-me-through-the-agent-loop)

Level: Mid-level

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.

**Diagram: The agent loop**

1. 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.
2. If the step is a tool call, the model doesn't run it. The harness, your code, parses it, checks it, and executes it.
3. The result is appended to the context as an observation, and the loop goes round again.
4. It ends when the model writes a final answer instead of a tool call.
5. 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.

## [What kinds of tools can an agent have, and which need the most care?](https://llmdojo.dev/interview/q/what-kinds-of-tools-can-an-agent-have-and-which-need-the)

Level: Mid-level

**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.

## [Each step of your agent is 95% reliable. How reliable is a 10-step task?](https://llmdojo.dev/interview/q/each-step-of-your-agent-is-95-reliable-how-reliable-is-a)

Level: Mid-level

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.

## [Where does an agent's reliability come from?](https://llmdojo.dev/interview/q/where-does-an-agent-s-reliability-come-from)

Level: Senior

Mostly the **harness**: the code that defines the tools, validates and runs calls, handles failures, manages the context, enforces limits and records everything.

**Diagram: Model versus harness**

1. The model makes the judgment calls, one step at a time, from what's in its context.
2. 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.

## [How do you decide whether a task needs an agent at all?](https://llmdojo.dev/interview/q/how-do-you-decide-whether-a-task-needs-an-agent-at-all)

Level: Senior

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.

## Related
- [All interview questions](https://llmdojo.dev/interview)
