Skip to main content

af_workflow/
lib.rs

1//! `af-workflow` — spec-driven workflow chassis.
2//!
3//! A workflow is typed node expressions composed into a branched DAG. Port of
4//! `agent_core/workflow/v2`.
5//!
6//! - **Spec model** ([`Spec`], [`Branch`], [`Node`], [`Edge`]) — deserializes
7//!   existing Python builtin JSON specs unchanged.
8//! - **Runtime** — [`Event`] / [`StepResult`] / [`WorkflowContext`] / [`State`]
9//!   and the [`StepNode`] trait (one event in, one result out).
10//! - **Registry** ([`NodeRegistry`]) — maps node types to factories. Ships the
11//!   generic node types via [`NodeRegistry::with_builtins`]; products register
12//!   their own business types and side-effect guards.
13//! - **Durable host** ([`WorkflowHost`]) — validates and compiles a branch DAG;
14//!   claimed work is scheduled only by [`run_due_pass`].
15
16pub mod builtins;
17pub mod event;
18mod executor;
19pub mod graph;
20pub mod host;
21pub mod ingress;
22pub mod metrics;
23pub mod node;
24pub mod recorder;
25pub mod registry;
26pub mod result;
27pub mod spec;
28pub mod state;
29pub mod supervisor;
30pub mod template;
31pub mod validator;
32
33pub use event::Event;
34pub use executor::{CompileError, RunOutcome, Terminal};
35pub use graph::{
36    primitive_kind, render_graph, render_graph_json, GraphEdge, GraphNode, WorkflowGraph,
37};
38pub use host::{HostError, WorkflowHost, ROOT_BRANCH};
39pub use ingress::{ingress_plans, next_cron_at, BranchIngressPlan};
40pub use metrics::{Readiness, RuntimeMetrics};
41pub use node::{StepNode, WorkflowContext};
42pub use recorder::{noop_recorder, NoopRecorder, RunHandle, RunRecorder, RunStatus, StepStatus};
43pub use registry::{FieldSpec, FieldType, NodeError, NodeRegistry, NodeSchema, StepFactory};
44pub use result::StepResult;
45pub use spec::{Branch, Edge, Node, Spec, SpecError};
46pub use state::{MemoryState, NamespacedState, State};
47pub use supervisor::{
48    run_due_pass, DriverOutcome, DriverRegistry, SupervisorSettings, SupervisorStats, WorkItem,
49    WorkQueue, WorkflowDriver,
50};
51pub use template::{resolve_config, TemplateError};
52pub use validator::{validate, Violation};