Skip to main content

execute_with_controls

Function execute_with_controls 

Source
pub async fn execute_with_controls<F, Fut>(
    config: &SandboxConfig,
    breaker: &Arc<CircuitBreaker>,
    tool_fn: F,
) -> SandboxResult<ToolExecutionResult>
where F: Fn() -> Fut, Fut: Future<Output = Result<Value, String>>,
Expand description

Execute a tool with timeout, retry, and circuit-breaker controls.

tool_fn is an async closure that performs the actual tool work and returns Ok(serde_json::Value) on success or Err(String) on failure.

The circuit breaker is checked before each attempt and updated after.