Skip to main content

AgentSession

Trait AgentSession 

Source
pub trait AgentSession: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn send_input<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        input: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn output_receiver(&mut self) -> Option<Receiver<AgentOutput>>;
    fn is_alive<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn force_kill<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A running agent session that can receive input and emit output.

Required Methods§

Source

fn name(&self) -> &str

The agent’s name (matches SpawnConfig::name).

Source

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

Send a follow-up user message to the agent (starts a new turn).

Source

fn output_receiver(&mut self) -> Option<Receiver<AgentOutput>>

Take the output receiver.

Returns Some on the first call, None thereafter (the receiver is moved out so that the caller owns it).

Source

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

Check whether the underlying process / connection is still alive.

Performance contract: Implementations MUST return promptly with no I/O. This method may be called while the orchestrator holds internal locks (e.g., inside TeamOrchestrator::are_alive). A typical implementation is a single AtomicBool::load.

Source

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

Gracefully shut down the agent.

Source

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

Forcefully kill the agent process.

Implementors§