Skip to main content

TextAgent

Trait TextAgent 

Source
pub trait TextAgent: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 State,
    ) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A text-based agent that runs via BaseLlm::generate() (request/response).

Unlike Agent (which requires a Live WebSocket session), TextAgent can be dispatched from anywhere — event hooks, background tasks, CLI tools.

Required Methods§

Source

fn name(&self) -> &str

Human-readable name for logging and debugging.

Source

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

Execute this agent. Reads/writes state. Returns the final text output.

Implementors§