Interview Q&A · 39 questions · 9 answered publicly

Agents Interview Questions

Ordered by how often they're asked. Sign in free to see every answer, rate your confidence and run timed mock interviews.

  1. Most asked Agents leaf: What is the ReAct pattern?

    Summary

    Interleave reasoning traces with tool actions in a loop until a final answer.

    Longer Answer

    Interleave reasoning traces with tool actions in a loop until a final answer. Good for short-horizon exploratory tasks.

    Key Points

    • Interleave reasoning traces with tool actions in a loop until a final answer
    • Good for short-horizon exploratory tasks
    • Core agent pattern
    • Use the answer to connect the concept back to a realistic production or interview scenario for 'Agents leaf: What is the ReAct pattern?'

    Comparison / Tradeoffs

    Aspect Notes
    Core idea Interleave reasoning traces with tool actions in a loop until a final answer.
    Practical tradeoff Core agent pattern.

    Permalink

  2. Most asked Agents leaf: When should you avoid agents?

    Summary

    When the workflow is known, latency/cost budgets are tight, or side effects need strict control-use single-shot LLM or deterministic code.

    Longer Answer

    When the workflow is known, latency/cost budgets are tight, or side effects need strict control-use single-shot LLM or deterministic code. Architecture judgment.

    Key Points

    • When the workflow is known, latency/cost budgets are tight, or side effects need strict control-use single-shot LLM or deterministic code
    • Architecture judgment
    • Relevant areas: Ai, Agents, Architecture
    • Use the answer to connect the concept back to a realistic production or interview scenario for 'Agents leaf: When should you avoid agents?'

    Comparison / Tradeoffs

    Aspect Notes
    Core idea When the workflow is known, latency/cost budgets are tight, or side effects need strict control-use single-shot LLM or deterministic code.
    Practical tradeoff Architecture judgment.

    Permalink

  3. Most asked Agents leaf: How do you prevent infinite tool loops?

    Summary

    Max steps, token budgets, repeat-detection, timeouts, and forced finalization.

    Longer Answer

    Max steps, token budgets, repeat-detection, timeouts, and forced finalization. Log every iteration for debugging.

    Key Points

    • Max steps, token budgets, repeat-detection, timeouts, and forced finalization
    • Log every iteration for debugging
    • Control loop hygiene
    • Use the answer to connect the concept back to a realistic production or interview scenario for 'Agents leaf: How do you prevent infinite tool loops?'

    Comparison / Tradeoffs

    Aspect Notes
    Core idea Max steps, token budgets, repeat-detection, timeouts, and forced finalization.
    Practical tradeoff Control loop hygiene.

    Permalink

  4. Most asked Agents leaf: What is structured function calling?

    Summary

    Model emits name+args matching a schema; runtime validates and executes.

    Longer Answer

    Model emits name+args matching a schema; runtime validates and executes. Prefer JSON schema enforcement over free-form text.

    Key Points

    • Model emits name+args matching a schema; runtime validates and executes
    • Prefer JSON schema enforcement over free-form text
    • Tool calling basics
    • Use the answer to connect the concept back to a realistic production or interview scenario for 'Agents leaf: What is structured function calling?'

    Comparison / Tradeoffs

    Aspect Notes
    Core idea Model emits name+args matching a schema; runtime validates and executes.
    Practical tradeoff Tool calling basics.

    Permalink

  5. Most asked How do you stop an agent from looping forever or running up a huge bill?

    Summary

    Bound the loop in code: a maximum number of steps per task type, a token or cost budget, detection of repeated identical tool calls, and a wall-clock limit, with a graceful ending (summary and handoff) when a limit is hit. Also make tool results informative so the model has a better next action than retrying.

    Longer Answer

    The naive loop stops only when the model stops asking for tools, which a confused model may never do. Empty results like [] invite retries; "no orders match; order numbers have 8 digits" guides the next step. Track steps and cost per conversation and alarm on outliers.

    Key Points

    • Step, cost and time budgets in code.
    • Detect repeated calls.
    • Informative tool results.
    • Graceful ending and alerts.

    Deep dive: The Agent Loop and the Runaway Bill

    Permalink

  6. Most asked How do you keep humans in control of an agent's risky actions?

    Summary

    Classify tools by risk (read-only, reversible, destructive, external), enforce approval in the host's code for destructive and external actions, show approvers the exact arguments and blast radius, approve plans before execution for multi-step changes, and prefer dry runs, per-call limits and reversible operations.

    Longer Answer

    Approval enforced in a prompt can be talked around; approval enforced in code cannot. Too many prompts cause rubber-stamping, so auto-approve read-only and small reversible actions. Log approver, arguments and outcome.

    Key Points

    • Risk classes per tool.
    • Gates in code.
    • Show exact action and blast radius.
    • Dry runs, limits, reversibility.

    Deep dive: Human Approval for Risky Actions

    Permalink

  7. Most asked How do you evaluate an agent?

    Summary

    On outcomes, not exact paths: run tasks in resettable sandbox environments, check the final state in code (record created, ticket closed), check constraints (no forbidden actions, approvals obtained), measure efficiency against budgets, and run each task several times to report success rates.

    Longer Answer

    Agents reach goals through different valid paths, so matching a golden tool sequence fails good runs and passes runs that look right but produce wrong results. Grade the final message with a rubric where it matters.

    Key Points

    • Grade final state and constraints.
    • Efficiency against budgets.
    • Repeated runs for success rates.
    • Sandboxed, resettable environments.

    Deep dive: Evaluating Agents

    Permalink

  8. Most asked Agents leaf: What is tool hallucination?

    Summary

    Model invents tool names/args.

    Longer Answer

    Model invents tool names/args. Mitigate with strict schemas, constrained decoding, and runtime rejection of unknown tools.

    Key Points

    • Model invents tool names/args
    • Mitigate with strict schemas, constrained decoding, and runtime rejection of unknown tools
    • Common failure mode
    • Use the answer to connect the concept back to a realistic production or interview scenario for 'Agents leaf: What is tool hallucination?'

    Comparison / Tradeoffs

    Aspect Notes
    Core idea Model invents tool names/args.
    Practical tradeoff Common failure mode.

    Permalink

  9. Most asked What is the difference between a workflow and an agent?

    Summary

    In a workflow, your code defines the sequence of LLM calls and tools (prompt chaining, routing, parallelisation); in an agent, the model decides the next step dynamically in a loop. Workflows are more predictable and cheaper; agents handle open-ended tasks where the steps can't be known in advance.

    Longer Answer

    Many production systems are workflows with one agentic step. Prefer the simplest design that works, and add autonomy only where it measurably helps.

    Key Points

    • Workflow: code decides the steps.
    • Agent: model decides the steps.
    • Workflows are predictable and cheaper.
    • Use the simplest design that works.

    Permalink

  10. Agents leaf: How should tool schemas be designed?
  11. Agents leaf: How do you evaluate agent task success?
  12. Agents leaf: How do you sandbox tool execution?
  13. Agents leaf: Compare planner-executor vs ReAct.
  14. Agents leaf: What is human-in-the-loop for agents?
  15. Agents leaf: How do multi-agent systems fail?
  16. Agents leaf: Design short-term vs long-term agent memory.
  17. Agents leaf: Deterministic code vs LLM for a step?
  18. Agents leaf: How do you recover from a failed tool call?
  19. Agents leaf: What telemetry is required for agents in production?
  20. Agents leaf: How do you handle long-running workflows?
  21. Agents leaf: How do you cost-control agentic features?
  22. How should an agent handle tool failures?
  23. Why does the cost of a long agent run grow faster than linearly, and what do you do about it?
  24. When does a multi-agent system beat a single agent?
  25. What should you trace for an agent in production?
  26. How would you reduce an agent's latency and cost?
  27. How do you design tool definitions so the model doesn't misuse them?
  28. How do you protect an agent from prompt injection through tool results?
  29. Agents leaf: Explain observation formatting best practices.
  30. Agents leaf: How do swarm/crew patterns differ from a single agent?
  31. Agents leaf: Compare assistants API threads vs custom orchestration.
  32. How do you choose between building your own agent loop and using a framework?
  33. How do you give an agent memory across sessions?
  34. How would you sandbox an agent that can run code?
  35. A support agent refunded the wrong order. How do you investigate?
  36. What are parallel tool calls, and when should you use them?
  37. Compare ReAct-style agents, plan-and-execute agents, and multi-agent systems. When would you use each?
  38. How does tool/function calling work with LLMs, and what design mistakes cause unreliable agents?
  39. How would you design memory for a long-running AI agent?

Was this page helpful?