Skip to main content

car_workflow/
lib.rs

1//! Declarative multi-stage workflow orchestration for Common Agent Runtime.
2//!
3//! Composes `car-multi` agent coordination patterns and `car-engine` action
4//! proposals into a named, conditional, compensable stage graph.
5//!
6//! ## Key types
7//!
8//! - [`Workflow`] — the top-level definition (stages + conditional edges)
9//! - [`Stage`] / [`StageStep`] — what each step does (pattern, proposal, sub-workflow)
10//! - [`Edge`] — conditional transition between stages (reuses [`car_ir::Precondition`])
11//! - [`CompensationHandler`] — saga-style rollback per stage
12//! - [`WorkflowEngine`] — executes the workflow graph
13//! - [`verify_workflow`] — static analysis before execution
14//!
15//! ## Example (JSON definition)
16//!
17//! ```json
18//! {
19//!   "id": "review-deploy",
20//!   "name": "Review and Deploy",
21//!   "start": "review",
22//!   "stages": [
23//!     { "id": "review", "name": "Code Review", "step": { "type": "pattern", ... } },
24//!     { "id": "deploy", "name": "Deploy", "step": { "type": "proposal", ... } }
25//!   ],
26//!   "edges": [
27//!     { "from": "review", "to": "deploy", "conditions": [{"key": "stage.review.succeeded", "operator": "eq", "value": true}] }
28//!   ]
29//! }
30//! ```
31
32pub mod engine;
33pub mod error;
34pub mod result;
35pub mod types;
36pub mod verify;
37
38pub use engine::WorkflowEngine;
39pub use error::WorkflowError;
40pub use result::{
41    CompensationResult, StageOutput, StageResult, StageStatus, WorkflowResult, WorkflowStatus,
42};
43pub use types::{
44    CompensationHandler, Edge, PatternKind, PatternStep, ProposalStep, Stage, StageStep,
45    SubWorkflowStep, Workflow,
46};
47pub use verify::{verify_workflow, WorkflowIssue, WorkflowVerifyResult};