1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Worked Example: Repo Review Agent

A complete Claude Agent SDK agent: a custom diff tool, a stripped tool surface, a per-call path gate, an audit hook, a reviewer subagent, and a budget cap — structurally unable to modify what it reviews.

Last updated

After this section you can

  • Assemble custom tools, permissions, hooks, a subagent and budgets into one agent
  • Make a read-only agent read-only structurally rather than by prompt
  • Explain what each control catches that the others do not
37

Worked Example: Repo Review Agent

One file that puts every control in this track on a single agent: a custom tool, a stripped tool surface, a per-call path gate, an audit hook, a subagent, and a budget it cannot exceed.

THE CENTRAL IDEA

A review agent should be structurally incapable of changing the code it reviews. That is not a prompt instruction — it is disallowed_tools plus a path check. If the only thing stopping a write is the system prompt, there is nothing stopping it.

Every control from this track, on one agent
TOOL SURFACE changed_files + Read/Grep/Glob Write, Edit, Bash removed PER-CALL GATE PreToolUse hook every path stays inside the repo SUBAGENT reviewer one file, its own context window BOUNDS max_budget_usd = 1.00 max_turns = 20 One hook does both · every call logged with its tool_use_id the audit trail exists whether or not anything was blocked Four independent layers. Remove any one and the agent still runs — which is exactly why each has to be decided on purpose.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium