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