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

Example

agent_cancel_run.py

Usage

1

Set up your virtual environment

2

Install dependencies

3

Run example

API Endpoint

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