Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor:
    Send
    + Sync
    + DynClone {
    // Required methods
    fn exec_cmd<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cmd: &'life1 Command,
    ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stream_files<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
        extensions: Option<Vec<String>>,
    ) -> Pin<Box<dyn Future<Output = Result<IndexingStream<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn exec_cmd_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        cmd: &'life1 Command,
        output: &'life2 mut CommandOutputSink<'life3>,
    ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

A ToolExecutor provides an interface for agents to interact with a system in an isolated context.

When starting up an agent, it’s context expects an executor. For example, you might want your coding agent to work with a fresh, isolated set of files, separated from the rest of the system.

See swiftide-docker-executor for an executor that uses Docker. By default the executor is a local executor.

Additionally, the executor can be used stream files files for indexing.

Required Methods§

Source

fn exec_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 Command, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a command in the executor

Source

fn stream_files<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, extensions: Option<Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<IndexingStream<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream files from the executor

Provided Methods§

Source

fn exec_cmd_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, cmd: &'life1 Command, output: &'life2 mut CommandOutputSink<'life3>, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute a command and report output as it becomes available.

Trait Implementations§

Source§

impl ToolExecutor for Box<dyn ToolExecutor>

Source§

fn exec_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 Command, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a command in the executor
Source§

fn exec_cmd_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, cmd: &'life1 Command, output: &'life2 mut CommandOutputSink<'life3>, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute a command and report output as it becomes available.
Source§

fn stream_files<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, extensions: Option<Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<IndexingStream<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream files from the executor

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ToolExecutor for Box<dyn ToolExecutor>

Source§

fn exec_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 Command, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn exec_cmd_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, cmd: &'life1 Command, output: &'life2 mut CommandOutputSink<'life3>, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn stream_files<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, extensions: Option<Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<IndexingStream<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<T> ToolExecutor for &T
where T: ToolExecutor + ?Sized,

Source§

fn exec_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 Command, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn exec_cmd_streaming<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, cmd: &'life1 Command, output: &'life2 mut CommandOutputSink<'life3>, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn stream_files<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, extensions: Option<Vec<String>>, ) -> Pin<Box<dyn Future<Output = Result<IndexingStream<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§