Graphrun
Graphrun is a Rust library. You depend on graphrun, open Engine::local on a directory in your process, and drive runs through that API. The library uses your Tokio runtime. It does not start a server, install signal handlers, or require a database daemon.
The graph is data. Write it with the typed builder or with YAML. Both compile to the same IR. Each command is committed through Raft, then applied to a redb file in that directory. Restart the process on the same path and the run is still there.
Install
[]
= "0.1.1"
= { = "1", = ["derive"] }
= { = "1", = ["rt-multi-thread", "macros"] }
Rust 1.90 or newer. Linux and macOS.
Embed the engine
This is the whole local runtime: one Raft voter, in-process worker, Unix control socket under the data directory.
use ;
use BTreeMap;
use Duration;
async
start takes a compiled Definition from the builder. start_yaml compiles YAML against the same catalog. inspect, signal, cancel, and history are methods on Engine.
A complete listing, including catalog JSON, is graphrun/examples/order.rs. From this repo:
That prints payment_id: pay-1. The example activity names (inventory.reserve, payment.charge, and the other fixture names) have handlers inside the library. That is how the example finishes without a worker process of your own.
Typed builder
activity_ref checks input and output types against the catalog. A mismatch is a compile error.
use ;
use ;
use Catalog;
use ;
let catalog = from_json?;
let reserve = catalog.?;
let charge = catalog.?;
let mut root = new;
let reserved = root.activity?;
let charged = root.activity?;
let root = root.complete?;
let definition = new.build?;
let run = engine.start.await?;
The catalog is contracts: schema, activity key/version, execution kind, effect kind, recovery, error codes. It is not Rust type names. YAML for the same graph is docs/specs/v1/examples/sequence.yaml.
Cluster
Engine::member is a storage replica. Activity execution is opt-in. Engine::run_worker is a process that claims work over gRPC/mTLS and does not open a data directory. Local and clustered runs use the same write path. See Run a three-member cluster.
Optional CLI
graphrun-cli is an operator binary. It talks to an engine you already opened (--local-dir) or to a member (--endpoint plus mTLS). Your application does not depend on it.
Limits
512 nodes per definition. YAML, payloads, and normalized IR are each 256 KiB. Unapplied log: 4,096 entries or 64 MiB. Full table: docs/limits.md.
How-tos
- Build a workflow in Rust
- Run a local YAML workflow
- Run a three-member cluster
- Deliver an external event
- Compensate, intervene, or abandon
- Back up and restore a member
- Diagnose a stalled run
Spec: docs/specs/v1.
Development