Skip to main content

AgentRunner

Trait AgentRunner 

Source
pub trait AgentRunner: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn is_available(&self) -> bool;
    fn binary_path(&self, config: &TaskConfig) -> Result<PathBuf>;
    fn build_args(&self, config: &TaskConfig) -> Vec<String>;
    fn build_env(&self, config: &TaskConfig) -> Vec<(String, String)>;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 TaskConfig,
        cancel_token: Option<CancellationToken>,
    ) -> Pin<Box<dyn Future<Output = Result<StreamHandle>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn version(&self, config: &TaskConfig) -> Option<String> { ... }
    fn capabilities(&self) -> AgentCapabilities { ... }
    fn validate_config(&self, config: &TaskConfig) -> Vec<ConfigWarning> { ... }
}
Expand description

Trait implemented by each agent adapter.

The runner translates a unified TaskConfig into the agent-specific CLI invocation and converts the agent’s streaming output into a unified EventStream.

Required Methods§

Source

fn name(&self) -> &str

Human-readable name of this agent backend.

Source

fn is_available(&self) -> bool

Check whether the agent binary is available on the system.

Source

fn binary_path(&self, config: &TaskConfig) -> Result<PathBuf>

Resolve the binary path (user override or PATH lookup).

Source

fn build_args(&self, config: &TaskConfig) -> Vec<String>

Build the command-line arguments for the agent process.

Source

fn build_env(&self, config: &TaskConfig) -> Vec<(String, String)>

Build the environment variables for the agent process.

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 TaskConfig, cancel_token: Option<CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<StreamHandle>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run the task and return a StreamHandle with event stream and cancel token.

Provided Methods§

Source

fn version(&self, config: &TaskConfig) -> Option<String>

Get the version of the installed agent binary.

Source

fn capabilities(&self) -> AgentCapabilities

What features this agent supports.

Source

fn validate_config(&self, config: &TaskConfig) -> Vec<ConfigWarning>

Validate config against this agent’s capabilities.

Implementors§