Skip to main content
Cancel a running workflow execution by starting the run in one thread and cancelling it from another. The example also shows how to handle cancelled responses.

Example

workflow_cancel_run.py

Usage

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

Set OpenAI Key

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

Run example

API Endpoint

Workflow runs can be cancelled via the AgentOS API:
Example:
Reference: Cancel Workflow Run API