Package-level declarations

Types

Link copied to clipboard
abstract class AbstractToolExecutor(val tool: Tool) : ToolExecutor

Abstract base class for tool executors. Provides common validation and error handling patterns.

Link copied to clipboard

Circuit breaker implementation for tool execution reliability.

Link copied to clipboard
data class CircuitBreakerConfig(val failureThreshold: Int = 5, val recoveryTimeoutMs: Long = 60000, val successThreshold: Int = 2)

Configuration for circuit breaker behavior.

Link copied to clipboard

Possible states for a circuit breaker.

Link copied to clipboard

Default implementation of ToolRegistry.

Link copied to clipboard

Categories for classifying different types of tool execution errors.

Link copied to clipboard

Default tool response handler that logs responses. Applications should provide their own implementation to send responses back to agents.

Link copied to clipboard

Available retry strategies for failed tool executions.

Link copied to clipboard
data class ToolErrorConfig(val maxRetryAttempts: Int = 3, val baseRetryDelayMs: Long = 1000, val maxRetryDelayMs: Long = 30000, val retryStrategy: RetryStrategy = RetryStrategy.EXPONENTIAL_JITTER, val retryOnResourceErrors: Boolean = true, val retryOnUnknownErrors: Boolean = false, val maxHistorySize: Int = 100, val circuitBreakerConfig: CircuitBreakerConfig = CircuitBreakerConfig())

Configuration for tool error handling behavior.

Link copied to clipboard
sealed class ToolErrorDecision

Represents a decision on how to handle a tool execution error.

Link copied to clipboard
class ToolErrorHandler(config: ToolErrorConfig = ToolErrorConfig())

Comprehensive error handling and recovery system for tool execution.

Link copied to clipboard
data class ToolErrorStats(val toolName: String, val totalAttempts: Int, val recentFailures: Int, val circuitBreakerState: CircuitBreakerState, val lastErrorTime: Instant?)

Comprehensive statistics about tool execution errors and performance.

Link copied to clipboard
data class ToolExecutionAttempt(val toolCall: ToolCall, val error: Throwable, val attempt: Int, val timestamp: Instant)

Record of a single tool execution attempt.

Link copied to clipboard
data class ToolExecutionContext(val toolCall: ToolCall, val threadId: String? = null, val runId: String? = null, val metadata: Map<String, Any> = emptyMap())

Context provided to tool executors during execution.

Link copied to clipboard
sealed class ToolExecutionEvent

Events emitted during tool execution lifecycle.

Link copied to clipboard
class ToolExecutionException(message: String, cause: Throwable? = null, val toolName: String? = null, val toolCallId: String? = null) : Exception

Exception thrown when tool execution fails in an unrecoverable way.

Link copied to clipboard
class ToolExecutionManager(toolRegistry: ToolRegistry, responseHandler: ToolResponseHandler)

Manages the complete lifecycle of tool execution.

Link copied to clipboard
data class ToolExecutionResult(val success: Boolean, val result: JsonElement? = null, val message: String? = null)

Result of a tool execution.

Link copied to clipboard
data class ToolExecutionStats(val executionCount: Long = 0, val successCount: Long = 0, val failureCount: Long = 0, val totalExecutionTimeMs: Long = 0, val averageExecutionTimeMs: Double = 0.0)

Statistics about tool execution.

Link copied to clipboard
interface ToolExecutor

Interface for executing tools.

Link copied to clipboard
open class ToolNetworkException(message: String, cause: Throwable? = null) : Exception

Exception thrown when tool execution fails due to network issues.

Link copied to clipboard
class ToolNotFoundException(toolName: String, message: String = "Tool '") : Exception

Exception thrown when a requested tool is not found in the registry.

Link copied to clipboard
interface ToolRegistry

Registry for managing tool executors.

Link copied to clipboard

Builder for creating and configuring a ToolRegistry.

Link copied to clipboard
open class ToolResourceException(message: String, cause: Throwable? = null) : Exception

Exception thrown when tool execution fails due to resource constraints.

Link copied to clipboard

Interface for sending tool responses back to agents.

Link copied to clipboard
open class ToolTimeoutException(message: String, cause: Throwable? = null) : Exception

Exception thrown when tool execution times out.

Link copied to clipboard
open class ToolValidationException(message: String, cause: Throwable? = null) : Exception

Exception thrown when tool call validation fails.

Link copied to clipboard
data class ToolValidationResult(val isValid: Boolean, val errors: List<String> = emptyList())

Result of tool call validation.

Functions

Link copied to clipboard
fun toolRegistry(vararg executors: ToolExecutor): ToolRegistry

Creates a new ToolRegistry with the given executors.

Creates a new ToolRegistry using a builder pattern.