Some checks failed
Documentation Lint & Validation / Markdown Linting (push) Has been cancelled
Documentation Lint & Validation / Validate mdBook Configuration (push) Has been cancelled
Documentation Lint & Validation / Content & Structure Validation (push) Has been cancelled
Documentation Lint & Validation / Lint & Validation Summary (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
74 lines
2.2 KiB
Rust
74 lines
2.2 KiB
Rust
//! Vapora Workflow Engine
|
|
//!
|
|
//! Orchestrates multi-stage workflows with learning-based agent selection,
|
|
//! artifact passing between stages, and cost-aware LLM routing.
|
|
//!
|
|
//! # Architecture
|
|
//!
|
|
//! The workflow engine uses a state machine approach where each
|
|
//! WorkflowInstance tracks progress through stages. Each stage can execute
|
|
//! tasks in parallel or sequentially, with artifacts passed between stages via
|
|
//! the Knowledge Graph.
|
|
//!
|
|
//! # Key Components
|
|
//!
|
|
//! - `WorkflowOrchestrator`: Main coordinator managing workflow lifecycle
|
|
//! - `WorkflowInstance`: State machine tracking individual workflow execution
|
|
//! - `StageState`: Manages stage execution and task assignment
|
|
//! - `Artifact`: Data passed between stages
|
|
//!
|
|
//! # Example
|
|
//!
|
|
//! ```no_run
|
|
//! use vapora_workflow_engine::{WorkflowOrchestrator, config::WorkflowsConfig};
|
|
//! use std::sync::Arc;
|
|
//!
|
|
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
|
|
//! // Initialize dependencies (SwarmCoordinator, KGPersistence, NATS)
|
|
//! # let swarm = todo!();
|
|
//! # let kg = todo!();
|
|
//! # let nats = todo!();
|
|
//!
|
|
//! // Create orchestrator
|
|
//! let orchestrator = Arc::new(
|
|
//! WorkflowOrchestrator::new(
|
|
//! "config/workflows.toml",
|
|
//! swarm,
|
|
//! kg,
|
|
//! nats,
|
|
//! ).await?
|
|
//! );
|
|
//!
|
|
//! // Start event listener
|
|
//! orchestrator.clone().start_event_listener().await?;
|
|
//!
|
|
//! // Start a workflow
|
|
//! let workflow_id = orchestrator.start_workflow(
|
|
//! "feature_development",
|
|
//! serde_json::json!({
|
|
//! "task": "Add authentication",
|
|
//! "requirements": ["OAuth2", "JWT"]
|
|
//! })
|
|
//! ).await?;
|
|
//!
|
|
//! println!("Workflow started: {}", workflow_id);
|
|
//! # Ok(())
|
|
//! # }
|
|
//! ```
|
|
|
|
pub mod artifact;
|
|
pub mod config;
|
|
pub mod error;
|
|
pub mod instance;
|
|
pub mod metrics;
|
|
pub mod orchestrator;
|
|
pub mod stage;
|
|
|
|
pub use artifact::{Artifact, ArtifactType};
|
|
pub use config::{EngineConfig, StageConfig, WorkflowConfig, WorkflowsConfig};
|
|
pub use error::{ConfigError, Result, WorkflowError};
|
|
pub use instance::{WorkflowInstance, WorkflowStatus};
|
|
pub use metrics::WorkflowMetrics;
|
|
pub use orchestrator::WorkflowOrchestrator;
|
|
pub use stage::{StageState, StageStatus, TaskState, TaskStatus};
|