Skip to main content
Any step can stop the workflow early by returning a StepOutput with stop=True. Here, a validation step checks the incoming data and halts the workflow before the processing steps run if the data is bad. Use this pattern for validation, security, or quality gates that must prevent downstream steps from running. Install dependencies:

Set OpenAI Key

Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
early_stop_workflow_with_agents.py

Run