Skip to content
Claude Certified Architect – Foundations (CCAR-F) Exam Prep

Lesson 4 of 30 · 6 min

x
4/30

Workflow Enforcement and Handoff

Video lesson: CCAR-F 04/30: Workflow Enforcement and Handoff

Core principle (design guidance)

Prompt instructions are probabilistic: the model usually follows them, but not always. When a failure is costly (money, security, compliance, ordering of steps), enforce the rule deterministically outside the model.

NeedUse
Style, tone, preferences, judgement callsPrompt instructions
"Step B must never run before step A succeeded"Programmatic gate (code or a PreToolUse hook)
"Refunds over a limit need approval"Hook or application check that blocks and routes to a human
Normalising or redacting tool dataPostToolUse hook (updatedToolOutput, additionalContext)

Enforcement mechanisms

  • A PreToolUse hook can return permissionDecision of allow, deny, ask or defer, with permissionDecisionReason. A deny blocks the call and the reason tells the model why, so it does not keep retrying.
  • Returning defer ends the turn with stop_reason: "tool_deferred", so the call can be resumed later, for example after a human decides.
  • Tool restriction (tools on a subagent) removes capability entirely; a missing tool cannot be misused.
  • See 1.5 for hook mechanics.

Prerequisite gating pattern (design guidance)

Make the order structural: the later tool (for example process_refund) is only exposed or only allowed once the earlier step (for example verify_customer) has produced a validated result. Do not rely on "always verify first" in the system prompt.

Handoff (design guidance)

When an agent escalates to a human or another agent, the receiver has none of the conversation. Hand off a self-contained, structured summary:

  • who or what the case is about (ids)
  • what was asked and what was already done (actions, results)
  • current state and the specific blocker or reason for escalation
  • the recommended next step

Exam traps

  • "Add a stronger instruction" as the fix for a rule that must never be broken. The exam answer is a programmatic gate.
  • Hooks that mutate shared state in a fixed order. Matching hooks run in parallel; completion order is non-deterministic, and when decisions conflict the most restrictive wins (deny over defer over ask over allow).
  • Handoff as "see the transcript".

References

  1. Hooks in the SDK — checked Oct 16, 2026

Check your understanding

  • A refund over a threshold must never be auto-approved. Prompt or code?Show answer

    Answer

    Code or hook that blocks and escalates.
  • Two PreToolUse hooks disagree (allow vs deny). Result?Show answer

    Answer

    deny wins.
  • What must an escalation summary contain?Show answer

    Answer

    Identifiers, actions taken, current state and blocker, recommended next step.
Previous

Progress is saved in this browser.

Next Lesson