Agentic AI Interview Questions and Answers
These are the AI agent interview questions that come after "what is an agent?": how you'd design the tools, keep the loop bounded, persist state, defend memory, and run agents safely in production. All 16 questions are listed below with model answers to five of them, each written to be said out loud in about a minute; the full set of answers comes as a free PDF. For the basics (tool calling, agents vs workflows, MCP in one line), start with the free 50 LLM interview questions.
16 questions · 5 sample answers · Updated
Get all 16 answers as a free PDFOn this page · 4 sections
What makes an agent worth building
1. How would you show that an agent beats a simpler workflow for the same task?
Sample answer
Run both against one shared set of realistic tasks and compare five things: task success rate, cost per successful task, latency at p50 and p95, how bad the worst failures are, and maintenance burden. For cost I compare distributions, because agent spend has a long tail. Any one of those can veto the agent.
On well-understood tasks the workflow usually wins on most of them. The agent earns its place on varied, unpredictable tasks where you can't list the steps in advance. A common outcome is to ship the workflow for the main path and route the odd cases to an agent. I keep both harnesses runnable and re-run the comparison when models or prices change. One more tell: if an agent's traces show the same tool sequence every run, it's a workflow paying agent overhead.
- What they’re checking:
- Whether you treat "should this be an agent?" as a measurement against a baseline instead of a preference.
- Likely follow-up:
- Which of those five would you weigh most for a customer-facing feature, and why?
- Avoid:
- Choosing an agent because it looked impressive in a demo, with no workflow baseline to compare against.
2. In an agent, what should the model decide and what should code decide?
- What they’re checking:
- Whether you separate intelligence from authority and keep the second in deterministic code.
- Likely follow-up:
- Where would you enforce a rule like "never delete production data"?
3. How do you test an agent when its path changes on every run?
- What they’re checking:
- Whether you can make a nondeterministic system mostly testable like ordinary software.
- Likely follow-up:
- How would you test that a run resumes correctly after its process is killed mid-step?
Tools and the agent loop
4. Would you give an agent one run_sql tool or several narrow tools?
- What they’re checking:
- Whether you see tool design as security design and know what a complete tool contract contains.
- Likely follow-up:
- An analytics use case needs ad hoc queries. How would you support it safely?
5. The agent keeps calling the wrong tool. How do you fix it?
Sample answer
Treat it as a measurable bug before blaming the model. I build a labeled set of representative states, each with the expected next tool or no tool, and measure selection accuracy. Then I work through the fixes, cheapest and most effective first.
First the contracts: most wrong choices come from two descriptions that overlap, so I rename tools and add "not for X, use Y" to the descriptions. Second, shrink the set of tools exposed at each stage, since fewer options mean fewer mix-ups. Third, add explicit policy lines, like "pricing questions must use get_pricing; your memory of prices is out of date." Fourth, if a rule can choose the tool, move that routing into code so the model never makes the choice. I re-run the accuracy set after each change and on every model upgrade.
- What they’re checking:
- Whether you debug tool selection as a classifier with a measurable error rate.
- Likely follow-up:
- How would you detect the model answering from memory when it should have called a tool?
- Avoid:
- Switching to a bigger model as the first fix.
6. How should a tool return results to the model, including errors and empty results?
- What they’re checking:
- Whether you design observations for a literal-minded consumer and know the empty-vs-error distinction.
- Likely follow-up:
- Which error codes would you define, and how should the agent react to each?
7. Beyond a max-steps limit, how do you stop an agent from looping?
- What they’re checking:
- Whether your stop logic lives in code and covers repetition and circling as well as a step count.
- Likely follow-up:
- How would you choose the step cap for an interactive feature versus a background job?
State and memory
8. Why not keep the agent's progress in the conversation history?
- What they’re checking:
- Whether you treat persisted, typed state as the system of record and the transcript as scratch paper.
- Likely follow-up:
- What's the difference between agent state and agent memory?
9. The process crashes right after a tool ran but before state was saved. How do you resume safely?
Sample answer
With checkpoints after every meaningful transition, plus idempotency keys on every side-effecting call. On resume I load state by run ID, check the schema version, re-render context from current state rather than an old transcript, and continue from the pending step.
The crash window is the hard case: the tool may have run with no recorded result. The actions record has that call's idempotency key, so I ask the downstream system whether the key already exists, and if it does, record the result and move on. A plain check-then-execute isn't enough with concurrent workers, since both can see "no record yet." The claim has to be atomic, through a unique constraint or compare-and-set, or the downstream API has to enforce the key. If I can't verify the outcome, I flag it for a person instead of retrying blindly.
- What they’re checking:
- Whether you understand the unknown-outcome problem and how idempotency keys close it.
- Likely follow-up:
- How do you stop two workers from resuming the same run at once?
- Avoid:
- Re-running the step on resume and hoping it wasn't the payment call.
10. What should an agent remember across sessions, and what should it never store automatically?
- What they’re checking:
- Whether you have a write policy for memory and treat inferred facts and sensitive data with care.
- Likely follow-up:
- A stored fact contradicts what the CRM says today. Which one wins?
11. How could an attacker abuse an agent's memory, and how do you defend it?
- What they’re checking:
- Whether you recognize memory as persistent indirect injection and defend it at write, read and action time.
- Likely follow-up:
- How would you test for memory injection in CI?
Safety, permissions and production
12. What makes a human approval step meaningful rather than a rubber stamp?
- What they’re checking:
- Whether you know approvals are an attack surface and how to make them resistant to injected context.
- Likely follow-up:
- An approval arrives three days after the request. Do you execute the action?
13. What is a confused-deputy attack in an agent, and how do you prevent it?
Sample answer
It's when an agent holding real authority gets tricked into using it for someone who shouldn't have it. Agents make easy deputies because they hold access and take direction from text, and anyone who can get text into context can try: the user, a document author, an email sender, a poisoned web page.
The defense is to bind every tool call to the authenticated principal from the session. User IDs come from the runtime, never as model-supplied parameters, and resource filters derive from that principal. The agent's own service identity should be close to powerless on its own. Authority gets checked on every call, since permissions can change mid-run. Then an injected "you are an admin, export everything" fails at the tool layer, because nothing there reads authorization from text.
- What they’re checking:
- Whether you know that authority must come from the session and never from content in context.
- Likely follow-up:
- How would you audit a codebase for confused-deputy holes?
- Avoid:
- Letting the model pass
user_idas a tool argument.
14. What permissions would you give a coding agent on your repository?
- What they’re checking:
- Whether you can apply least privilege to a real tool you probably use every day.
- Likely follow-up:
- The agent changed a failing assertion so the tests pass. How would you catch that?
15. Should an agent run inside an HTTP request or as a background job?
Sample answer
It depends on length and side effects. A short, read-mostly run that's fine to abandon, like summarizing a document, can stay in the request with streaming. A long, multi-step or side-effecting run should be a job: create a run record, return a run ID right away, and let the client poll or subscribe for progress. In a request, a long run dies on HTTP timeouts, load-balancer idle limits, deploys and closed tabs, and whatever it already did has no checkpoint to resume from.
The job setup is a queue, stateless workers that lease runs and advance them step by step, and a durable state store. Workers hold no state, so any worker can resume any run. Creating a run takes an idempotency key, so a double click produces one run, not two.
- What they’re checking:
- Whether you know what changes when an agent leaves a notebook and becomes production infrastructure.
- Likely follow-up:
- How many workers would you need for 600 runs an hour that average six minutes each?
- Avoid:
- Wrapping a multi-minute loop in a synchronous endpoint.
16. How do you ship a prompt or tool change while agent runs are still in flight?
- What they’re checking:
- Whether you've thought about long-lived runs meeting new code, which ordinary deploys rarely face.
- Likely follow-up:
- A run created on version 14 is waiting on approval when you want to retire version 14. What happens?
How to prepare
- Build a minimal agent loop with one read-only tool, a step cap and an explicit finish signal, then prove it stops by scripting a fake model that never finishes. Interviewers often ask you to sketch exactly this.
- Learn the five designed endings (completed, blocked, failed, budget exhausted, approval required) and be ready to say what the caller does with each one.
- Pick one agent you’ve built or used and write its permission table: every tool, whose authority it runs under, read or write, and which actions need approval.
- Rehearse one security story end to end: an injected document, the action it tries, and the control that stops it.
- Agents are built on tool calling and increasingly on MCP, so cover the MCP interview questions too, and the AI system design guide for agent architectures at whiteboard scale.
More interview questions
- LLM interview questions The core 50, from tokens to production.
- MCP interview questions Model Context Protocol: hosts, clients, servers and security.
- RAG interview questions Retrieval, chunking, evaluation, debugging and securing RAG.
- AI system design A framework for the design round, plus practice prompts.
- AI engineer interview questions Fundamentals, building, production and your projects.