Technical Interview Questions

LLM Agents: Tool Use, ReAct, and When to Stop Looping

How does an LLM "call tools"? Walk through the ReAct loop.

Why Interviewers Ask This

Agent systems are 2026's hottest AI topic — any AI-adjacent role expects you to understand the loop, not just the marketing.

How to Answer

  1. 1

    Tool use flow: prompt describes available tools; model outputs a structured call (JSON with tool name + args); runner executes; result fed back as an observation; model continues.

  2. 2

    ReAct = Reason + Act. Prompt shape: "Thought → Action → Observation → Thought → ..." until model emits a final answer instead of an action.

  3. 3

    Modern APIs (OpenAI tools, Anthropic tool_use) formalize this with typed schemas — no more regex parsing of text actions.

  4. 4

    Stopping: max iterations, cost budget, repeated-action detection (model looping on the same failing call), or explicit final-answer tag.

  5. 5

    Safety: sandboxed execution (no arbitrary shell), input/output validation, rate limits on expensive tools, audit logging.

Sample Answer

The model doesn't really 'call' anything — it emits a structured request, a host program parses it, executes the tool, and feeds the result back as an observation. ReAct is the canonical loop: Thought → Action → Observation → Thought → ... → Final Answer. In modern APIs (OpenAI tools, Anthropic tool_use), tools have typed JSON schemas so the model output is parseable without regex hacks. The critical engineering concerns are stopping conditions and safety. Stopping: max-iterations cap, budget cap, detection of repeated identical failing calls. Safety: sandbox tool execution (never pass model output to a shell), validate inputs, rate-limit expensive tools, log everything. A production agent framework is 80% harness and 20% prompt — the interesting design questions are all in the harness.

Pro Tips

  • Low-stakes read tools (search, read-file) can be parallel; state-changing tools should be serialized with confirmation.

  • Most agent failures are tool-schema drift — the model calls a tool with a shape the runner doesn't expect. Validate strictly.

  • HireMe AI (即答侠) teaches the ReAct loop with concrete failure modes (infinite loops, hallucinated tools) so you answer engineering questions, not demos.

Frequently Asked Questions

ReAct vs Plan-and-Execute?

ReAct interleaves thought/action every step — robust but slow. Plan-and-Execute writes a full plan up front, then executes — faster but replans poorly when reality disagrees.

What about MCP?

Model Context Protocol is a standard for connecting LLMs to tools across vendors — thin layer on top of the same tool-call mechanics.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free