Skip to content
Tech Interview Prep
Technical interview guide

LLM Agents & Tool Use

Letting an LLM decide which actions to take (calling tools, APIs, or other models) rather than just generating text.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: ReAct, Toolformer, MRKL, Gorilla, AgentBench, WebArena, SWE-bench, JSON Schema 2020-12, OpenAPI 3.1.1, NIST AI RMF, and OWASP GenAI agent risks reviewed 2026-09-06.

Overview

Curated: · Written: · Reviewed:

LLM Agents & Tool Use

In one line

An LLM agent lets a model choose tool calls (APIs, other models, code) across several steps instead of answering in one pass. Reach for it when the answer depends on live state or the task has side effects, and treat the model as an untrusted planner: deterministic code owns identity, authorization, validation, budgets, execution and completion.

Key definitions

  • Tool contract: name, description, JSON Schema, effect class, auth context, idempotency semantics, timeout, error schema, rollback story.
  • Schema validation: checks shape and types only. It does not authorize anything.
  • Authorization at execution: the executor checks the authenticated subject, tenant and exact object/action/state, recomputed at call time.
  • Idempotency key: a stable key reused on every retry of the same operation, so the provider can deduplicate it.
  • Completion condition: a verified end state (for example a settled ledger entry), not the model's final message.
  • Observation: any tool result or retrieved text. It is data, never policy.

Formulas and complexity

trun≈nsteps×tstep=30×1.2 s=36 st_{run} \approx n_{steps} \times t_{step} = 30 \times 1.2\,\text{s} = 36\,\text{s}

The step cap bounds cost and time per run. It does not stop repeated identical calls inside the cap.

How it works

The model proposes a call with arguments. The kernel validates the schema, resolves subject and tenant from the session (never the prompt), authorizes the exact target, and applies any approval gate. The executor runs the call with an idempotency key, then checks the result against the expected state before the model sees it as an observation. The loop ends only when a verified completion check passes or a budget trips.

yes no continue done or stop Model proposes call Schema validation Authorize subject, tenant, exact object Policy needs approval? Approval bound to action hash Execute with idempotency key Verify state, wrap result as data Completion check or budget Report known, unknown, recoverable

When to use and when not to

SituationUse an agent loopPrefer fixed code or a single call
Steps depend on live resultsYesNo
Path is known in advanceNoYes
Read-only lookupsYes, with budgetsYes
Irreversible writesOnly behind approval and idempotent commitFixed workflow with checks
Broad shell, SQL or HTTP accessNo, use narrow domain toolsNo

Traps interviewers probe

  • Trusting the guard model. A second LLM that reads the ticket can be fooled by the same text. Fix: check the proposal against the order record in code (order total, original payment method, amount cap).
  • Treating schema as security. A pattern like ^/data/ accepts /data/../tenants/acme/x, and a tenant-agnostic handler will act on it. Fix: canonicalize the path and authorize it against the caller's tenant.
  • Retrying side effects with fresh keys. A new UUID per attempt makes the provider see a new refund. Fix: generate the key once per logical operation and reuse it on every retry.
  • Declaring completion from a 202. Acceptance is not settlement. Fix: poll or subscribe to the terminal settled state, and treat failure states as failures.
  • Approving the proposal instead of the action. Edits after approval slip through. Fix: bind approval to a canonical action hash and expiry, and have the executor recheck it before execution.

Interview tips

Open with the trust boundary: the model proposes, deterministic code decides and executes. Name the effect class of the tool first, because that sets the controls.

Expected follow-ups:

  • How do you stop a retry from duplicating a charge? (Same idempotency key, provider-side dedupe window, reconcile unknown outcomes by key before retrying.)
  • Where does the policy check live when several clients share a tool executor? (In the executor, keyed on caller identity, not the prompt.)
  • How do you detect a stuck loop? (Hash observable state per step; identical state plus repeated identical calls triggers a stop.)
  • How do you contain a runaway agent? (Revoke the credential or stop the consumer at the executor or provider, not only the agent's own flag.)

30-second outline: "The model only proposes. Each call passes schema validation, then authorization on the exact object and tenant from the session, then approval if policy requires it. Side effects carry one idempotency key across retries. Completion is a verified end state, and the loop stops on a budget or a repeated no-progress state. Tool output is data, not instructions, and every effect is audited with its policy decision."

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.