Interview questions with answers
Agentic AI interview questions and answers
Agents, tools, planning, memory, guardrails and evaluation. Open any question to read its model answer; the multiple-choice set marks the right option and explains it.
- Subjective
- 30
- Objective
- 30
Subjective questions 30
1What is an AI agent, and how is it different from a chatbot?Asked almost every time
An agent uses a language model to decide what to do next in a loop: it plans, calls tools (search, code, APIs), observes the results and continues until the goal is met. A plain chatbot answers each message from its prompt. Agents act on the world through tools and adapt their steps; that power also needs limits, approvals and monitoring.
2Workflows vs. agents: when do you use each?Asked almost every time
A workflow follows steps you define in code, with models used inside fixed paths (prompt chaining, routing, parallel steps). An agent decides the path itself. Workflows are cheaper, faster and more predictable, so use them when the steps are known; use agents for open-ended tasks where the steps depend on what is found. Start simple and add autonomy only where it pays.
3How do you make an agent safe in production?Asked almost every time
Least-privilege tools with permissions enforced in code, human approval for irreversible or costly actions, input and output guardrails, sandboxed code execution, limits on steps, time and spend, protection against prompt injection (treat tool results and user content as data), full tracing and audit logs, and evaluation before every release.
4How do you evaluate an agent?Asked almost every time
Measure task success on a realistic dataset, plus the path: tool choice accuracy, number of steps, errors, cost and latency. Use code checks where outcomes are verifiable, LLM-as-judge with rubrics for quality, and human review on samples. Run several trials per task because outputs vary, and monitor online after release.
5How do you decide whether a task needs an agent at all?Asked almost every time
Start with the simplest option: a single prompt, then a fixed workflow. Use an agent only when the steps cannot be known in advance, the task benefits from tool use and iteration, and the value justifies extra cost, latency and risk. Measure whether the agent actually beats the simpler baseline.
6How do you handle tool errors and retries in an agent?Asked almost every time
Return clear error messages to the model so it can fix arguments, retry transient failures with backoff in the tool layer, cap attempts, fall back to a human or a safe default after repeated failure, and make write tools idempotent so retries never duplicate actions.
7How do you design permissions for an agent?Asked almost every time
Least privilege: give each agent only the tools and scopes it needs, use the end user's identity and permissions rather than a super-user account, separate read and write tools, require approval for irreversible actions, and log every action for audit.
8What are the main failure modes of agents?Asked almost every time
Looping or giving up early, choosing the wrong tool or bad arguments, hallucinating results instead of calling tools, losing track of the goal in long contexts, following injected instructions from data, and excessive cost. Evaluations and traces should look for each of these.
9Explain common agent design patterns.Very often asked
ReAct (reason, act, observe in a loop), plan-and-execute (make a plan, then run steps, re-planning when needed), reflection (critique and revise its own output), routing (send inputs to specialised handlers), orchestrator-workers (a lead agent splits work among sub-agents), and evaluator-optimiser (one model generates, another grades until good enough).
10What kinds of memory do agents use?Very often asked
Short-term memory is the context window and conversation state for the current task. Long-term memory stores facts across sessions: semantic (facts about the user), episodic (past interactions) and procedural (learned instructions), usually in a database or vector store and retrieved when relevant. Memory needs rules for what to save, update and forget.
11What is prompt injection and how do you defend against it?Very often asked
Instructions hidden in content the agent reads (a web page, an email, a document) that try to make it ignore its rules, leak data or misuse tools. Defences: never give tools more permission than the task needs, keep sensitive actions behind approvals, separate untrusted content from instructions, filter outputs, limit where data can be sent, and test with adversarial examples. No defence is complete, so limit the blast radius.
12What is the Model Context Protocol (MCP)?Very often asked
An open standard for connecting AI applications to tools and data. An MCP server exposes tools, resources and prompts; any MCP client (Claude, IDEs, agent frameworks) can use them. It replaces one-off integrations per app with one reusable server, running locally over stdio or remotely over HTTP with authentication.
13How do you design good tools for an agent?Very often asked
Few, distinct tools with clear names and descriptions, typed arguments with examples, outputs that are concise and relevant (not huge raw dumps), helpful error messages the model can act on, idempotent writes, and permission checks in the tool itself. Test tool selection in evaluations.
14When would you use multiple agents?Very often asked
When a task splits into specialised roles with different tools or context, when parallel exploration helps (research across many sources), or when one context window cannot hold everything. Multi-agent systems cost more tokens and are harder to debug, so use them when measurements show a single agent struggles.
15How do you give an agent planning ability?Very often asked
Ask it to write a plan before acting, keep the plan in state, check off steps, and re-plan when observations change. Plan-and-execute patterns use a planner model and executor steps; reflection steps review results before finishing.
16What is reflection or self-critique in agents?Very often asked
After producing a result, the agent (or a separate critic) reviews it against the goal or criteria and revises. It improves quality for writing, code and analysis, but costs extra calls and can loop, so cap the rounds.
17How do you manage an agent's context window over long tasks?Very often asked
Summarise or trim old messages, store large tool outputs outside the context and reference them, retrieve only relevant memories, use sub-agents with their own clean context for sub-tasks, and keep instructions stable at the top for caching.
18How do computer-use and browser agents work?Very often asked
The model receives screenshots or an accessibility tree of a screen and returns actions such as click, type or scroll, which a harness executes; the loop repeats. They can automate apps without APIs, but are slower and more error-prone, so sandbox them and require confirmation for sensitive steps.
19How do you make agent behaviour observable?Very often asked
Trace every step: prompts, model outputs, tool calls with arguments and results, latency, tokens and cost. Attach IDs for users and sessions, record final outcomes and feedback, and review samples of traces regularly.
20How do you test agents before release?Very often asked
Build a suite of realistic tasks with success criteria, run each several times, score outcomes and trajectories with code checks and LLM judges, include adversarial cases such as prompt injection, and compare against the previous version before deploying.
21How do you control the cost of an agent?Often asked
Use smaller models for simple steps, cap steps and tokens, cache repeated calls and prompt prefixes, trim and summarise context, return compact tool outputs, run independent steps in parallel, and track cost per task in traces.
22What is context engineering?Often asked
Deciding exactly what goes into the model's context at each step: instructions, relevant retrieved knowledge, tool definitions, memory and recent history, while leaving out noise. Good context engineering (selection, compression, ordering and isolation between sub-agents) often matters more than prompt wording for agent quality.
23What role does a human play in an agentic system?Often asked
Humans set goals and limits, approve risky actions, review uncertain outputs, handle escalations and give feedback that becomes evaluation data. Interfaces should show what the agent did and why, and make it easy to correct or stop it.
24What is the difference between deterministic routing and model routing?Often asked
Deterministic routing uses rules or classifiers you control to pick a path; model routing lets the LLM choose. Deterministic routes are cheaper and predictable; model routing handles fuzzier cases. Many systems combine them.
25How do agents use code execution?Often asked
The agent writes code (Python, SQL) and runs it in a sandbox to calculate, transform data or call APIs, then reads the output. It is powerful for precise work but needs isolation, time and resource limits, and no access to secrets.
26What are sub-agents and why use them?Often asked
Specialised agents called by a main agent for a focused task, each with its own instructions, tools and fresh context. They keep the main context small and allow parallel work, at the cost of more calls and coordination.
27How do you keep agents from leaking sensitive data?Often asked
Limit the data tools can return, redact personal data, filter outputs, block tools that send data externally unless approved, and avoid putting secrets in prompts. Treat every tool result as untrusted input.
28What is an agent harness or scaffold?Often asked
The code around the model that runs the loop: building prompts, exposing tools, executing calls, managing memory and context, enforcing limits and handling errors. Harness quality often matters as much as model choice.
29What is agent-to-agent (A2A) communication?Sometimes asked
Protocols such as Google's Agent2Agent let agents built by different vendors discover each other's capabilities (agent cards) and exchange tasks and results in a standard way, complementing MCP, which connects an agent to tools and data.
30How do you measure the business value of an agent?Sometimes asked
Track task success rate, time saved, cost per completed task, escalation rate to humans, user satisfaction and error impact, and compare against the manual or previous process.
Objective questions 30
1What makes a system 'agentic'?Asked almost every time
Why: Autonomy over the steps and tool use is the defining feature.
2Which pattern alternates reasoning, tool calls and observations?Asked almost every time
Why: ReAct interleaves reasoning and acting.
3Which action should usually need human approval?Asked almost every time
Why: Irreversible or costly actions need a human check.
4What should come before building an agent?Asked almost every time
Why: Agents add cost and risk.
5Which identity should an agent use for actions?Asked almost every time
Why: Limits the blast radius.
6Why make write tools idempotent?Asked almost every time
Why: Agents and networks retry.
7What does MCP standardise?Very often asked
Why: MCP is a protocol between clients and tool/data servers.
8Prompt injection is best limited by…Very often asked
Why: Limiting what a manipulated agent can do reduces harm.
9When is a fixed workflow better than an agent?Very often asked
Why: Fixed steps are cheaper and more predictable.
10Why run several trials per task in agent evals?Very often asked
Why: Averaging over runs gives a reliable success rate.
11What does reflection add to an agent?Very often asked
Why: Cap the rounds.
12Why use sub-agents?Very often asked
Why: Main context stays small.
13How should large tool outputs be handled?Very often asked
Why: Saves context space.
14What does a computer-use agent receive?Very often asked
Why: It returns UI actions.
15Code written by an agent should run…Very often asked
Why: Contain damage from bad code.
16What is long-term memory for an agent?Often asked
Why: It persists facts and past interactions outside the context window.
17In the orchestrator-workers pattern, the orchestrator…Often asked
Why: It plans and combines the workers' results.
18What should a tool's description contain?Often asked
Why: The model chooses tools from their descriptions.
19What limits a runaway agent loop?Often asked
Why: Budgets stop agents that are stuck.
20Which is an example of a guardrail?Often asked
Why: Guardrails check inputs and outputs against rules.
21What does an agent harness do?Often asked
Why: The code around the model.
22Which failure is an agent hallucinating results?Often asked
Why: Check trajectories.
23Plan-and-execute separates…Often asked
Why: A planner then executors.
24Which metric best reflects agent usefulness?Often asked
Why: Pair it with cost per task.
25Tool results should be treated as…Often asked
Why: They may contain injections.
26Deterministic routing is…Often asked
Why: Cheaper and testable.
27A2A protocols mainly connect…Sometimes asked
Why: They let agents from different systems collaborate.
28Context engineering is about…Sometimes asked
Why: The right context drives agent quality.
29An escalation rate measures…Sometimes asked
Why: A key business metric.
30Adversarial eval cases should include…Sometimes asked
Why: Test the defences.
Track what you have practised and search every bank in your dashboard.
Start learning