pub struct WorkflowBuilder { /* private fields */ }Expand description
Builder for constructing a Workflow.
Each method appends a node and returns self for chaining. Modifiers like
after() and when() apply to the most recently added node.
Implementations§
Source§impl WorkflowBuilder
impl WorkflowBuilder
Sourcepub fn agent(self, id: &str, agent: Arc<dyn TextAgent>) -> Self
pub fn agent(self, id: &str, agent: Arc<dyn TextAgent>) -> Self
Add an agent node. The agent’s returned string is stored as a JSON string value.
Sourcepub fn function<F, Fut>(self, id: &str, f: F) -> Self
pub fn function<F, Fut>(self, id: &str, f: F) -> Self
Add a function node. The function receives a State clone and returns a JSON value.
Sourcepub fn approval(self, id: &str) -> Self
pub fn approval(self, id: &str) -> Self
Add an approval node. This node suspends until the controller approves or rejects.
Sourcepub fn after(self, deps: &[&str]) -> Self
pub fn after(self, deps: &[&str]) -> Self
Set dependencies for the most recently added node. Node runs after all deps are terminal.
Sourcepub fn when<G>(self, guard: G) -> Self
pub fn when<G>(self, guard: G) -> Self
Set a guard for the most recently added node. If guard returns false, node is skipped.
Sourcepub fn join_any(self) -> Self
pub fn join_any(self) -> Self
For the most recently added node, use join_any semantics: ready when ANY dep finishes
(instead of ALL). Skipped only if ALL deps skipped.
Sourcepub fn build(self) -> Result<Workflow, WorkflowError>
pub fn build(self) -> Result<Workflow, WorkflowError>
Build and validate the workflow. Returns an error if there are cycles, unknown dependencies, or duplicate IDs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkflowBuilder
impl !RefUnwindSafe for WorkflowBuilder
impl Send for WorkflowBuilder
impl Sync for WorkflowBuilder
impl Unpin for WorkflowBuilder
impl !UnwindSafe for WorkflowBuilder
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].