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