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//!
11//! The core has no dependency on any async runtime, HTTP client or model
12//! provider; those live in separate crates and plug in through
13//! [`node::Services`] and [`node::Registry`].
14
15pub mod catalog;
16pub mod condition;
17pub mod dsl;
18pub mod engine;
19pub mod event;
20pub mod file;
21pub mod graph;
22pub mod node;
23pub mod nodes;
24pub mod pool;
25pub mod redact;
26pub mod response;
27pub mod snapshot;
28pub mod store;
29pub mod template;
30pub mod tool;
31pub mod tool_node;
32pub mod value;
33
34pub use dsl::Workflow;
35pub use engine::{Engine, RunHandle, RunInput, RunStream};
36pub use event::{Event, Usage};
37pub use graph::Graph;
38pub use node::{Node, NodeContext, NodeError, NodeOutcome, NodeOutput, NodeRole, Registry, Services};
39pub use pool::{Selector, VariablePool};
40pub use snapshot::Snapshot;
41pub use value::{Value, ValueType};
42
43/// Re-exported so hosts use the same `IndexMap` version as the public API.
44pub use indexmap;
45/// Ordered map used throughout the public API.
46pub use indexmap::IndexMap;
47/// Re-exported so hosts use the same `serde_json` version as the public API.
48pub use serde_json;
49
50/// Top-level error type.
51#[derive(Debug, thiserror::Error)]
52#[non_exhaustive]
53pub enum Error {
54    #[error(transparent)]
55    Document(#[from] dsl::DocumentError),
56    #[error(transparent)]
57    Graph(#[from] graph::GraphError),
58    #[error("invalid run input: {0}")]
59    Input(String),
60    #[error("snapshot does not match this graph (expected fingerprint {expected}, got {actual})")]
61    SnapshotMismatch { expected: String, actual: String },
62    #[error("unsupported snapshot format {0}")]
63    SnapshotFormat(u32),
64}