Skip to main content

CodeExecutor

Trait CodeExecutor 

Source
pub trait CodeExecutor: Send + Sync {
    // Required method
    fn execute_code<'life0, 'async_trait>(
        &'life0 self,
        input: CodeExecutionInput,
    ) -> Pin<Box<dyn Future<Output = Result<CodeExecutionResult, CodeExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn code_block_delimiters(&self) -> Vec<(String, String)> { ... }
    fn execution_result_delimiters(&self) -> (String, String) { ... }
    fn error_retry_attempts(&self) -> u32 { ... }
    fn stateful(&self) -> bool { ... }
}
Expand description

Trait for sandboxed code execution in agent pipelines.

Required Methods§

Source

fn execute_code<'life0, 'async_trait>( &'life0 self, input: CodeExecutionInput, ) -> Pin<Box<dyn Future<Output = Result<CodeExecutionResult, CodeExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute code and return the result.

Provided Methods§

Source

fn code_block_delimiters(&self) -> Vec<(String, String)>

Delimiters for identifying code blocks in model output.

Source

fn execution_result_delimiters(&self) -> (String, String)

Delimiters for wrapping execution results.

Source

fn error_retry_attempts(&self) -> u32

Number of retry attempts on error.

Source

fn stateful(&self) -> bool

Whether this executor maintains state across executions.

Implementors§