1.4 — Workflow Enforcement and Handoff

CCAR-F Domain 1 · Task 1.4

What You Need to Know

Some agent workflows have steps that must run in a set order. Prompt-based guidance sets that order with a system prompt instruction. Programmatic enforcement sets it in code: hooks, prerequisite gates or code-level checks that physically block downstream tools until their prerequisites complete.

Prompt Guidance Versus Programmatic Enforcement

A prompt instruction works most of the time (perhaps 90-95%). It still has a non-zero failure rate because the model is probabilistic. A gate works every time — it is code, so it is deterministic.

Decision rule: If a single failure would cause financial loss, a security breach or a compliance violation, use programmatic enforcement.

  • Financial operations (refunds, transfers, payments) → programmatic
  • Security operations (identity verification, access control) → programmatic
  • Compliance operations (AML checks, regulatory requirements) → programmatic
  • Low-stakes operations (formatting, style) → prompt guidance is acceptable

How a Prerequisite Gate Works

  1. The gate checks whether a prior condition has been met for this session.
  2. If yes, the tool executes normally.
  3. If no, the tool returns an error telling the model to complete the prerequisite first.

The model cannot bypass the gate.

Subagent Lifecycle Hooks

  • SubagentStart: fires when a subagent is spawned. Can add additionalContext. Cannot block.
  • SubagentStop: fires when a subagent finishes. Can validate output (exit code 2 keeps the subagent running). Cannot rewrite the result.

Subagents can define their own hooks in frontmatter, scoped to their lifetime.

Multi-Concern Request Handling

  1. Decompose the request into distinct items.
  2. Investigate each in parallel using shared context.
  3. Synthesise a unified resolution that addresses all items in a single response.

Structured Handoff Protocols

When escalating to a human, the handoff summary must be self-contained and include:

  • Customer ID
  • Conversation summary
  • Root cause analysis
  • Refund amount (if applicable)
  • Recommended action

Exam Traps

  • Enhanced system prompt / few-shot as the fix for high-stakes compliance failures
  • Handling multi-concern requests sequentially across separate replies
  • Incomplete handoff summaries

Check your understanding

Practice Scenario

Production data shows that in 8% of cases an agent processes refunds without verifying account ownership. The system prompt already tells it to check first. What is the most appropriate fix?

Report issue

Log in to save your progress.