Skip to main content

AgentManager

Trait AgentManager 

Source
pub trait AgentManager: Send + Sync {
    // Required methods
    fn spawn_agent<'life0, 'async_trait>(
        &'life0 self,
        config: SpawnConfig,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_agents<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn agent_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<AgentInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn stop_agent<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn await_agent<'life0, 'life1, 'async_trait>(
        &'life0 self,
        agent_id: &'life1 str,
        timeout_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<AgentResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pool_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn file_locks<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for agent lifecycle management

Implement this trait to expose agent spawning and control capabilities via an MCP server without coupling to CLI-specific internals.

Required Methods§

Source

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

Spawn a new agent and return its ID

Source

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

List all currently active agents

Source

fn agent_status<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<AgentInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the current status of a specific agent

Source

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

Stop a running agent

Source

fn await_agent<'life0, 'life1, 'async_trait>( &'life0 self, agent_id: &'life1 str, timeout_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<AgentResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wait for an agent to complete and return its result

If timeout_secs is Some, returns an error if the agent has not completed within the given number of seconds.

Source

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

Return pool-level statistics as a JSON value

Source

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

Return all currently held file locks as a JSON value

Implementors§