Skip to main content

AgentGateway

Trait AgentGateway 

Source
pub trait AgentGateway: Send + Sync {
    type Config: Send + Sync;

    // Required methods
    fn config(&self) -> &Self::Config;
    fn state(&self) -> Option<&AppState>;
    fn llm(&self) -> Option<&dyn LlmProvider>;

    // Provided method
    fn on_message<'life0, 'async_trait>(
        &'life0 self,
        event: MessageEvent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Common interface for all agent gateways (TUI, Slack, etc.).

Implementors provide access to their config, shared state, and optional LLM. The on_message method is called whenever an inbound message is received; the default implementation saves it to the conversations table.

Required Associated Types§

Required Methods§

Source

fn config(&self) -> &Self::Config

Source

fn state(&self) -> Option<&AppState>

Source

fn llm(&self) -> Option<&dyn LlmProvider>

Provided Methods§

Source

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§