Index Ai Academy
Interview questions · 21 questions

AI agent interview questions and answers

Questions on designing and running agents: tools, the agent loop, permissions, context, multi-agent systems, security and evaluation.

The first 7 answers are here, and a free account opens the rest. These questions come from the academy's lessons, and each model answer is one good way to answer. They aren't a list collected from real interviews.

1. A colleague proposes five cooperating agents to write the weekly newsletter (planner, researcher, writer, editor, publisher). What would you ask or suggest?

The newsletter has a known sequence, so I'd start with a workflow: gather the inputs, draft, then an evaluator-optimizer loop against our voice guide. Five agents add handoffs, cost and unpredictability without independent work to split up. I'd measure the simple version against a few past issues first, and keep publishing behind a person's approval.

The lesson that teaches this: Agent design patterns

2. Explain why the model never executes your tools itself, and why that matters for safety.

With your own tools the model only produces a request: which tool and what inputs. Your code chooses whether to run it. That means you decide which functions are exposed, you can validate every input, and you can require a person's approval before anything that sends, spends or deletes.

The lesson that teaches this: Tool use

3. Name three guardrails you'd add before letting an agent manage live ad campaigns, and why.

A turn limit, so a confused agent can't loop and run up costs. Human approval for anything that changes campaigns, like pausing or changing budgets, because mistakes cost real money. And a log of every tool call and input, so when it does something odd I can see exactly what it looked at.

The lesson that teaches this: The agent loop

4. Your team wants to build a 5-agent pipeline (researcher → writer → editor → SEO optimizer → fact-checker) for blog posts. Give your assessment and recommendations.

Five sequential agents means five hand-offs, and even 95%-reliable steps succeed together only about 77% of the time; each agent also sees only what the previous one passed on, so the SEO step might undo the editor's voice. Writing is tightly connected work, so I'd keep one writer agent with the full picture. Where parallelism genuinely helps is research: several subagents gathering sources at once. Then I'd add checks at the hand-offs, like a fact-checker comparing claims against the sources and a final evaluator using our brand criteria, and compare the whole thing against a single strong agent on a set of real briefs before committing.

The lesson that teaches this: Multi-agent systems

5. Design an evaluation for an AI agent that will manage your company's ad budgets (pausing, raising and lowering spend). What would you measure and how?

I'd build a sandbox ad account with fake campaigns and performance data, where every tool call is logged. Each task would state the goal, like 'cut spend on campaigns with ROAS under 1.5', the correct end state, and forbidden changes, such as exceeding the monthly cap or touching campaigns outside the request. I'd run each task several times and report pass^k, count every out-of-policy change with the dollars involved, and track tool calls and cost per task. Tasks would include edge cases and ambiguous requests where the right move is to ask. Before launch I'd set approval thresholds for large changes, and afterwards I'd review real logs and add new test tasks from any mistakes.

The lesson that teaches this: Evaluating agents

6. Explain the lethal trifecta and one design change that breaks it for an AI assistant that reads customer emails and your CRM.

An agent is dangerous when it can read private data, sees untrusted content and can send data out, because instructions hidden in the untrusted content can make it ship the private data somewhere. For an email assistant with CRM access, I'd remove the outbound leg: it writes drafts and a person sends them, and it can't make web requests.

The lesson that teaches this: Prompt injection and security

7. Two coding assistants use the same model, but one fixes far more bugs. Name three harness differences that could explain it.

The better one probably gives the model sharper tools, such as exact-match file edits and a way to run the tests, so it can check its own work and try again. It manages context better: it reads the right files and summarizes old turns instead of overflowing. And it plans, with a to-do list that keeps long fixes on track, plus a system prompt that explains the repository's conventions.

The lesson that teaches this: What an agent harness is

8. You're designing the execution sandbox for a coding agent that runs tests on users' repositories. Describe the layers you'd use, from cheap to strong.

Every command gets a timeout that kills its whole process group, and an output cap. It runs with a minimal environment, so no keys leak in, starting in the repository folder. Each session runs in its own disposable container or microVM as an unprivileged user, with only the repository mounted. The network is off except an allowlist for the package registry. Risky commands, like pushes, need the user's approval, and the work is checkpointed in git.

The lesson that teaches this: Running code safely

9. When a person denies a tool call, why should the harness send the denial back to the model instead of stopping the whole run?

The denial, with the person's feedback, tells the model what not to do and often what to do instead, like using the staging database. Sent as a tool_result with is_error, it also keeps the transcript valid, since every tool_use needs a result. The agent can then adjust and carry on rather than failing the task or trying the same call again.

The lesson that teaches this: Permissions and approvals

10. A colleague wants to install a free MCP server they found that can read and send email. What would you check first?

Who made it and whether we can review the code, since it runs with our access. Then what it can do: sending email means it can act on our behalf, so I'd want approval prompts on, a scoped account, or a read-only version. And I'd remember that its tool descriptions go into the model's context, so a malicious server could plant instructions.

