Skip to main content

Node

Trait Node 

Source
pub trait Node: WasmCompatSend + WasmCompatSync {
    // Required method
    fn run<'a>(
        &'a self,
        input: String,
        io: &'a NodeIo<'a>,
    ) -> WasmBoxedFuture<'a, Result<NodeOutput, NodeError>>;
}
Expand description

One step of a Graph: takes the text built from the task and the outputs before it, and produces text.

Implemented for Rig agents, Swarms, Graphs, human and, through node_fn, async functions.

Required Methods§

Source

fn run<'a>( &'a self, input: String, io: &'a NodeIo<'a>, ) -> WasmBoxedFuture<'a, Result<NodeOutput, NodeError>>

Run the step on input. Through io it can report the text it writes and ask a person, when the graph run is streamed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Node for Agent

Source§

fn run<'a>( &'a self, input: String, io: &'a NodeIo<'a>, ) -> WasmBoxedFuture<'a, Result<NodeOutput, NodeError>>

In a checkpointed run, the agent’s tool results go to a journal, so a resumed run replays them rather than executing the tools again.

Implementors§

Source§

impl Node for Graph

Source§

impl Node for HumanNode

Source§

impl Node for Swarm

Source§

impl<F, Fut> Node for FnNode<F>
where F: Fn(String) -> Fut + WasmCompatSend + WasmCompatSync, Fut: Future<Output = Result<String, NodeError>> + WasmCompatSend + 'static,

Source§

impl<F, Fut> Node for StateFnNode<F>
where F: Fn(String, RunState) -> Fut + WasmCompatSend + WasmCompatSync, Fut: Future<Output = Result<String, NodeError>> + WasmCompatSend + 'static,