Skip to main content
This example demonstrates how to cancel a running agent execution by starting an agent run in a separate thread and cancelling it from another thread. It shows proper handling of cancelled responses and thread management.

Example

agent_cancel_run.py

API Endpoint

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