ToolExecutionConfig

org.llm4s.toolapi.ToolExecutionConfig
See theToolExecutionConfig companion object
@Stable
final case class ToolExecutionConfig

Controls timeout and retry behaviour for tool calls executed through a ToolRegistry.

A default configuration applies no timeout and no retry, preserving the original single-attempt execution behaviour. Build one with ToolExecutionConfig.apply (or start from ToolExecutionConfig.default) and change it with the with* setters; the constructor and copy are private, so a new field never breaks callers. Pass a configuration to ToolRegistry.execute, ToolRegistry.executeAsync, or ToolRegistry.executeAll when a tool call should fail after a bounded duration or retry transient failures before returning an error.

Value parameters

retryPolicy

optional retry policy for errors considered retryable by ToolCallError.isRetryable

timeout

optional maximum duration to wait for each individual tool call before returning ToolCallError.Timeout

Attributes

Example
import org.llm4s.toolapi._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
val config = ToolExecutionConfig.default
 .withTimeout(5.seconds)
 .withRetryPolicy(ToolRetryPolicy(maxAttempts = 3, baseDelay = 200.millis))
val registry = new ToolRegistry(Seq(myTool))
registry.execute(request, config)
registry.executeAll(requests, ToolExecutionStrategy.ParallelWithLimit(2), config)
Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Sets the retry policy for retryable tool errors.

Sets the retry policy for retryable tool errors.

Attributes

Sets, or with None removes, the retry policy for retryable tool errors.

Sets, or with None removes, the retry policy for retryable tool errors.

Attributes

def withTimeout(timeout: FiniteDuration): ToolExecutionConfig

Sets the maximum duration to wait for each individual tool call.

Sets the maximum duration to wait for each individual tool call.

Attributes

def withTimeout(timeout: Option[FiniteDuration]): ToolExecutionConfig

Sets, or with None removes, the maximum duration to wait for each individual tool call.

Sets, or with None removes, the maximum duration to wait for each individual tool call.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product