Friday, August 21, 2026

    Apply Agent SDK hooks for tool call interception and data normalization

    Domain 1 — Agentic Architecture & Orchestration · 27% of the exam

    Task statement 1.5

    Apply Agent SDK hooks for tool call interception and data normalization

    What you should be able to do
    • Use a PostToolUse hook to normalise heterogeneous tool output before the model ever sees it.
    • Intercept an outgoing tool call to block an action that violates a business rule, and redirect it.
    • Choose hooks over prompt instruction when a rule needs a guarantee rather than a high probability.
    • Say what a hook is the wrong instrument for.
    Exam traps (6)

    Describe the different timestamp and status formats in the system prompt so the model can reconcile them.

    Every call then re-does a mechanical conversion probabilistically, and a mis-parsed date is indistinguishable from a real one downstream.

    Normalise deterministically in a PostToolUse hook. The model should receive one shape and spend its reasoning elsewhere.

    Add a reviewer subagent that checks whether an action breaches the spend threshold.

    Right idea, wrong architectural tier — another probabilistic component reviewing a probabilistic one, and it cannot actually stop the call.

    A threshold is arithmetic. Intercept the outgoing call and block it.

    Use a PostToolUse hook to stop a policy-violating action.

    PostToolUse runs after the tool has executed, so the action — a refund issued, a record written, a deploy started — has already happened by the time the hook sees it.

    Prevention intercepts the outgoing call; PostToolUse is for transforming what comes back.

    Log the violation and let the call through, so nothing legitimate is ever blocked.

    A log is a record that the control did not act. The policy is documented and unenforced.

    Block, then redirect into the workflow that can approve it — usually human escalation.

    Move every rule into hooks, since deterministic beats probabilistic.

    Judgement calls encoded as hooks turn into brittle heuristics that fire on cases nobody anticipated, and the agent loses the discretion it was chosen for.

    Hooks carry rules you can state exactly. Everything else stays a matter of prompt and judgement.

    Use a SubagentStop hook to clean up or rewrite a subagent's output before the coordinator sees it.

    Neither lifecycle hook rewrites subagent output. SubagentStop can block completion with a reason, which sends the subagent back to work — it cannot edit what comes back, so a hook written to reshape the result silently does nothing.

    SubagentStart observes spawning; SubagentStop gates completion by blocking with a reason. To change the shape of a result, normalise it in a PostToolUse hook or have the coordinator do it — to reject a result, block it and say why.

    Primary sources
    Know cold
    • Hook
    • PostToolUse hook
    • Guardrail
    • Kill switch / circuit breaker

    6 practice questions in the bank are tagged to this task statement.

    Practise this task in context: open it inside the interactive study guide, which carries the concept cards, the mock quiz and the practice simulation.

    Blueprint-aligned independent practice. Koko's scenarios and company facts are fictional and synthetic. This aid does not reproduce official exam questions or Anthropic's undisclosed scoring model, and is not affiliated with or endorsed by Anthropic.