Autonomy with guardrails
Agents combine a model, tools and a loop. Interviewers look for an understanding of the loop, a sensible tool design, and a strong safety and cost story — plus the judgement to say when an agent is overkill.
- MechanicsTool calling and the agent loop.
- EcosystemMCP servers, memory and multi-agent setups.
- SafetyPermissions, approvals, limits and evaluation.
Agents are the fastest-growing area of AI engineering in 2026, and interviews for AI roles almost always include them. The best answers are practical: how the tool-calling loop works, how you keep an agent safe and on budget, and when a simple workflow is the better choice.
1. What is an AI agent, and how is it different from a chatbot or workflow?
A chatbot answers messages. A workflow runs a fixed sequence of LLM calls and code you designed. An agent lets the model decide which steps to take: it plans, calls tools, reads the results and continues until the goal is met. Agents suit open-ended tasks (research, coding, troubleshooting); workflows suit predictable ones — and are cheaper and easier to test.
2. How does tool (function) calling work?
You describe tools to the model — name, purpose and a JSON schema for the inputs. When the model needs one, it returns a structured tool call instead of text. Your code runs the tool, sends the result back, and the model continues. The model never executes anything itself; your application stays in control.
tools = [{
"name": "get_order_status",
"description": "Look up the delivery status of an order. Use when a customer asks where their order is.",
"input_schema": {
"type": "object",
"properties": {"order_id": {"type": "string", "description": "Order number, e.g. LF-10293"}},
"required": ["order_id"],
},
}]3. Describe the agent loop.
1) Send the conversation and tool list. 2) If the model returns tool calls, execute them (in parallel when independent), validate inputs and handle errors. 3) Append the results and call the model again. 4) Stop when it returns a final answer — or when you hit a step, time or cost limit. Log every step so you can debug and audit.
messages = [{"role": "user", "content": question}]
for step in range(10): # hard cap on steps
reply = llm(messages=messages, tools=tools)
messages.append({"role": "assistant", "content": reply.content})
calls = [b for b in reply.content if b.type == "tool_use"]
if not calls:
break # final answer
results = [run_tool(c) for c in calls] # validate, execute, catch errors
messages.append({"role": "user", "content": results})4. What is the Model Context Protocol (MCP)?
MCP is an open standard, introduced by Anthropic in 2024 and now widely adopted, for connecting AI applications to external tools and data. An MCP server exposes tools (actions), resources (data) and prompts through a common protocol; any MCP-compatible client — chat apps, IDEs, coding agents, custom agents — can use it. Instead of writing a separate integration for every app, you write one server, for example for your ticketing system or database.
5. How do agents remember things?
Short-term memory is the conversation in the context window; for long tasks it is trimmed, summarised or compacted. Long-term memory is stored outside — notes files, a database, a vector store — and retrieved when relevant. Good agents write down progress and decisions so they can resume work after a restart.
6. When would you use multiple agents?
When work splits naturally into parallel, independent parts — researching many sources at once, reviewing many files — or when separate roles help, such as a writer and a reviewer. An orchestrator delegates and merges results. Multi-agent systems use more tokens and are harder to debug, so start with one agent and split only when it clearly helps.
7. How do you make an agent safe and reliable?
Give minimal permissions and narrow tools; require human approval for irreversible actions (payments, emails, deletions); validate every tool input; set step, time and budget limits; sandbox code execution; treat everything the agent reads as untrusted (prompt injection); and evaluate on realistic tasks before launch, then monitor traces in production.
8. How do you write good tool descriptions?
Write them like documentation for a new teammate: what the tool does, when to use it and when not to, what each parameter means with an example, and what the result looks like. Keep the tool set small and distinct — overlapping tools confuse the model. Return clear, compact results and helpful error messages so the agent can recover.
Remember
Key points
- Workflow before agent
Use agents only for open-ended tasks.
- Your code runs the tools
The model only requests them.
- MCP = write once, use everywhere
One server works with many AI clients.
- Cap steps and spend
Agents can loop; set limits.
Interview drill
Follow-up questions
What the interviewer asks after your first answer. Turn on practice mode, answer each one aloud, then reveal.
-
1 What should happen when a tool fails? Basic
Return a clear error result to the model (not a crash) so it can retry, try another approach or tell the user. Retry transient errors in code with back-off.
-
2 How do you evaluate an agent? Intermediate
Run it on a set of realistic tasks with checkable outcomes (tests pass, ticket resolved, correct record updated) and track success rate, steps, cost and time per task; review traces of failures.
-
3 What is the difference between MCP tools and resources? Intermediate
Tools are actions the model can invoke (create ticket, run query). Resources are data the client can read and add to context (a file, a schema, a document).
-
4 Why can too many tools hurt an agent? Intermediate
Each tool definition uses context and adds a choice the model can get wrong. Group or search tools dynamically, and remove ones that are rarely needed.
-
5 What is a computer-use agent? Advanced
An agent that operates a graphical interface — reading screenshots and sending clicks and keystrokes — for tasks with no API. Powerful but slower and riskier, so it needs sandboxing and confirmations.