β Human-in-the-Loop & Approvals
What you'll learn
How to pause pipelines for manual review, safety checks, or compliance approvals. Not everything should be automated β deployment to production often needs a human "thumbs up."
Inject human intelligence into automated workflows with approval gates that pause execution and wait for human decisions.
Why Human Review Matters π€
| Use Case | Example |
|---|---|
| Safety | "Does this model output look safe?" |
| Compliance | "Has Legal approved this dataset?" |
| Quality Assurance | "Is the generated image high quality?" |
| Cost Control | "Approve spending $500 on this training run?" |
| Deployment | "Ready to deploy to production?" |
β Approval Steps
Insert an approval step anywhere in your pipeline to pause execution:
How It Works
sequenceDiagram
participant Pipeline
participant Approval as approval step
participant Human
participant Deploy as deploy step
Pipeline->>Approval: Execute
Approval-->>Human: π Notification (Slack/Email)
Note over Approval: βΈοΈ Pipeline paused
Human->>Approval: β
Approve / β Reject
alt Approved
Approval->>Deploy: Continue pipeline
else Rejected
Approval->>Pipeline: Pipeline stopped
end
Interactive CLI Approval π»
When running locally, the pipeline pauses and prompts in the terminal:
Auto-Approval Logic π€
Define conditions for automatic approval β useful for CI/CD environments or non-production stages:
| Environment | Behavior |
|---|---|
staging |
Auto-approved, no human needed |
production |
Pauses and waits for human approval |
Approval Parameters βοΈ
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
str |
required | Step name |
approver |
str |
required | Team or person to approve |
timeout_seconds |
int |
3600 |
Max wait time (default: 1 hour) |
auto_approve_if |
Callable |
None |
Lambda for conditional auto-approval |
Real-World Examples π
Multi-Stage Approval
Cost Approval Gate
π§ Notifications
Approvers can be notified via configured channels when their attention is required. See Notifications for setup.
Combine with notifications
Configure Slack or email notifications so approvers get pinged immediately β don't make them check a dashboard.