WorkflowBuilder

Struct WorkflowBuilder 

Source
pub struct WorkflowBuilder { /* private fields */ }
Expand description

Builder for constructing workflows

Implementations§

Source§

impl WorkflowBuilder

Source

pub fn new(name: impl Into<String>) -> Self

Create a new workflow builder

Source

pub fn description(self, description: impl Into<String>) -> Self

Set the workflow description

Source

pub fn version(self, version: impl Into<String>) -> Self

Set the workflow version

Source

pub fn tag(self, tag: impl Into<String>) -> Self

Add a tag to the workflow

Source

pub fn tags(self, tags: Vec<String>) -> Self

Add multiple tags to the workflow

Source

pub fn start(self, name: impl Into<String>) -> Self

Add a start node

Source

pub fn end(self, name: impl Into<String>) -> Self

Add an end node

Source

pub fn llm(self, name: impl Into<String>, config: LlmConfig) -> Self

Add an LLM node

Source

pub fn code(self, name: impl Into<String>, config: ScriptConfig) -> Self

Add a code execution node

Source

pub fn retriever(self, name: impl Into<String>, config: VectorConfig) -> Self

Add a retriever (vector search) node

Source

pub fn if_else(self, name: impl Into<String>, condition: Condition) -> Self

Add an if-else conditional node

Source

pub fn tool(self, name: impl Into<String>, config: McpConfig) -> Self

Add a tool (MCP) node

Source

pub fn loop_node(self, name: impl Into<String>, config: LoopConfig) -> Self

Add a loop node

Source

pub fn try_catch(self, name: impl Into<String>, config: TryCatchConfig) -> Self

Add a try-catch node

Source

pub fn sub_workflow( self, name: impl Into<String>, config: SubWorkflowConfig, ) -> Self

Add a sub-workflow node

Source

pub fn switch(self, name: impl Into<String>, config: SwitchConfig) -> Self

Add a switch node

Source

pub fn parallel(self, name: impl Into<String>, config: ParallelConfig) -> Self

Add a parallel execution node

Source

pub fn approval(self, name: impl Into<String>, config: ApprovalConfig) -> Self

Add an approval node

Source

pub fn form(self, name: impl Into<String>, config: FormConfig) -> Self

Add a form input node

Source

pub fn node(self, node: Node) -> Self

Add a custom node (low-level API)

Source

pub fn connect(self, from_index: usize, to_index: usize) -> Self

Add an edge between two nodes by their indices (0-based)

Source

pub fn connect_ids(self, from_id: NodeId, to_id: NodeId) -> Self

Add an edge between two nodes by their IDs

Source

pub fn last_node_id(&self) -> Option<NodeId>

Get the ID of the last added node

Source

pub fn node_id_at(&self, index: usize) -> Option<NodeId>

Get the ID of a node by its index (0-based)

Source

pub fn build(self) -> Workflow

Build the workflow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V