Agents, Tool Use & MCP·Question 5 of 90Basic

A teammate says "the model executes the tool." What's wrong with that, and why does the distinction matter?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The model never executes anything - it emits a structured request (tool name + JSON args), and your client code executes it. The model is a text-in, text-out function; all side effects live in your runtime. This sounds pedantic but drives most of the engineering consequences:

  • Security is your job. Since your code performs the action, argument validation, permission checks, sandboxing, and least-privilege credentials all belong in the execution layer. "The model might do something dangerous" really means "my code will do whatever the model asks unless I gate it."
  • Hallucinated calls are expected input. The model can request nonexistent tools or invalid arguments. Your executor must handle that gracefully - return an actionable error as the tool result ("no such tool; available: ...") rather than crashing the loop.
  • Retries and idempotency are yours. If execution times out and you retry, and the tool was charge_customer, that's a double charge. The model has no concept of at-least-once vs exactly-once delivery; your executor needs idempotency keys for side-effectful tools.
  • Nothing happens implicitly. If you never execute the call and never return a result, the trajectory just stalls. Conversely, you can intercept: log, require human approval, dry-run, rewrite arguments, or route to a mock in tests - the interception point is a feature.
  • Latency accounting. Tool time is your infrastructure's time. A "slow agent" is often a slow tool, visible only if you trace execution separately from model calls.
Full worked answer

The model never executes anything - it emits a structured request (tool name + JSON args), and your client code executes it. The model is a text-in, text-out function; all side effects live in your runtime. This sounds pedantic but drives most of the engineering consequences:

  • Security is your job. Since your code performs the action, argument validation, permission checks, sandboxing, and least-privilege credentials all belong in the execution layer. "The model might do something dangerous" really means "my code will do whatever the model asks unless I gate it."
  • Hallucinated calls are expected input. The model can request nonexistent tools or invalid arguments. Your executor must handle that gracefully - return an actionable error as the tool result ("no such tool; available: ...") rather than crashing the loop.
  • Retries and idempotency are yours. If execution times out and you retry, and the tool was charge_customer, that's a double charge. The model has no concept of at-least-once vs exactly-once delivery; your executor needs idempotency keys for side-effectful tools.
  • Nothing happens implicitly. If you never execute the call and never return a result, the trajectory just stalls. Conversely, you can intercept: log, require human approval, dry-run, rewrite arguments, or route to a mock in tests - the interception point is a feature.
  • Latency accounting. Tool time is your infrastructure's time. A "slow agent" is often a slow tool, visible only if you trace execution separately from model calls.

The one-line version for interviews: the model proposes, the runtime disposes - and everything hard about agents (safety, reliability, observability) lives on the disposal side.

What a good answer covers

  • The model never executes anything - it emits a structured request (tool name + JSON args), and your…
  • The model is a text-in, text-out function; all side effects live in your runtime
  • Security is your job
  • Hallucinated calls are expected input
  • Retries and idempotency are yours

Key terms: Security is your job · Hallucinated calls are expected input · Retries and idempotency are yours · Nothing happens implicitly · Latency accounting

Interviewer follow-ups to expect

  1. Where would you implement human approval for a delete_records tool - in the prompt or the executor, and why?

  2. How do you test an agent without real side effects?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep