CancellationToken

org.llm4s.agent.orchestration.CancellationToken
See theCancellationToken companion object

Token for cancelling long-running orchestration operations. Thread-safe and can be checked from any thread.

Attributes

Note

For operations with many nodes, use cachedCancellationFuture instead of cancellationFuture to avoid callback accumulation.

Example
val token = CancellationToken()
val runner = PlanRunner()
val result = runner.execute(plan, inputs, token)
// Cancel from another thread
token.cancel()
Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def cancel(): Unit

Request cancellation

Request cancellation

Attributes

def cancellationFuture: Future[Nothing]

Create a Future that fails with CancellationException when cancelled. Note: For long-running operations with many nodes, consider caching this future to avoid accumulating callbacks.

Create a Future that fails with CancellationException when cancelled. Note: For long-running operations with many nodes, consider caching this future to avoid accumulating callbacks.

Attributes

def isCancelled: Boolean

Check if cancellation has been requested

Check if cancellation has been requested

Attributes

def onCancel(callback: => Unit): Unit

Register a callback to be called when cancellation is requested

Register a callback to be called when cancellation is requested

Attributes

def throwIfCancelled(): Unit

Check cancellation and throw if cancelled

Check cancellation and throw if cancelled

Attributes

Concrete fields

lazy val cachedCancellationFuture: Future[Nothing]

Create a cached cancellation future that can be reused across multiple operations to avoid callback accumulation.

Create a cached cancellation future that can be reused across multiple operations to avoid callback accumulation.

Attributes