Skip to main content

graphrt_core/
lib.rs

1//! # graphrt-core
2//!
3//! A small, executor-agnostic runtime for agentic AI workflow graphs.
4//!
5//! - [`dsl`]: portable workflow documents (JSON / YAML).
6//! - [`graph`]: compiled, validated, immutable graphs.
7//! - [`node`]: the node contract, registry and host services.
8//! - [`engine`]: the scheduler that runs a graph and streams [`event::Event`]s.
9//! - [`nodes`]: built-in control-flow and data nodes.
10//! - [`variables`]: the shared map of node outputs and pool namespaces.
11//!
12//! The core has no dependency on any async runtime, HTTP client or model
13//! provider; those live in separate crates and plug in through
14//! [`node::Services`] and [`node::Registry`].
15
16pub mod catalog;
17pub mod child_env;
18pub mod condition;
19pub mod coordination;
20pub mod doc_schema;
21pub mod dsl;
22pub mod engine;
23pub mod event;
24pub mod file;
25pub mod graph;
26pub mod node;
27pub mod nodes;
28pub mod pool;
29pub mod private_fs;
30pub mod redact;
31pub mod response;
32pub mod snapshot;
33pub mod source_map;
34pub mod store;
35#[cfg(feature = "store-conformance")]
36pub mod store_conformance;
37#[cfg(feature = "tokio")]
38pub mod task;
39pub mod template;
40pub mod tool;
41pub mod tool_node;
42pub mod urls;
43pub mod validate;
44pub mod value;
45pub mod value_path;
46pub mod variables;
47#[cfg(feature = "yaml")]
48pub mod yaml;
49
50pub use dsl::Workflow;
51pub use engine::{Engine, RunHandle, RunInput, RunStream};
52pub use event::{Event, Usage};
53pub use graph::Graph;
54pub use node::{Node, NodeContext, NodeError, NodeOutcome, NodeOutput, NodeRole, Registry, Services};
55pub use pool::{Selector, VariablePool};
56pub use snapshot::Snapshot;
57pub use value::{Value, ValueType};
58pub use variables::{VarName, Variables};
59
60/// Re-exported so hosts use the same `IndexMap` version as the public API.
61pub use indexmap;
62/// Ordered map used throughout the public API.
63pub use indexmap::IndexMap;
64/// Re-exported so hosts use the same `serde_json` version as the public API.
65pub use serde_json;
66
67/// Top-level error type.
68#[derive(Debug, thiserror::Error)]
69#[non_exhaustive]
70pub enum Error {
71    #[error(transparent)]
72    Document(#[from] dsl::DocumentError),
73    #[error(transparent)]
74    Graph(#[from] graph::GraphError),
75    #[error("invalid run input: {0}")]
76    Input(String),
77    #[error("snapshot does not match this graph (expected fingerprint {expected}, got {actual})")]
78    SnapshotMismatch { expected: String, actual: String },
79    #[error("unsupported snapshot format {0}")]
80    SnapshotFormat(u32),
81}