Skip to main content

Module flow

Module flow 

Source
Expand description

Dynamic-workflow combinator core (P1).

A pure-Rust async combinator layer that reproduces the semantics of Claude Code “dynamic workflows” — [parallel] (barrier, fail-soft), [pipeline] (no-barrier per-item streaming), phase/log observability, and a run-wide concurrency cap — on top of the existing AgentRunner. A “workflow” is ordinary developer-written async Rust against these free functions; we do not embed a script engine, IR, or macro DSL.

These primitives are the deliberate duals of the compile-time workflow agents in crate::agent::workflow: [parallel] is fail-SOFT where ParallelAgent is fail-FAST, and [pipeline] has NO inter-item barrier where SequentialAgent advances stage-by-stage. Both layers coexist; nothing existing is changed.

§Load-bearing invariant

The Err -> None collapse lives only in [parallel]/[pipeline] at the join/stage boundary, never inside [agent]. If agent() swallowed errors, the concurrency backstop (and, in later phases, the token budget) would stop propagating and silently break. Control errors must reach the caller; only agent-domain failures collapse to None.

Re-exports§

pub use agent::agent;
pub use ctx::ProviderFactory;
pub use ctx::WorkflowCtx;
pub use event::log;
pub use event::phase;
pub use parallel::parallel;
pub use parallel::thunk;
pub use pipeline::pipeline;

Modules§

agent
agent — the atomic unit of a workflow: spawn one sub-agent.
budget
Budget — a shared, lock-free, hard-ceiling spend pool for a workflow run.
ctx
WorkflowCtx — the shared run context threaded into every combinator.
event
Workflow-level events and the phase() / log() observability helpers.
journal
RunJournal — deterministic resume for workflow runs.
parallel
parallel — a BARRIER fan-out that is fail-SOFT and submission-ordered.
pipeline
pipeline — NO-BARRIER per-item streaming through a chain of stages.
progress
ProgressTracker — fold WorkflowEvents into a live RunProgress snapshot, the Rust analog of Claude Code’s /workflows progress view.
worktree
Git-worktree isolation for flow agent leaves (P5b).

Functions§

workflow
Run body as a nested sub-workflow sharing this run’s budget, journal, concurrency cap, runaway backstop, and cancellation. Exactly one level of nesting is allowed: calling workflow() from inside a body returns Error::Config.