Skip to main content

ares/workflows/
mod.rs

1//! Workflow Engine Module
2//!
3//! This module provides declarative workflow execution based on TOML configuration.
4//! Workflows define how agents work together to handle complex requests.
5//!
6//! # Overview
7//!
8//! Workflows allow you to:
9//! - Define agent routing and handoff patterns
10//! - Set execution limits (depth, iterations)
11//! - Enable parallel sub-agent execution
12//! - Configure fallback behaviors
13//!
14//! # Configuration
15//!
16//! Workflows are defined in `ares.toml`:
17//!
18//! ```toml
19//! [workflows.default]
20//! entry_agent = "router"
21//! fallback_agent = "orchestrator"
22//! max_depth = 3
23//! max_iterations = 5
24//!
25//! [workflows.research]
26//! entry_agent = "orchestrator"
27//! max_depth = 3
28//! max_iterations = 10
29//! parallel_subagents = true
30//! ```
31//!
32//! # Usage
33//!
34//! ```ignore
35//! use ares::workflows::{WorkflowEngine, WorkflowOutput};
36//!
37//! let engine = WorkflowEngine::new(agent_registry, config);
38//! let output = engine.execute_workflow("default", "What's our revenue?").await?;
39//!
40//! println!("Final response: {}", output.final_response);
41//! println!("Agents used: {:?}", output.agents_used);
42//! println!("Steps taken: {}", output.steps.len());
43//! ```
44//!
45//! # Workflow Output
46//!
47//! The [`WorkflowOutput`] struct provides:
48//! - `final_response` - The final synthesized response
49//! - `agents_used` - List of agents that participated
50//! - `steps` - Detailed log of each workflow step
51//! - `total_tokens` - Aggregate token usage
52
53pub mod engine;
54
55pub use engine::{WorkflowEngine, WorkflowOutput, WorkflowStep};