pub struct ToolNode { /* private fields */ }Expand description
Prebuilt node that executes tool calls from the last AI message in state.
Supports both regular Tool and RuntimeAwareTool instances.
When a runtime-aware tool is registered, it receives the current graph
state, store reference, and tool call ID via ToolRuntime.
Implementations§
Source§impl ToolNode
impl ToolNode
pub fn new(executor: SerialToolExecutor) -> Self
Sourcepub fn with_middleware(
executor: SerialToolExecutor,
middleware: Arc<MiddlewareChain>,
) -> Self
pub fn with_middleware( executor: SerialToolExecutor, middleware: Arc<MiddlewareChain>, ) -> Self
Create a ToolNode with middleware support.
Sourcepub fn with_store(self, store: Arc<dyn Store>) -> Self
pub fn with_store(self, store: Arc<dyn Store>) -> Self
Set the store reference for runtime-aware tool injection.
Sourcepub fn with_runtime_tool(self, tool: Arc<dyn RuntimeAwareTool>) -> Self
pub fn with_runtime_tool(self, tool: Arc<dyn RuntimeAwareTool>) -> Self
Register a runtime-aware tool.
When a tool call matches a registered runtime-aware tool by name,
it will be called with a ToolRuntime containing the current
graph state, store, and tool call ID.
Trait Implementations§
Source§impl Node<MessageState> for ToolNode
impl Node<MessageState> for ToolNode
fn process<'life0, 'async_trait>(
&'life0 self,
state: MessageState,
) -> Pin<Box<dyn Future<Output = Result<NodeOutput<MessageState>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for ToolNode
impl !RefUnwindSafe for ToolNode
impl Send for ToolNode
impl Sync for ToolNode
impl Unpin for ToolNode
impl UnsafeUnpin for ToolNode
impl !UnwindSafe for ToolNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more