Skip to main content

lellm_graph/
lib.rs

1//! lellm-graph — Graph/Node/Edge 编排层 + 状态管理 + Checkpoint。
2//!
3//! 通用工作流引擎(类似 LangGraph / Temporal / Prefect)。
4//! 吸收了原 lellm-runtime,包含 State/StateDelta/Checkpoint 等基础设施。
5//! 依赖 `lellm-core`,不依赖 agent/provider。
6
7pub mod barrier_node;
8pub mod checkpoint;
9pub mod delta;
10pub mod error;
11pub mod event;
12pub mod executor;
13pub mod graph;
14pub mod hook;
15pub mod ids;
16pub mod node;
17pub mod parallel_node;
18pub mod state;
19pub mod statekey;
20pub mod store;
21
22// ─── IDs ─────────────────────────────────────────────────────
23pub use ids::{SpanId, TraceId};
24
25// ─── State ───────────────────────────────────────────────────
26pub use state::{
27    ExecutionEntry, GraphResult, State, StateError, StateExt, StateReducer, array_reducer,
28};
29
30// ─── Delta + Reducer ─────────────────────────────────────────
31pub use delta::{DeltaOp, DeltaSource, Reducer, ReducerRegistry, StateDelta};
32
33// ─── StateKey ────────────────────────────────────────────────
34pub use statekey::{SK_COUNT, SK_MESSAGES, SK_STEPS, StateKey, StateKeyExt};
35
36// ─── Checkpoint ──────────────────────────────────────────────
37pub use checkpoint::{
38    BarrierDecisionRecord, Checkpoint, CheckpointId, CheckpointPolicy, CheckpointScore,
39    CheckpointStore, CheckpointStoreError, CheckpointTrigger, ExecutionMetadata, ExecutionTrace,
40    GraphHashMode, IncrementalSnapshotState, NodeId, StateSnapshot,
41};
42
43// ─── Store ───────────────────────────────────────────────────
44pub use store::InMemoryCheckpointStore;
45
46// ─── Error Types ─────────────────────────────────────────────
47pub use error::{
48    BuildError, BuildErrors, Diagnostic, DiagnosticCategory, DiagnosticSeverity, GraphDiagnostics,
49    GraphError, ObservedError, TerminalError,
50};
51
52// ─── Events ──────────────────────────────────────────────────
53pub use event::{
54    BarrierDecision, BarrierId, FlowEvent, GraphEvent, GraphExecution, GraphHandle, GraphStream,
55};
56
57// ─── Graph ───────────────────────────────────────────────────
58pub use graph::{CycleAnalysis, Edge, Graph, GraphBuilder};
59
60// ─── Nodes ───────────────────────────────────────────────────
61pub use node::{
62    BarrierDefaultAction, BarrierNode, BranchCondition, ConditionNode, ConditionNodeBuilder,
63    FlowNode, NextStep, NodeKind, NodeOutput, ParallelErrorStrategy, ParallelNode, TaskFn,
64    TaskNode,
65};
66
67// ─── Executor ────────────────────────────────────────────────
68pub use executor::GraphExecutor;
69
70// ─── Hooks ───────────────────────────────────────────────────
71pub use hook::{AgentHook, NoOpHook, TracingHook};