Chaining
- When your workflow should allow inputs to proceed through several sequential steps, but only if they meet specific criteria at defined checkpoints (gates).
- For early validation or sanity checks, where you want to filter out invalid, undesired, or low-quality cases before investing additional resources in deeper processing.
- To implement "fail-fast" behavior, stopping the process as soon as a key requirement is not satisfied (quality gating or exception handling).
- When controlled access to further workflow steps is necessary, for cost, quality, or security reasons.
- Whenever you want to provide clear, divergent outcomes for pass/fail branches early in a process.
Example
- The prompt reads a new job application PDF.
- Step 1: Extract applicant data (Prompt 1)—parse experience and key skills from the application.
- Step 2: Gate—check if candidate meets minimum years of experience and must-have skills (Prompt 2).
- If 'fail', generate a polite rejection and exit the workflow immediately.
- If 'pass', continue.
- Step 3: For passing cases, run deeper review (Prompt 3)—evaluate project history, score overall fit.
- Step 4: Optionally, a final expert/HR summary (Prompt 4)—produce an actionable note for HR or next decision-maker.
- Output: Passing applications proceed with a complete evaluation and summary; failing applications are notified quickly and do not consume further resources.