Advanced14 min

Multi-Step Workflows & Handoffs

Designing multi-step agent workflows with programmatic enforcement of prerequisites, structured handoff protocols for human escalation, and strategies for decomposing multi-concern customer requests into parallel investigations. Learn why prompt-based guidance alone is insufficient for critical compliance.

Quick Reference

  • Programmatic enforcement (hooks, gates) guarantees compliance; prompt instructions have a non-zero failure rate
  • Use prerequisite gates to block dangerous operations until verification steps complete
  • Structured handoff summaries include: customer ID, conversation summary, root cause, recommended action, urgency
  • Multi-concern requests should be decomposed into parallel investigations, not handled sequentially
  • Critical business logic (refunds, account changes, data deletion) MUST use programmatic enforcement
  • Prompt instructions are appropriate for style preferences, communication tone, and non-critical behavior
  • Handoff protocols should compile ALL relevant context so the receiving agent/human can act immediately
  • Checkpoint strategies allow resuming workflows from the last successful step after failures
  • Escalation criteria should be deterministic (threshold-based), not probabilistic (prompt-based)
  • Test workflow enforcement by deliberately attempting to bypass prerequisites -- they should be impossible to skip

Programmatic Enforcement vs Prompt-Based Guidance

Critical Exam Concept

When deterministic compliance is required, prompt instructions alone are insufficient. This is one of the most heavily tested concepts in the entire exam. Prompts are probabilistic -- even well-crafted instructions have a non-zero failure rate. For critical business logic (financial transactions, data deletion, access control), you must use programmatic enforcement.

get_customerStep 1lookup_orderStep 2process_refundStep 3verified?PASSpolicy checkPASSthreshold?BLOCKescalate_to_humanGate passed (prerequisite met)Gate blocked (escalation needed)

Programmatic gates enforce prerequisites before each workflow step

The distinction between programmatic enforcement and prompt-based guidance is fundamental to production agent design. Prompt instructions work by asking the model to follow rules. Programmatic enforcement works by making it impossible to break rules. When the consequences of a rule violation are severe (processing unauthorized refunds, deleting data without confirmation, escalating without context), you need the latter.

AspectProgrammatic EnforcementPrompt-Based Guidance
Compliance guarantee100% -- impossible to bypassHigh but not 100% -- non-zero failure rate
ImplementationHooks, gates, code-level blocksSystem prompt instructions, few-shot examples
Appropriate forFinancial transactions, data deletion, access control, regulatory complianceCommunication style, response format, non-critical preferences
Failure modeBlocked action with clear error messageSilently violated instruction -- user may not notice
AuditabilityEvery enforcement creates a log entryNo reliable audit trail for instruction adherence
FlexibilityRigid by design -- rules cannot be bentFlexible -- model can adapt rules to context