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 budget;
17#[cfg(feature = "bundle-env")]
18pub mod bundle_env;
19pub mod catalog;
20pub mod child_env;
21pub mod condition;
22pub mod coordination;
23#[cfg(feature = "cron")]
24pub mod cron;
25pub mod doc_schema;
26pub mod dsl;
27pub mod engine;
28pub mod event;
29pub mod file;
30pub mod graph;
31pub mod grounding;
32pub mod learning;
33#[cfg(feature = "memory")]
34pub mod memory;
35pub mod node;
36pub mod nodes;
37pub mod pool;
38pub mod private_fs;
39pub mod redact;
40pub mod response;
41pub mod skill;
42pub mod snapshot;
43pub mod source_map;
44pub mod store;
45#[cfg(feature = "store-conformance")]
46pub mod store_conformance;
47#[cfg(feature = "tokio")]
48pub mod task;
49pub mod template;
50pub mod text_model;
51pub mod tool;
52pub mod tool_node;
53pub mod ui;
54pub mod urls;
55pub mod validate;
56pub mod value;
57pub mod value_path;
58pub mod variables;
59#[cfg(feature = "yaml")]
60pub mod yaml;
61
62pub use dsl::Workflow;
63pub use engine::{Engine, RunHandle, RunInput, RunStream};
64pub use event::{Event, Usage};
65pub use graph::Graph;
66pub use node::{Node, NodeContext, NodeError, NodeOutcome, NodeOutput, NodeRole, Registry, Services};
67pub use pool::{Selector, VariablePool};
68pub use snapshot::Snapshot;
69pub use value::{Value, ValueType};
70pub use variables::{VarName, Variables};
71
72/// Re-exported so hosts use the same `IndexMap` version as the public API.
73pub use indexmap;
74/// Ordered map used throughout the public API.
75pub use indexmap::IndexMap;
76/// Re-exported so hosts use the same `serde_json` version as the public API.
77pub use serde_json;
78
79/// Top-level error type.
80#[derive(Debug, thiserror::Error)]
81#[non_exhaustive]
82pub enum Error {
83    #[error(transparent)]
84    Document(#[from] dsl::DocumentError),
85    #[error(transparent)]
86    Graph(#[from] graph::GraphError),
87    #[error("invalid run input: {0}")]
88    Input(String),
89    #[error("snapshot does not match this graph (expected fingerprint {expected}, got {actual})")]
90    SnapshotMismatch { expected: String, actual: String },
91    #[error("unsupported snapshot format {0}")]
92    SnapshotFormat(u32),
93}