Skip to main content

ApiAgent

Trait ApiAgent 

Source
pub trait ApiAgent:
    Send
    + Sync
    + 'static {
    // Required method
    fn run_turn<'life0, 'async_trait>(
        &'life0 self,
        history: Vec<Message>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn run_turn_streaming<'life0, 'async_trait>(
        &'life0 self,
        history: Vec<Message>,
        tx: Sender<StreamFrame>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn tools(&self) -> Vec<ToolInfo> { ... }
    fn skills(&self) -> Vec<SkillInfo> { ... }
    fn config(&self) -> ConfigInfo { ... }
}
Expand description

One agent turn over a full message history — blocking or streaming — plus read-only metadata accessors the binary fills from its live components.

Required Methods§

Source

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

Run one turn over history, returning the complete message log after the turn — the assistant reply, plus any tool messages the loop appended along the way.

Provided Methods§

Source

fn run_turn_streaming<'life0, 'async_trait>( &'life0 self, history: Vec<Message>, tx: Sender<StreamFrame>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streaming variant: emit StreamFrames (deltas, tool activity) on tx as the loop runs, returning the full post-turn log. The default runs the blocking turn and emits the reply as a single Delta; the binary overrides it to stream tokens + tool events live.

Implementations must NOT emit Done/Error — the HTTP layer sends those after it persists the result.

Source

fn tools(&self) -> Vec<ToolInfo>

The registered tools. Default: none (overridden by the binary).

Source

fn skills(&self) -> Vec<SkillInfo>

The loaded skills. Default: none (overridden by the binary).

Source

fn config(&self) -> ConfigInfo

The non-secret config snapshot. Default: empty (overridden by the binary).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§