//! 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> { //! // 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};