Human-in-the-loop (HITL) workflows pause execution to wait for human approval, input, or decisions before continuing. This is essential for sensitive operations like financial transactions, data deletions, or any action requiring human oversight.Documentation Index
Fetch the complete documentation index at: https://polos.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Basic suspend and resume
Usectx.step.suspend() to pause workflow execution and wait for external input:
- Agent creates a structured action plan
- Workflow suspends with plan details
- Worker suspends execution (no compute consumed)
- An event is emitted with suspend details
- Workflow waits indefinitely (or until timeout)
- When resume event arrives, workflow continues with the provided data
Suspend events
When a workflow suspends, Polos emits an event to a topic specific to that suspension: Topic format:{step_key}/{execution_id}
Event:
Listening for suspend events
Stream workflow events to detect when a workflow suspends:Resuming workflows
To resume a suspended workflow, emit a resume event to the same topic:Complete example
Here’s a full approval workflow with suspend/resume:Building approval UIs
The slack message has an approval URL of https://admin.example.com/approve/{execution_id}. When a human clicks the URL and makes a decision, your approval endpoint can call the Polos API to resume the workflow.Timeouts
Suspensions can have timeouts to prevent workflows from waiting indefinitely:Multiple approvals
Handle multi-stage approvals:Key takeaways
ctx.step.suspend()pauses workflow execution and waits for external input- No compute consumed while suspended — workflows can wait hours or days
- Detect suspension by streaming workflow events with
events.stream_workflow() - Resume with
client.resume()providing workflow ID, execution ID, step key, and decision data - Use timeouts to prevent indefinite waiting
- Build approval UIs by listening to suspend events and calling resume API
- Multi-stage approvals supported with multiple suspend steps