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
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.
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.
| Aspect | Programmatic Enforcement | Prompt-Based Guidance |
|---|---|---|
| Compliance guarantee | 100% -- impossible to bypass | High but not 100% -- non-zero failure rate |
| Implementation | Hooks, gates, code-level blocks | System prompt instructions, few-shot examples |
| Appropriate for | Financial transactions, data deletion, access control, regulatory compliance | Communication style, response format, non-critical preferences |
| Failure mode | Blocked action with clear error message | Silently violated instruction -- user may not notice |
| Auditability | Every enforcement creates a log entry | No reliable audit trail for instruction adherence |
| Flexibility | Rigid by design -- rules cannot be bent | Flexible -- model can adapt rules to context |