@spendgraph/graph
v0.15.0
Published
Wire nodes into a graph, run it, and get back a rollout with every step.
Maintainers
Readme
@spendgraph/graph
Wire nodes into a graph, run it, and get back a rollout with every step.
npm install @spendgraph/graphimport { edge, end, graph, node } from "@spendgraph/graph";
const flow = graph({
entry: "parse",
nodes: [parse, divide, format],
edges: [edge("parse", "divide"), edge("divide", "format"), end("format")],
});
const result = await flow.execute({ expression: "12 / 4" });What you get
- A run comes back as a rollout — every step, in order, ready to report.
- Compilation refuses what would fail at run time: an unreachable node, an edge to nothing, a graph with no way out.
- Handlers typed from their args, the same inference
toolsuses. - A node can stop to ask a person, and the graph reports the question rather than walking past it.
- A failed node can route somewhere —
onFailurenames the node that runs instead of the run ending, for a workflow whose earlier steps have to be undone.
Docs
| | | | --- | --- | | Overview | Four exports, and the whole thing in one example | | Nodes | One unit of work, typed from its args | | Wiring | Edges, branching, and what compilation refuses | | Running a graph | Failure, the step ceiling, what comes back | | Streaming | The same run, narrated | | Pausing | Stopping to ask a person, and picking it back up |
License
Apache-2.0
