learn.web Back to the curriculum ↗

Context / Tools / Evals / Safety / 04

Retrieval, tools, and agents

Ground answers, constrain actions, design permissions, and separate planning from consequential execution.

Time
95 min
Mode
Learn → Make → Check
Path
AI Product Engineering

By the end, you can…

Grounding and action are different systems

Retrieval selects evidence; generation synthesizes an answer. Evaluate both: did retrieval find the right sources, and did the answer stay faithful to them? A fluent answer cannot repair missing evidence.

Tools let a model read data or perform actions. Each tool needs a narrow purpose, schema, permission check, timeout, error policy, and observable trace.

Design the authority boundary

Use least privilege and separate read from write tools. Show a preview before sending, deleting, purchasing, or publishing. Confirmation must describe the exact action and target.

Treat tool results as untrusted data. Prevent retrieved text from changing permissions or bypassing confirmation. Idempotency and undo reduce damage from retries.

Your studio task

Make — Design one tool call with a narrow schema, permission boundary, preview, and confirmation step.

  1. Draw retrieval, generation, tool, permission, and confirmation boundaries.
  2. Define one narrow tool schema and validation rules.
  3. Add preview and explicit confirmation for writes.
  4. Test prompt injection, duplicate calls, timeout, partial failure, and undo.
Definition of done

Untrusted content cannot silently expand authority or trigger an irreversible action.

Open the interactive lesson with its workspace ↗

Knowledge check

Who should enforce whether a tool call is authorized?
  1. The model’s natural-language promise
  2. Trusted application code and permission policy
  3. The retrieved webpage
Reveal answer (B)

Authorization must be deterministic and outside the model’s control.

Tool design should…
  1. Use narrow schemas and least privilege
  2. Give the model every permission
  3. Skip validation for speed
Reveal answer (A)

Narrow tools and least privilege keep authority boundaries enforceable.