AI Agent Interview Questions
Agent loops, tool calling, MCP, memory and guardrails.
What is an AI agent?
A system where an LLM decides which actions (tool calls) to take in a loop until a goal is met, observing results after each step.
Key Points:
- Agents trade predictability for flexibility.
What is tool or function calling?
The model returns a structured request to call a function you defined (name + JSON arguments). Your code runs it and returns the result for the next step.
Key Points:
- Validate arguments before running a tool.
What is MCP?
The Model Context Protocol is an open standard for connecting AI apps to tools and data sources through servers that expose tools, resources and prompts.
Key Points:
- One MCP server can be reused across many AI clients.
What is the ReAct pattern?
ReAct (Reason + Act) has the model alternate between reasoning about what to do next, taking an action such as a tool call, and observing the result. The loop repeats until the model has enough information to answer.
Key Points:
- Interleaving reasoning with real observations reduces hallucination.
- Most modern tool-calling agents follow this loop.
What is the difference between a workflow and an agent?
A workflow follows a fixed, predefined sequence of steps written in code, even if some steps use an LLM. An agent lets the model decide which steps to take and in what order based on the situation.
Key Points:
- Workflows are more predictable, cheaper and easier to test.
- Use an agent only when the path genuinely can't be known in advance.
How do AI agents use memory?
Short-term memory is the conversation and tool results held in the context window. Long-term memory stores facts, preferences or past outcomes outside the model — in a database or vector store — and retrieves relevant items into context when needed.
Key Points:
- Summarise or trim history to stay within the context window.
- Decide carefully what to persist, especially personal data.
What is a multi-agent system and when is it worth it?
A multi-agent system splits work across several specialised agents — for example a planner, researchers and a reviewer — that coordinate through messages or an orchestrator. It helps when tasks are broad and parallelisable or need separated context and roles.
Key Points:
- Adds cost, latency and new failure modes in coordination.
- Start with one well-designed agent and split only when it clearly struggles.
How do you stop an agent from looping forever?
Set hard limits on steps, tool calls, tokens, time and spend. Detect repeated identical actions, define clear stop conditions in the instructions, and fall back to a safe response or a human when limits are hit.
Key Points:
- Log every step so you can see why loops happen.
- Ambiguous tool results are a common cause — make them explicit.
How do you evaluate an AI agent?
Measure task success on a set of realistic scenarios, plus efficiency (steps, cost, latency) and safety (wrong or risky actions taken). Evaluate the final outcome and also inspect the trajectory — whether it chose the right tools in a sensible order.
Key Points:
- Use sandboxed or mocked tools so tests are repeatable.
- Run each scenario several times — agents are non-deterministic.
What guardrails should an AI agent have?
Give the agent the fewest tools and permissions it needs, validate tool inputs and outputs, require human approval for irreversible actions like payments or deletions, filter harmful content, and keep audit logs of every action.
Key Points:
- Treat content the agent reads from the web or files as untrusted.
- Least privilege limits the damage from mistakes or prompt injection.
What is human-in-the-loop?
Human-in-the-loop means a person reviews, approves or corrects the AI's work at key points instead of letting it act fully on its own — for example approving an email before it is sent.
Key Points:
- Essential for high-stakes or irreversible actions.
- Human corrections also become valuable training and evaluation data.
How do you write a good tool description?
Give the tool a clear name, say exactly what it does and when to use it (and when not to), describe every parameter with types, formats and examples, and explain what it returns. The model only knows what the description tells it.
Key Points:
- Ambiguous or overlapping tools are the top cause of wrong tool choices.
- Return helpful error messages the model can act on.
How should an agent handle tool errors?
Return errors to the model as clear, structured messages explaining what went wrong and how to fix it, so it can correct its arguments or try another approach. Retry transient failures with backoff in code, and cap retries before escalating to a human.
Key Points:
- Never fail silently — the agent may assume success.
- Make tools idempotent where possible so retries are safe.