Skip to main content

AgentBrain

Trait AgentBrain 

Source
pub trait AgentBrain: Send {
    // Required methods
    fn system_prompt(&self) -> String;
    fn tools(&self) -> Vec<ToolDecl>;
    fn current_node_id(&self) -> String;
    fn on_tool_call(&mut self, name: &str, args: &Value) -> BrainAction;
    fn is_finished(&self) -> bool;
    fn collected_vars(&self) -> Value;
}
Expand description

Drives the conversation: provides the active prompt + tools, interprets tool calls into BrainActions, and reports completion + collected variables.

Synchronous on purpose — the brain is pure decision logic; any I/O it needs (e.g. the embedder’s engine) is done by the implementor before/around these calls.

Required Methods§

Source

fn system_prompt(&self) -> String

The system prompt for the current conversation state.

Source

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

Tools available in the current state (transitions + endCall, + later node tools).

Source

fn current_node_id(&self) -> String

The id of the brain’s current conversation node. The pipeline uses this to scope the control-plane lookup of the node’s MCP/HTTP workflow tools (SessionSource::node_tools / tool_call).

Source

fn on_tool_call(&mut self, name: &str, args: &Value) -> BrainAction

Interpret a tool/function call from the model into a BrainAction.

Source

fn is_finished(&self) -> bool

Whether the conversation has reached a terminal state.

Source

fn collected_vars(&self) -> Value

The variables collected so far (folded into the finalize payload).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§