Skip to main content

Crate oneai_workflow

Crate oneai_workflow 

Source
Expand description

§OneAI Workflow

Workflow compiler, DAG, validator, executor, StateGraph (cyclic graph support), and StateGraphExecutor (cyclic graph execution).

A workflow is a declarative specification of multi-step agent behavior. It defines steps, dependencies, tool bindings, and execution policies. The workflow is compiled into a DAG (for acyclic workflows) or a StateGraph (for cyclic workflows like ReAct loops) and executed.

P2-2: GraphActionExecutor trait enables AgentLoop integration — LlmInfer/ToolCall nodes can delegate to the AgentLoop’s full pipeline (hooks, permission, domain pack, tool definitions, context assembly).

§Stability

This crate follows the Rust API Guidelines. All public enums are annotated #[non_exhaustive] where appropriate to prevent downstream breakage when new variants are added. Structs use constructor methods for creation — direct struct literal construction is supported within this crate but may be restricted in future versions via #[non_exhaustive].

Breaking changes will be signaled by a minor version bump (0.x → 0.y). Patch versions (0.x.y → 0.x.z) are always backward-compatible.

Re-exports§

pub use compiler::*;
pub use config::*;
pub use dag::*;
pub use executor::*;
pub use render::*;
pub use state_executor::*;
pub use state_graph::*;
pub use validator::*;

Modules§

compiler
Workflow compiler — converts WorkflowConfig into WorkflowDAG.
config
Workflow configuration DSL — defines workflow steps, dependencies, and tool bindings.
dag
Workflow DAG data structure — dependency graph for workflow execution.
executor
Workflow executor — runs compiled DAG with level-based parallel execution.
render
ASCII visualization for WorkflowDag and StateGraph.
state_executor
StateGraph executor — walks cyclic graph, evaluates edge conditions, handles interrupts.
state_graph
StateGraph — directed graph that supports cyclic edges for agent workflows.
validator
Workflow validator — detects cycles, orphan nodes, undefined dependencies.