org.llm4s.agent.orchestration

Members list

Type members

Classlikes

class CancellationException(message: String) extends RuntimeException

Exception thrown when an operation is cancelled

Exception thrown when an operation is cancelled

Attributes

Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

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

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
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class Edge[A, B](id: String, source: Node[_, A], target: Node[A, B], description: Option[String])

A typed edge connecting two nodes in the DAG Ensures compile-time type safety: output type of source must match input type of target

A typed edge connecting two nodes in the DAG Ensures compile-time type safety: output type of source must match input type of target

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object MDCContext

Thread-safe MDC context management for async operations. Preserves MDC context across thread boundaries. This file needs try-finally to ensure MDC context is restored.

Thread-safe MDC context management for async operations. Preserves MDC context across thread boundaries. This file needs try-finally to ensure MDC context is restored.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
MDCContext.type
case class Node[I, O](id: String, agent: TypedAgent[I, O], description: Option[String])

A node in the execution graph representing an agent with typed input/output

A node in the execution graph representing an agent with typed input/output

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait OrchestrationError extends LLMError

Orchestration-specific error types following LLM4S error patterns

Orchestration-specific error types following LLM4S error patterns

Attributes

Companion
object
Supertypes
trait LLMError
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case class Plan(nodes: Map[String, Node[_, _]], edges: List[Edge[_, _]], entryPoints: List[Node[_, _]], exitPoints: List[Node[_, _]])

A complete execution plan represented as a DAG

A complete execution plan represented as a DAG

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Plan

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Plan.type
class PlanRunner(maxConcurrentNodes: Int)

Executes DAG plans with topological ordering and parallel execution.

Executes DAG plans with topological ordering and parallel execution.

Value parameters

maxConcurrentNodes

Maximum number of nodes that can execute in parallel (default: 10). Used to prevent resource exhaustion in large DAGs. Follows LLM4S patterns:

  • Uses AsyncResult[_] (Future[Result[_]]) for async operations
  • Structured logging with MDC context
  • Proper error types from OrchestrationError
  • Result.safely for exception handling
  • Standard Future combinators

Attributes

Note

MDC context is preserved across async boundaries using MDCContext utility.

Supports cancellation via CancellationToken for long-running operations.

Example
val runner = PlanRunner(maxConcurrentNodes = 5)
val token = CancellationToken()
val result = runner.execute(plan, Map("input" -> data), token)
Companion
object
Supertypes
class Object
trait Matchable
class Any
object PlanRunner

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
PlanRunner.type
object Policies

Execution policies for agents (retry, timeout, fallback) following LLM4S patterns.

Execution policies for agents (retry, timeout, fallback) following LLM4S patterns.

Uses:

  • AsyncResult[_] (Future[Result[_]]) for async operations
  • Structured logging with MDC context
  • ErrorRecovery patterns for intelligent retry
  • Proper OrchestrationError types
  • Result.safely for exception handling

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Policies.type
trait TypedAgent[I, O]

Typed agent abstraction for multi-agent orchestration.

Typed agent abstraction for multi-agent orchestration.

A TypedAgent represents a computation that takes input of type I and produces output of type O. Agents are composable and can be wired together in DAGs with compile-time type safety.

Follows LLM4S patterns:

  • Uses AsyncResult[_] (Future[Result[_]]) for async operations
  • Uses Result[_] for error handling
  • Structured logging with context
  • Proper error types from OrchestrationError
  • Safe execution with Result.safely

Type parameters

I

Input type

O

Output type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object TypedAgent

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
TypedAgent.type