Interview Q&A · questions with model answers
Agents Interview Questions
Part of the study plan for: Native AI Engineer · Forward Deployed Engineer (FDE)
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked Agents leaf: How do you prevent infinite tool loops?
Prevent infinite loops with max step limits, token budgets, repeat detection, timeouts, and forced finalization after a set number of iterations.
-
Most asked How do you stop an agent from looping forever or running up a huge bill?
Bound the loop in code: a maximum number of steps per task type, a token or cost budget, detection of repeated identical tool calls, and a wall-clock limit, with a graceful ending (summary and…
-
Most asked How do you evaluate an agent?
On outcomes, not exact paths: run tasks in resettable sandbox environments, check the final state in code (record created, ticket closed), check constraints (no forbidden actions, approvals…
-
Agents leaf: How do you evaluate agent task success?
Evaluate agents using binary task completion, step/cost efficiency, tool error rates, policy violation counts, and human override rates — all measured against a golden task set with known correct…
-
Agents leaf: How do you sandbox tool execution?
Sandbox agent tool execution using allowlists, network egress controls, timeouts, resource limits (CPU/memory), non-root containers, and argument validation before every execution.
-
Agents leaf: How do you cost-control agentic features?
Control agent costs by capping steps and tokens per run, routing simple tasks to cheaper models, caching tool results, setting per-user budgets, and preferring non-agent flows for deterministic tasks.
-
What should you trace for an agent in production?
Each run as a tree of spans: the agent span (task, user, status, total cost), model spans (model, input and output tokens, latency, stop reason) and tool spans (name, arguments, result summary,…
-
How would you reduce an agent's latency and cost?
Run independent tool calls in parallel, route easy steps (classification, extraction) to smaller models, cache the stable prompt prefix, trim context and cap output per step, stream the final…
-
How do you design tool definitions so the model doesn't misuse them?
Give each tool one clear job and a specific name, describe when to use and not use it, type and constrain parameters (formats, enums, ranges, required fields, no extra properties), validate strictly…
-
How do you protect an agent from prompt injection through tool results?
Treat tool results and retrieved content as untrusted data: label and delimit them, never let them change permissions, enforce authorisation in tool code based on the authenticated user, require…
-
How do you choose between building your own agent loop and using a framework?
Start with a plain loop to learn what your agent needs; adopt a framework when you need what it provides: built-in tools and context management (agent SDKs), explicit stateful graphs with…
-
How do you give an agent memory across sessions?
Store facts and summaries outside the context (a database or memory files), retrieve the relevant ones at the start of a session or through a memory tool, and let the agent write new memories…
-
How would you sandbox an agent that can run code?
Run code in an isolated environment (container or micro-VM) with no access to production credentials, a restricted filesystem, limited or allowlisted network egress, CPU, memory and time limits, and…