Agents interview questions
Loops, tools, planning, memory, and when an agent is the wrong answer. Ten practice questions with answers, for AI Engineer interviews.
Agent loop
Show answer
Repeat: model decides next action → your code runs the tool → result goes back to the model, until the model says it's done or a limit is hit.
The basic control flow of every agent.
What best describes an LLM agent?
- A loop where the model chooses actions (tool calls), observes results, and continues until the task is done
- Any chatbot
- A fine-tuned model
- A model with a long system prompt
Show answer
A loop where the model chooses actions (tool calls), observes results, and continues until the task is done
The model directs its own process rather than following a fixed code path.
Name three things that make tools easy for an agent to use correctly.
Show answer
Clear names and descriptions that say when to use the tool; simple, well-typed parameters with examples or enums; and helpful outputs and error messages that are concise and tell the model what to do next. Avoiding overlapping tools also helps.
Tool design is prompt engineering for agents.
Human-in-the-loop
Show answer
Pausing an agent for a person to approve, correct, or provide input before certain actions proceed.
Essential for high-impact or irreversible actions.
Orchestrator–worker pattern
Show answer
A lead model breaks a task into subtasks, delegates them to worker model calls (often in parallel), and combines their results.
Useful when subtasks can't be predicted in advance.
When is a fixed workflow (prompt chain) usually better than an autonomous agent?
- When the steps are known in advance and predictability matters
- Always
- Never
- When you need the cheapest model
Show answer
When the steps are known in advance and predictability matters
Agents trade predictability and cost for flexibility. Use the simplest thing that works.
Your agent loops forever calling the same search tool. Which safeguard should you add first?
- A maximum number of steps/tool calls and a budget, with a graceful stop
- A higher temperature
- Remove all tools
- A longer system prompt
Show answer
A maximum number of steps/tool calls and a budget, with a graceful stop
Always bound agent loops; then investigate why it loops (often bad tool output or descriptions).
How would you evaluate an agent that books meetings using calendar and email tools?
Show answer
Build realistic scenarios with sandboxed or mocked tools and check the end state (correct event created, right attendees, no unwanted emails sent), not just the final text. Track success rate, number of steps, cost, and latency, and look for unsafe actions. Review transcripts of failures, and include edge cases like conflicts and ambiguous requests.
Outcome-based evals in a sandbox are the norm for agents.
Explain why prompt injection is more dangerous for agents than for a plain chatbot.
Show answer
Agents read untrusted content (web pages, emails, documents) and can take real actions. Instructions hidden in that content may make the agent exfiltrate data or perform harmful actions on the user's behalf. A chatbot can only produce text, while an agent's tool permissions turn a successful injection into real-world impact.
Mitigate with least privilege, confirmation for sensitive actions, and treating tool outputs as data.
An agent's context fills up after many tool calls on a long task. Which approach helps most?
- Summarise or prune old tool results and keep durable notes outside the context
- Restart from scratch every time
- Raise max output tokens
- Use a smaller model
Show answer
Summarise or prune old tool results and keep durable notes outside the context
Context management (compaction, external memory) is core to long-running agents.
Practise these with spaced repetition and AI grading, then try a mock interview.
Start Learning Free