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