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 prompt_files;
40pub mod redact;
41pub mod response;
42pub mod skill;
43pub mod snapshot;
44pub mod source_map;
45pub mod store;
46#[cfg(feature = "store-conformance")]
47pub mod store_conformance;
48#[cfg(feature = "tokio")]
49pub mod task;
50pub mod template;
51#[cfg(feature = "text-check")]
52pub mod text_check;
53pub mod text_model;
54pub mod tool;
55pub mod tool_node;
56pub mod ui;
57pub mod urls;
58pub mod validate;
59pub mod value;
60pub mod value_path;
61pub mod variables;
62#[cfg(feature = "yaml")]
63pub mod yaml;
64
65pub use dsl::Workflow;
66pub use engine::{Engine, RunHandle, RunInput, RunStream};
67pub use event::{Event, Usage};
68pub use graph::Graph;
69pub use node::{Node, NodeContext, NodeError, NodeOutcome, NodeOutput, NodeRole, Registry, Services};
70pub use pool::{Selector, VariablePool};
71pub use snapshot::Snapshot;
72pub use value::{Value, ValueType};
73pub use variables::{VarName, Variables};
74
75/// Re-exported so hosts use the same `IndexMap` version as the public API.
76pub use indexmap;
77/// Ordered map used throughout the public API.
78pub use indexmap::IndexMap;
79/// Re-exported so hosts use the same `serde_json` version as the public API.
80pub use serde_json;
81
82/// Top-level error type.
83#[derive(Debug, thiserror::Error)]
84#[non_exhaustive]
85pub enum Error {
86    #[error(transparent)]
87    Document(#[from] dsl::DocumentError),
88    #[error(transparent)]
89    Graph(#[from] graph::GraphError),
90    #[error("invalid run input: {0}")]
91    Input(String),
92    #[error("snapshot does not match this graph (expected fingerprint {expected}, got {actual})")]
93    SnapshotMismatch { expected: String, actual: String },
94    #[error("unsupported snapshot format {0}")]
95    SnapshotFormat(u32),
96}