Skip to main content

Module graph

Module graph 

Source
Expand description

TinyAgents graph runtime.

The graph module is TinyAgents’ durable workflow runtime (LangGraph-style) and one of the load-bearing surfaces of the crate’s recursive language-model (RLM) architecture: because a node can embed another compiled graph (subgraph) or invoke a sub-agent, graphs run graphs and orchestration recurses while every step stays typed, checkpointed, and observable. A workflow authored from a .rag blueprint or driven from the .ragsh REPL lowers into exactly these same types, so a model can describe, compile, and re-enter the very runtime it is executing inside.

The pieces: partial updates and reducers (reducer), commands and interrupts (command), a builder/compile contract (builder), a superstep executor (compiled), checkpointing (checkpoint), streaming/events (stream), run-status snapshots (status), graph export/visualization (export), subgraph embedding (subgraph), and per-thread productivity primitives — a durable goal (goals) and a kanban task board (todos) — exposed as harness tools.

Each concern lives in its own submodule with types.rs (definitions), mod.rs (implementations), and test.rs (unit tests).

Re-exports§

pub use builder::END;
pub use builder::ForkId;
pub use builder::GraphBuilder;
pub use builder::GraphDefaults;
pub use builder::NodeContext;
pub use builder::NodeFuture;
pub use builder::NodeHandler;
pub use builder::Route;
pub use builder::RouterFn;
pub use builder::START;
pub use channel::Barrier;
pub use channel::BinaryAggregate;
pub use channel::Channel;
pub use channel::ChannelSet;
pub use channel::ChannelState;
pub use channel::ChannelUpdate;
pub use channel::Delta;
pub use channel::Ephemeral;
pub use channel::LastValue;
pub use channel::Messages;
pub use channel::NamedBarrier;
pub use channel::Topic;
pub use channel::Untracked;
pub use checkpoint::BarrierArrivals;
pub use checkpoint::Checkpoint;
pub use checkpoint::CheckpointConfig;
pub use checkpoint::CheckpointMetadata;
pub use checkpoint::CheckpointSource;
pub use checkpoint::CheckpointTuple;
pub use checkpoint::Checkpointer;
pub use checkpoint::DurabilityMode;
pub use checkpoint::FileCheckpointer;
pub use checkpoint::InMemoryCheckpointer;
pub use checkpoint::PendingActivation;
pub use checkpoint::PendingWrite;
pub use command::Command;
pub use command::Interrupt;
pub use command::NodeResult;
pub use command::RouteTarget;
pub use command::Send;
pub use compiled::CompiledGraph;
pub use compiled::GraphExecution;
pub use compiled::GraphInput;
pub use compiled::ResumeTarget;
pub use compiled::StateSnapshot;
pub use export::ChannelInfo;
pub use export::ConditionalEdgeInfo;
pub use export::EdgeInfo;
pub use export::GraphPolicySummary;
pub use export::GraphTopology;
pub use export::NodeInfo;
pub use export::NodePolicySummary;
pub use export::RouteInfo;
pub use export::ValidationReport;
pub use export::WaitingEdgeInfo;
pub use export::blueprint_to_json;
pub use export::blueprint_to_mermaid;
pub use export::blueprint_to_topology;
pub use export::from_json;
pub use export::to_json;
pub use export::to_mermaid;
pub use goals::GoalProgress;
pub use goals::GoalTool;
pub use goals::GoalToolKind;
pub use goals::ThreadGoal;
pub use goals::ThreadGoalStatus;
pub use goals::TurnOutcome;
pub use goals::active_goal_context_block;
pub use goals::goal_gate_node;
pub use goals::goal_tools;
pub use goals::note_user_turn;
pub use goals::register_goal_tools;
pub use goals::run_continuation_tick;
pub use observability::GraphEventJournal;
pub use observability::GraphHealthSummary;
pub use observability::GraphLangfuseExporter;
pub use observability::GraphLatencyMetrics;
pub use observability::GraphNodeHealth;
pub use observability::GraphNodeLatency;
pub use observability::GraphObservation;
pub use observability::GraphStatusStore;
pub use observability::GraphStepLatency;
pub use observability::InMemoryGraphEventJournal;
pub use observability::InMemoryGraphStatusStore;
pub use observability::JournalGraphSink;
pub use observability::SpanMetadataFn;
pub use observability::StoreGraphEventJournal;
pub use orchestration::InMemoryTaskStore;
pub use orchestration::JsonlTaskStore;
pub use orchestration::OrchestrationControlOutcome;
pub use orchestration::OrchestrationTaskFilter;
pub use orchestration::OrchestrationTaskKind;
pub use orchestration::OrchestrationTaskRecord;
pub use orchestration::OrchestrationTaskResult;
pub use orchestration::OrchestrationTaskSpec;
pub use orchestration::OrchestrationTaskStatus;
pub use orchestration::OrchestrationTool;
pub use orchestration::OrchestrationToolKind;
pub use orchestration::SteeringRegistry;
pub use orchestration::TaskStore;
pub use orchestration::orchestration_tool_schema;
pub use orchestration::orchestration_tool_schemas;
pub use orchestration::orchestration_tools;
pub use orchestration::orchestration_tools_with_steering;
pub use orchestration::register_orchestration_tools;
pub use recursion::ChildRun;
pub use recursion::ChildRunSink;
pub use recursion::RecursionFrame;
pub use recursion::RecursionPolicy;
pub use recursion::RecursionStack;
pub use recursion::RunTree;
pub use reducer::AppendReducer;
pub use reducer::ClosureReducer;
pub use reducer::ClosureStateReducer;
pub use reducer::MaxReducer;
pub use reducer::MinReducer;
pub use reducer::OverwriteReducer;
pub use reducer::OverwriteStateReducer;
pub use reducer::Reducer;
pub use reducer::SetUnionReducer;
pub use reducer::StateReducer;
pub use status::GraphRunStatus;
pub use stream::CollectingSink;
pub use stream::GraphEvent;
pub use stream::GraphEventSink;
pub use stream::NoopSink;
pub use stream::StreamMode;
pub use subagent_node::HarnessAgent;
pub use subagent_node::HarnessSubAgent;
pub use subagent_node::InputMapper;
pub use subagent_node::OutputMapper;
pub use subagent_node::SubAgentBudget;
pub use subagent_node::SubAgentInput;
pub use subagent_node::SubAgentNode;
pub use subagent_node::SubAgentOutput;
pub use subagent_node::SubAgentPolicy;
pub use subagent_node::subagent_node;
pub use subgraph::adapter_subgraph_node;
pub use subgraph::shared_subgraph_node;
pub use testkit::GraphAssertions;
pub use testkit::GraphEventRecorder;
pub use testkit::GraphRun;
pub use testkit::RetryCountingNode;
pub use testkit::StreamCollector;
pub use testkit::assert_graph;
pub use testkit::failing_node;
pub use testkit::fanout_node;
pub use testkit::interrupting_node;
pub use testkit::noop_node;
pub use testkit::run_recorded;
pub use testkit::scripted_route_node;
pub use testkit::scripted_update_node;
pub use testkit::subagent_fake_node;
pub use testkit::subgraph_test_node;
pub use todos::CardPatch;
pub use todos::TaskApprovalMode;
pub use todos::TaskBoard;
pub use todos::TaskBoardCard;
pub use todos::TaskCardStatus;
pub use todos::TodoTool;
pub use todos::TodosSnapshot;
pub use todos::normalise_board;
pub use todos::parse_status;
pub use todos::register_todo_tools;
pub use todos::render_markdown;
pub use todos::todo_tools;

