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