MidAgents & tools

What actually is an agent, mechanically, and what stops one from looping forever or going off the rails?

What they are really testing: Everyone says agent, few can describe the loop. The control question is the real one: budgets, stop conditions and checkpoints are what distinguish running an agent in production from demoing one.

A real interview question

What actually is an agent, mechanically, and what stops one from looping forever or going off the rails?

What most people say

drag me

An agent is an LLM that can use tools autonomously to achieve goals, frameworks like LangChain handle the loop for you.

Definition by buzzword plus outsourced understanding. When the agent burns 40 dollars retrying the same failing search, "the framework handles it" is exactly the answer that did not prevent it.

The follow-ups they ask next

  • How do you detect that an agent is stuck rather than working?

    Repeated identical or near-identical tool calls, no state change across iterations, oscillation between two actions, or budget burn without criteria progress. All checkable in code outside the model.

  • Where do you put a human in the loop without killing the point of automation?

    Gate on consequence, not on every step: reads run free, writes and irreversible actions require approval, and approvals batch into one review rather than 12 interruptions.

What the interviewer is listening for

  • Describes the loop concretely without framework vocabulary
  • External budgets: iterations, tokens, spend, wall-clock, loop detection
  • Success criteria checked by code, plus escalation instead of thrashing

What sinks the answer

  • Cannot explain what the framework actually does
  • No budget or stop condition beyond the model deciding
  • Grants full autonomy on day 1 with irreversible actions

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

An agent is [a loop: model reasons, emits tool calls, my code executes and feeds back, repeat]. It derails because [errors compound and the model cannot judge its own progress]. Control is [external: iteration, token, spend and time budgets, loop detection, code-checked success criteria, and escalation to a human when stuck].

Keep going with agents & tools

All 57 ai engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free