Skip to content

pi_llm_agent.cancellation

cancellation

Cooperative cancellation token — Python equivalent of AbortSignal.

Passed to tool execute() and hook callbacks so they can check for and respond to cancellation requests from the agent loop.

CancellationToken()

Lightweight wrapper around asyncio.Event for cooperative cancellation.

is_cancelled property

Whether cancellation has been requested.

cancel()

Signal cancellation (like AbortController.abort()).

wait() async

Block until cancellation is signalled.