Skip to main content

machi_workflow/
lib.rs

1//! Deterministic workflow orchestration engine.
2//!
3//! Scripts never call LLMs. They issue [`WorkflowHostRequest`] values over a
4//! channel; a product host executes nested agents and replies. Results are
5//! recorded in a [`Journal`] for resume.
6//!
7//! **Dependency firewall:** this crate must not depend on `machi-llm` or
8//! HTTP provider stacks.
9//!
10//! Maturity: **core**.
11
12#![forbid(unsafe_code)]
13
14// Keep the pure-engine surface free of LLM crates by construction.
15
16pub mod engine;
17pub mod host;
18pub mod journal;
19pub mod meta;
20pub mod run;
21pub mod store;
22pub mod validate;
23
24pub use engine::{WorkflowRunParams, run_workflow};
25pub use host::{AgentOpts, AgentResult, BudgetState, HostError, WorkflowHostRequest};
26pub use journal::{
27    HOST_ERROR_KEY, JOURNAL_VERSION_HEADER, Journal, JournalEntry, JournalError, MAX_JOURNAL_BYTES,
28    MAX_JOURNAL_ENTRIES, canonical_json, host_error_message, host_error_sentinel,
29    is_host_error_sentinel, request_hash,
30};
31pub use meta::{MetaError, WorkflowMeta, extract_meta};
32pub use run::{PauseKind, WorkflowOutcome};
33pub use store::{
34    FileWorkflowRunStore, MemoryWorkflowRunStore, StoreError, WorkflowRunRecord, WorkflowRunStatus,
35    WorkflowRunStore,
36};
37pub use validate::{
38    ValidationError, ValidationReport, default_probe_args, validate_script,
39    validate_script_with_agent_budget,
40};
41
42/// Default cumulative agent-call budget.
43pub const DEFAULT_AGENT_BUDGET: u64 = 128;
44/// Hard ceiling for agent budget.
45pub const MAX_AGENT_BUDGET: u64 = 1_024;
46/// Max items in one `parallel()` panel.
47pub const MAX_PARALLEL: usize = 1_024;
48/// Max result-bearing host calls per run.
49pub const MAX_HOST_CALLS: u64 = 10_000;