Skip to main content

Node

Trait Node 

Source
pub trait Node: Send + Sync {
    // Required methods
    fn node_type(&self) -> &str;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        ctx: ExecContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The extension point for workflow nodes.

Implement this trait to add custom node types (HTTP call, LLM prompt, script, condition branch, sub-flow, etc.). Every implementation must be Send + Sync so the runner can execute nodes concurrently across threads.

Required Methods§

Source

fn node_type(&self) -> &str

The node type identifier matched against the "type" field in the flow definition and looked up in NodeRegistry.

Source

fn execute<'life0, 'async_trait>( &'life0 self, ctx: ExecContext, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the node and return a JSON output value.

The output is stored under this node’s ID and passed as inputs to all downstream nodes.

Implementors§