Question presented to candidate: "People use the word 'agent' for almost anything with an LLM in it. Tell me what you mean by an AI agent, walk me through the loop that runs one, and tell me what stops that loop from running forever or burning money."
What a strong answer should cover:
- A minimal definition: a model that chooses its own next action from a set of tools, inside a loop the application runs, until the goal is met or a limit stops it (model + tools + loop + stop conditions)
- The loop step by step: send context, the model returns either tool calls or a final answer, the runtime executes the tools, the results are appended as observations, repeat; the model never executes anything itself
- The difference between a workflow (code fixes the path) and an agent (the model picks the path at runtime), and why you start with the simplest one that works
- Termination guards: a step or turn cap, a token or cost budget, a wall-clock deadline, and detection of repeated identical calls, each ending in a clean, explained stop
- Context growth: every turn re-sends the whole transcript, so input tokens grow with each step and total cost grows roughly with the square of the number of steps
- The production concerns around the loop: tool permissions, error handling, checkpoints and full traces of every step
Clarifying questions expected:
- What kind of task is it: a known sequence of steps, or open-ended work where the next step depends on what was found?
- Which actions have side effects (writes, payments, emails), and do any need a human approval?
- What latency and cost budget does one task have?
Code / implementation expected: Optional โ sketching the loop (call model, run tool calls, append results, check stop conditions) in pseudocode or with an SDK.