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§
Sourcefn system_prompt(&self) -> String
fn system_prompt(&self) -> String
The system prompt for the current conversation state.
Sourcefn tools(&self) -> Vec<ToolDecl>
fn tools(&self) -> Vec<ToolDecl>
Tools available in the current state (transitions + endCall, + later node tools).
Sourcefn current_node_id(&self) -> String
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).
Sourcefn on_tool_call(&mut self, name: &str, args: &Value) -> BrainAction
fn on_tool_call(&mut self, name: &str, args: &Value) -> BrainAction
Interpret a tool/function call from the model into a BrainAction.
Sourcefn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Whether the conversation has reached a terminal state.
Sourcefn collected_vars(&self) -> Value
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".