What are common failure modes of agents, and how do you guard against them?
Agents and tools · Intermediate 3
Short answer
Agents loop on the same action, pick the wrong tool or wrong arguments, stop too early or never stop, run up cost, and take risky actions they should not. Guards: a step and spend limit, detecting repeated calls, strict tool schemas, least-privilege permissions, human approval for irreversible actions, and full logging.
Deeper answer
Most failures compound: one wrong tool result leads to a confident wrong plan. Logging every step lets you find where it went off course. Evaluating agents means checking not just the final answer but the path: did it use the right tools, how many steps, how much it cost.
Security belongs here too. An agent that reads untrusted content and can act, such as sending email or changing records, is exposed to prompt injection. OWASP calls the related risk excessive agency: limit what tools can do, and keep a person in the loop for actions with real consequences.
What a strong answer covers
- Names failure modes: loops, wrong tool or arguments, never stopping
- Limits steps and spend
- Strict tool schemas and least privilege
- Human approval for irreversible actions
- Logs every step to debug
Answer it out loud in the mock interview about 1.5 min
Follow-ups to expect
- How would you evaluate an agent, beyond its final answer?
- Which actions would you never let an agent take without approval?
Common mistakes
- Relying only on the system prompt to keep the agent safe
- Measuring only final answers and ignoring cost and path
Learn it
- What kinds of memory can an agent have, and how do you implement them?
- Your agent ran overnight and ran up a large API bill. What probably happened, and what do you change?
- How would you design a harness for an agent that has to work on one task for several hours?
- What is the difference between an agent and a workflow?
- What are computer-use or browser agents good for, and what are their risks?
- What is context engineering, and why does it matter for agents?
- An agent completes a task correctly most of the time but sometimes goes badly wrong. How do you debug it?
- What makes a good tool for an agent?
- Design an agent that handles refund requests for an online store.
- You changed your agent's harness. How do you prove the change made it better?
- What are verification gates in an agent harness, and how would you add them to a coding agent?
- How does tool calling work?
- When should an AI agent ask a human for approval before acting?
- Explain state, nodes, edges and checkpoints in LangGraph.
- What are planning and reflection in agents, and when do they help?
- Two coding agents use the same model, but one solves far more of your tasks. Why could that be, and how would you find out?
- What is an agent harness, and what is harness engineering?
- What is the Model Context Protocol, and why does it matter?
- When is a multi-agent system worth it, and what are the risks?