AI Agents Interview Questions
Common agentic AI interview questions — tool calling, agent loops, memory, multi-agent design and safety — with clear answers.
AI agents interview questions
These are the agentic AI questions students and junior AI engineers are most often asked. Answer in your own words — interviewers want understanding, not memorised definitions.
1. What is an AI agent?
An AI agent is an LLM that uses tools in a loop to achieve a goal. The model decides which tool to call next, the application runs it and returns the result, and this repeats until the model gives a final answer.
2. How is an agent different from a workflow?
In a workflow the developer fixes the sequence of steps in code. In an agent the model chooses the steps at runtime based on the task and intermediate results. Workflows are more predictable and cheaper; agents handle open-ended, multi-step tasks.
3. Explain tool (function) calling.
You send the model tool definitions — name, description and JSON Schema. When it needs one, the response stops with a tool_use request containing the tool name, arguments and an id. Your code executes the function and sends back a tool_result with the matching id. The model never executes anything itself.
4. What does the agent loop look like?
while not done and steps < limit:
response = model(messages, tools)
if response is a final answer: done
else: run requested tools, append results to messages
Key details: keep the full assistant turn in history, return all tool results in one message, and enforce a step limit.
5. What is ReAct?
ReAct (Reason + Act) is a pattern where the model alternates reasoning about what it needs, taking an action (a tool call), and observing the result. It lets the model adapt each step to what it just learned.
6. ReAct vs plan-and-execute?
ReAct decides one step at a time — good when each step depends on the last. Plan-and-execute writes a full plan first, then runs it — better for long tasks, easier to review, and easier to resume after errors.
7. How do agents handle memory?
Short-term memory is the context window (the message history). Long-term memory lives outside the model — files, databases or a vector store — and is read and written through tools. Long tasks also need context management: trimming tool results, clearing old outputs or summarising history.
8. What happens when a tool fails?
Return a tool_result marked as an error with a clear message. The model can then retry with corrected arguments, try another tool, or explain the problem. Silently dropping a failed call makes the model assume it succeeded.
9. What is a multi-agent system and when would you use one?
Several agents cooperating, commonly an orchestrator that delegates to workers. Use it when work fans out into independent sub-tasks or would overflow one context window. Avoid it for simple, sequential tasks — it costs more and is harder to debug.
10. How do you evaluate an AI agent?
Build a fixed set of realistic tasks with clear success criteria (tests pass, correct facts, correct rows). Re-run it after every change and track success rate, steps, tokens and cost per completed task. Read failed transcripts to find the root cause.
11. What is prompt injection, and why are agents vulnerable?
Prompt injection is malicious instructions hidden in content the model reads — a web page, email or document. Agents are vulnerable because they read untrusted content and can take actions. Defences: treat tool output as data, least-privilege tools, approval before sensitive actions, and keeping powerful tools away from agents that browse untrusted sources.
12. How would you make an agent safe for production?
- Least-privilege, narrowly scoped tools
- Human approval for destructive or external actions
- Step, token and spend limits
- Input validation inside every tool
- Sandboxed execution for code
- Full logging of tool calls
- An evaluation suite run before each release
13. Why not use eval() in a calculator tool?
Tool inputs come from the model, and the model's input can come from an attacker via prompt injection. eval() would let that input run arbitrary Python. Parse and allow only the operations you intend.
14. How do you control agent cost?
Start with the simplest design, cap steps and tokens, trim large tool outputs, cache stable prompt prefixes, use smaller or lower-effort models for simple sub-tasks, and measure cost per completed task rather than per request.
15. When should you NOT build an agent?
When the task is single-step, when the steps are always the same (use a workflow), when the extra latency and cost aren't justified, or when mistakes can't be detected and rolled back.
Practice tip
Build the small agent from the Build an AI Agent in Python lesson, then extend it with one new tool, a memory file and an approval step. Being able to walk an interviewer through code you wrote yourself is the strongest answer to any of these questions.