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