The lesson that teaches this: Model Context Protocol

11. Why give an agent dedicated read, edit and grep tools when it could use cat, sed and grep through a shell?

Dedicated tools let the harness enforce rules a shell can't easily: keep paths inside the workspace, cap output, refuse to edit files the agent hasn't read or that changed, and give clear errors. They also make permissions finer: reading can be allowed freely while edits show the user a clean diff to approve.

The lesson that teaches this: File and search tools

12. Why should a harness keep its transcript append-only, instead of editing old messages to save space?

Prompt caching reuses an unchanged prefix of the request, so editing an early message makes every later call pay full price and run slower. Replies from models that think also contain signed reasoning blocks tied to the turns before them, and editing those turns can invalidate them. To shrink context, use the deliberate tools, such as clearing old tool results or compaction.

The lesson that teaches this: The core loop, built properly

13. A safety hook blocks writes to production config. It crashes on an unusual path. Should the harness allow the write or block it? Explain.

Block it. The hook exists to prevent damage, and a crash means the check didn't happen, so allowing the write would turn the guard off exactly in the unusual cases it's meant to catch. The harness should log the failure and tell the person, so the hook gets fixed. For hooks that only add convenience, like a formatter, carrying on after a crash is fine.

The lesson that teaches this: Hooks and skills

14. Write the instructions you'd give a model for summarizing an agent's conversation during compaction. What must the summary keep?

"Summarize this work so another engineer could continue it. Include: the original task in full; decisions made and why; every file created or changed; the current state, such as which tests pass and which fail; errors met and how they were fixed; open questions; and the next steps. Be concise and factual."

The lesson that teaches this: Managing the context window

15. Describe how you'd structure a multi-day agent project so each new session can pick up where the last left off.

Keep a feature list with a passing flag for each item, a progress file each session appends to, and a git commit for each finished piece. Each session starts by reading the progress file, the git log and the feature list. It picks one unfinished item, builds and tests it, commits, then updates the notes and stops with everything working. A project instructions file holds the build and test commands, so no session has to rediscover them.

The lesson that teaches this: Memory, plans and long tasks

16. A session is resumed the next morning. What should the harness tell the model, and why?

Tell it the session resumed after a break and that files, branches or running services may have changed, so it should read files again and check the state before editing. Better still, include what changed, such as git status. Its transcript describes yesterday's world, and edits based on stale reads go wrong.

The lesson that teaches this: Streaming, interrupts and sessions

17. Design three eval tasks for an agent that answers questions about a company's sales database. Give each a setup, an instruction and a grader.

1) Setup: a sales table with 100 known rows. Instruction: "What was total revenue in March?" Grader: the answer contains the right number, within one cent. 2) Same setup plus a customers table. Instruction: "Which three customers spent most this year?" Grader: the three names match, in order. 3) Instruction: "How many orders came from Norway?" There are none. Grader: the answer says zero and doesn't invent rows. In every task the tables are protected, so any write fails the trial.

The lesson that teaches this: Evaluation harnesses

18. An agent hit its turn budget 200 times yesterday, up from 5 a day. Describe how you'd investigate and what you'd change.

Pull traces for those runs and look for a shared pattern, such as the same tool failing with the same error over and over. Check the versions on the traces against the deploy log to see what changed: a new prompt, a tool, the model, or an outside API. Reproduce it with an eval task. Then fix the cause, perhaps a tool error that doesn't say how to recover, roll back if needed, and add loop detection plus an alert on this rate.

The lesson that teaches this: Tracing, budgets and guardrails

19. A user connects eight MCP servers and the assistant gets slower, more expensive and worse at choosing tools. Why, and what could the host do?

Every connected tool's definition goes into the model's context on every turn, so eight servers can mean a hundred schemas: more tokens to pay for and process, and too many similar options for the model to pick well. The host should let users switch servers and tools on per task, load full tool definitions only when a search finds them relevant, and keep the tool list stable so prompt caching covers it.

The lesson that teaches this: Hosts: connecting servers to a model

20. Your company wants to let employees connect any MCP server from the internet to the internal assistant. Name three controls you'd put in place and why.

First, an internal allowlist of reviewed servers at pinned versions, so nobody installs a typosquat or a compromised release. Second, the host pins each server's tool definitions at approval and asks again whenever they change, which catches rug pulls, and it shows and scans descriptions for hidden instructions. Third, approvals are required for any tool that writes or sends data outside, and each server gets its own narrowly scoped credentials, so a poisoned server or an injected email can't quietly exfiltrate data.

The lesson that teaches this: MCP security

21. Your server's search tool returns 200 full product records as raw JSON, and agents using it run out of context and get confused. How would you redesign it?

Return the top ten matches by default, with a cursor for more, and only the fields an agent needs to decide: id, name, price and a one-line summary. Full records come from a separate get_product(id) call, or a detail='full' option. That keeps each result small, so the agent has room to think, and the ids make follow-up calls easy.

The lesson that teaches this: Testing, designing and shipping servers