pub struct DagWorkflow { /* private fields */ }Expand description
DAG workflow: nodes execute in topological order; independent nodes run concurrently.
Each node receives the concatenated outputs of all its predecessors (joined by newlines) as input; root nodes with zero in-degree receive the workflow’s original input.
§Example
use echo_core::agent::{Agent, AgentEvent};
use echo_core::error::Result;
use echo_orchestration::workflow::{DagWorkflow, Workflow};
use futures::future::BoxFuture;
use futures::stream::{self, BoxStream};
let researcher = DummyAgent::new("researcher");
let analyst = DummyAgent::new("analyst");
let writer = DummyAgent::new("writer");
let mut wf = DagWorkflow::builder()
.node("research", researcher)
.node("analyze", analyst)
.node("write", writer)
.edge("research", "write")
.edge("analyze", "write")
.build()?;
let output = wf.run("Analyze the 2025 AI Agent ecosystem").await?;
println!("{}", output.result);Implementations§
Source§impl DagWorkflow
impl DagWorkflow
pub fn builder() -> DagWorkflowBuilder
Trait Implementations§
Source§impl Workflow for DagWorkflow
impl Workflow for DagWorkflow
Source§fn run<'a>(
&'a mut self,
input: &'a str,
) -> Pin<Box<dyn Future<Output = Result<WorkflowOutput, ReactError>> + Send + 'a>>
fn run<'a>( &'a mut self, input: &'a str, ) -> Pin<Box<dyn Future<Output = Result<WorkflowOutput, ReactError>> + Send + 'a>>
Run the entire workflow with
input as the initial inputSource§fn run_stream<'a>(
&'a mut self,
input: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<WorkflowEvent, ReactError>> + Send + 'a>>, ReactError>> + Send + 'a>>
fn run_stream<'a>( &'a mut self, input: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<WorkflowEvent, ReactError>> + Send + 'a>>, ReactError>> + Send + 'a>>
Run the entire workflow with
input as initial input (streaming per-node events). Read moreAuto Trait Implementations§
impl Freeze for DagWorkflow
impl !RefUnwindSafe for DagWorkflow
impl Send for DagWorkflow
impl Sync for DagWorkflow
impl Unpin for DagWorkflow
impl UnsafeUnpin for DagWorkflow
impl !UnwindSafe for DagWorkflow
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request