Modules§

builder
Durable graph builder and compile contract.
channel
Channel-per-field state model (additive).
checkpoint
Checkpointer trait and in-memory backend — the durability layer that makes the recursive graph runtime resumable and time-travelable.
command
Command, interrupt, and node-result constructors.
compiled
Superstep executor for the durable graph.
export
Graph export and visualization — the introspection surface that lets a recursive harness read back the shape of any graph, including ones a model authored or assembled at runtime.
goals
Per-thread durable goal: one objective per thread, carried across supersteps, interrupts, and resumes.
observability
Durable observability for the graph runtime — journals, status stores, and the journaling event sink.
orchestration
Graph-level orchestration controls.
parallel
Ordered, bounded-concurrency parallel map/reduce with a configurable failure policy.
recursion
Recursion policy and depth tracking for the durable graph runtime.
reducer
Reducer trait implementations.
status
Graph run status snapshots — the lightweight observability surface for the tree of recursive runs.
stream
Pluggable event sinks for graph streaming and observability — how a recursive run makes its progress visible to the outside (and to a parent run).
subagent_node
Sub-agent nodes — the graph node that delegates to a harness agent (a model-driven agent loop) resolved by name from a CapabilityRegistry.
subgraph
Subgraph node adapters — the graph-level recursion surface where a graph runs another graph.
testkit
Graph-test building blocks — deterministic node doubles, an event recorder, a stream projector, and a fluent run-assertion builder for the durable graph runtime.
todos
Per-thread task board (kanban todos): a list of task cards per thread.