Policies

org.llm4s.agent.orchestration.Policies
object Policies

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

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Policies.type

Members list

Value members

Concrete methods

def withFallback[I, O](primary: TypedAgent[I, O], fallback: TypedAgent[I, O]): TypedAgent[I, O]

Add fallback policy to an agent with proper error context

Add fallback policy to an agent with proper error context

Attributes

def withPolicies[I, O](agent: TypedAgent[I, O], retry: Option[(Int, FiniteDuration)], timeout: Option[FiniteDuration], fallback: Option[TypedAgent[I, O]]): TypedAgent[I, O]

Combine multiple policies with proper ordering and error handling

Combine multiple policies with proper ordering and error handling

Attributes

def withRetry[I, O](agent: TypedAgent[I, O], maxAttempts: Int, backoff: FiniteDuration): TypedAgent[I, O]

Add retry policy to an agent using LLM4S ErrorRecovery patterns

Add retry policy to an agent using LLM4S ErrorRecovery patterns

Attributes

def withTimeout[I, O](agent: TypedAgent[I, O], timeout: FiniteDuration): TypedAgent[I, O]

Add timeout policy to an agent using proper error types

Add timeout policy to an agent using proper error types

Attributes