Skip to main content

MessageProvider

Trait MessageProvider 

Source
pub trait MessageProvider: Send + Sync {
    // Required methods
    fn poll_steering(&self) -> Vec<AgentMessage>;
    fn poll_follow_up(&self) -> Vec<AgentMessage>;

    // Provided method
    fn has_steering(&self) -> bool { ... }
}
Expand description

Provides steering and follow-up messages to the agent loop.

Implementors are polled at well-defined points during loop execution:

Required Methods§

Source

fn poll_steering(&self) -> Vec<AgentMessage>

Return pending steering messages, if any.

Called after tool execution completes. Returning a non-empty vec causes a steering interrupt — pending tool calls may be cancelled and the new messages are injected into the conversation.

Source

fn poll_follow_up(&self) -> Vec<AgentMessage>

Return pending follow-up messages, if any.

Called when the model has finished a turn and no tool calls remain. Returning a non-empty vec triggers another outer-loop iteration.

Provided Methods§

Source

fn has_steering(&self) -> bool

Non-draining check for pending steering messages.

Used by tool-dispatch workers to detect steering interrupts early without consuming queued messages — the authoritative drain happens via poll_steering in the interrupt collector.

The default implementation returns false, so external providers that only implement poll_steering/poll_follow_up will never trigger a worker-initiated early interrupt. Built-in channel/queue providers override this with a non-draining peek.

Implementors§