Trait Agent

Source
pub trait Agent: Send + Sync {
    // Required methods
    fn build_command(&self, instruction_path: &str) -> Vec<String>;
    fn volumes(&self) -> Vec<(String, String, String)>;
    fn environment(&self) -> Vec<(String, String)>;
    fn create_log_processor(
        &self,
        file_system: Arc<dyn FileSystemOperations>,
    ) -> Box<dyn LogProcessor>;
    fn name(&self) -> &str;

    // Provided methods
    fn validate<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn warmup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait defining the interface for AI agents that can execute tasks

Required Methods§

Source

fn build_command(&self, instruction_path: &str) -> Vec<String>

Returns the command to execute the agent with the given instruction file

Source

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

Returns the volumes to mount for this agent Format: Vec<(host_path, container_path, options)> where options is like “:ro” for read-only

Source

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

Returns environment variables for this agent

Source

fn create_log_processor( &self, file_system: Arc<dyn FileSystemOperations>, ) -> Box<dyn LogProcessor>

Creates a log processor for this agent’s output

Source

fn name(&self) -> &str

Returns the agent’s unique identifier

Provided Methods§

Source

fn validate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validates that this agent is properly configured

Source

fn warmup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Performs any necessary warmup steps before launching the Docker container

This method is called after validation but before container creation. It can be used to execute host-side setup commands, refresh credentials, or perform any other preparatory work needed by the agent.

The default implementation does nothing, allowing backward compatibility.

Implementors§