Skip to content

Graphrt 0.3.0

Choose a tag to compare

@BimaPangestu28 BimaPangestu28 released this 19 Nov 12:12
· 231 commits to main since this release

Workflow format v1 is frozen with a JSON Schema, and validation now collects every error with its location. Also new: webhook triggers, opt in anonymous telemetry, plugins installable by name from the plugin catalog, Android and iOS sample apps, a comparison against LangGraph, and another round of engine, LLM path and server speedups. A security review brought fixes, most of which also shipped as 0.2.1. Contains breaking changes to the workflow format and the Rust API, see Changed (Breaking).

Changed (Breaking)

  • Unknown fields are errors in v1 documents: at the document, graph, node, edge, retry, on_error and variable-declaration level, and in node configs whose catalog schema is closed (additionalProperties: false, all built-in kinds, as catalog::schema::object now produces).
    • Plugin configs with open schemas are unaffected.
    • schema::open_object builds one.
    • Required config fields from the catalog schema are enforced (for example a template-transform without template).
    • The import layout (top-level workflow/app, data-wrapped nodes) stays lenient.
    • Migration: run graphrt validate and fix what it reports.
    • Move tool metadata to x- keys.
  • version must be "1" (or 1) or absent. Migration: set version: "1".
  • Edge handles are checked: an edge must use a handle the source node can select (source for non-branch nodes, case ids and false for if-else, class ids, action ids, a plugin's fixed handles).
    • Non-branch nodes used to follow edges with any handle.
    • fail-branch edges on nodes without that strategy are a warning (never taken).
    • Migration: use source or the node's handle.
  • Reserved names: top-level imports, inputs, outputs, triggers, metadata, requires, subgraphs. Node-level disabled, cache, metadata (plugin configs cannot use them either).
  • human-input: the request expiry is expire_after_ms (pause data still reports timeout_ms). A config timeout_ms was always taken as the node's per-attempt timeout and never reached the node. Migration: rename it.
  • Loop variables are {name, type, input_type, value}. label, var_type and value_type (which meant the input source, unlike every other value_type) still work as deprecated aliases.
  • Deprecated, still accepted with a warning: environment_variables, conversation_variables, declaration value_type, node parentId / container_id / iteration_id / loop_id, error_strategy / default_value, retry_config, edge sourceHandle / source_handle.
  • API: NodeDoc has a strict field. ConfigError has a field field. DocumentError::Field. GraphError::{MissingNode, MissingParent, UnknownReference} carry a suggestion, new GraphError::{InvalidField, UnknownHandle}. graphrt validate takes --format. CliError has preformatted.
  • Breaking (graphrt-core): Event::NodeChunk::field is an Arc<str> instead of a String, so a streamed chunk no longer allocates its field name.
    • Serialized events are unchanged.
    • New NodeContext::chunk_shared(&field, text) streams under a name the node keeps in an Arc<str>.
    • NodeContext::chunk(&str, text) keeps its signature (and allocates the name per chunk).
    • Migrating: compare with field.as_ref() == "text", use field.to_string() where a String is needed, and .into() when building the event.
  • Breaking (graphrt-core): ResponseChunk::node_id is an Arc<str> instead of a String (shared with the graph instead of copied per chunk). Migrating as for NodeChunk::field. New ResponseAssembler::push_into(&event, &mut out) appends to a caller-owned buffer. push is unchanged.
  • Breaking (graphrt-llm): collect's callback receives each ChatDelta by value (FnMut(ChatDelta), was FnMut(&ChatDelta)), after the delta was added to the response, so streamed text can be moved into a chunk instead of copied.
    • Closures that ignore the delta (|_| {}) compile unchanged.
    • Others match on the owned delta instead of a reference.
  • Breaking (graphrt-llm): nodes::common::PromptTemplate::messages returns &[PromptMessage] instead of Vec<&PromptMessage>. New helpers nodes::common::finish_reason_value and StreamField::shared.
  • Node outputs and pool namespaces use the new graphrt_core::Variables map (keys are graphrt_core::VarName) instead of IndexMap<String, Value> / IndexMap<Arc<str>, Value>.
    • It is a reference-counted, insertion-ordered flat map: cloning is a reference-count bump, so a node's outputs become its pool namespace and its event payload without being copied.
    • Affected:
    • NodeOutput::outputs is Variables. NodeOutput::with takes impl Into<VarName> (string literals, String, &String, Arc<str>).
    • Event::NodeSucceeded::outputs and Event::NodeFailed::outputs are Variables (same JSON).
    • VariablePool::namespace() returns Option<&Variables> and VariablePool::set_outputs takes &Variables.

Migration: most code compiles unchanged, since Variables has the familiar get, insert, remove, iter, keys, values, len, contains_key, extend and collect() API. Iteration yields (&str, &Value) instead of (&String, &Value). Use .to_owned() where a String is needed. Pass a non-'static &str name as name.to_owned(). outputs.insert("x".into(), v) becomes outputs.insert("x", v). Convert with Variables::from(index_map), variables.to_index_map() or IndexMap::from(variables). Indexing a missing name (outputs["x"]) yields Value::Null instead of panicking. remove keeps the order of the remaining entries (like IndexMap::shift_remove).

Added

  • graphrt serve --webhooks <file>: webhook triggers.
    • POST /v1/hooks/{hook} starts an async run of the hook's workflow from any JSON body and answers 202 with the run id.
    • Bodies map to inputs by JSON Pointer and header (inputs, headers) or pass whole (body_input, default body).
    • Optional HMAC-SHA256 signature checks in the GitHub, Stripe, Slack, generic or graphrt formats, compared in constant time, with a replay window for the timestamped ones.
    • Secrets from the environment, --env-file or a file.
    • An idempotency key header (default Idempotency-Key) maps redeliveries to the first run, durably with --store.
    • Deliveries share --max-body-bytes.
    • GET /v1/hooks lists the hooks.
    • See docs/serving.md.
  • Webhook completion callbacks (callback): a signed (X-Graphrt-Signature: t=..,v1=..) JSON result POSTed when the run succeeds, fails, aborts or pauses, through the HTTP egress policy (private networks refused unless --allow-private-network, no redirects), retried with exponential backoff on network errors, 408, 429 and 5xx.
  • Opt-in anonymous usage telemetry for the graphrt binary (telemetry feature, in the default set).
    • Off by default.
    • On only after graphrt telemetry enable or GRAPHRT_TELEMETRY=1, and always off with DO_NOT_TRACK, in CI, or without an endpoint (GRAPHRT_TELEMETRY_URL at build or run time).
    • At most one report a day, sent from a background thread with a 5 s timeout: a random install id, version, OS/arch, features, build (cli/docker) and per-day counts of runs and serve requests, aggregated in telemetry.json in the user config directory.
    • graphrt telemetry status prints exactly what would be sent.
    • Not in the embedded or FFI libraries.
    • See docs/telemetry.md.
  • tools/telemetry-collector/: a Cloudflare Worker + D1 collector for those reports (strict payload validation, no IP addresses stored, schema, wrangler config template, weekly-active-installs and daily-runs queries). Not deployed.
  • Workflow format v1 is frozen, with a JSON Schema (draft 2020-12): schema/workflow-v1.schema.json, one oneOf branch per node kind keyed on type, built from the node catalog.
    • graphrt schema prints the schema for the node kinds in the running build, including plugins.
    • The examples carry a # yaml-language-server: $schema=... header.
    • Editor setup (VS Code YAML, JetBrains) and the stability promise are in docs/workflow-format.md.
  • Validation reports every problem at once: graphrt validate and run show rustc-style errors with file:line:column, a source snippet, the document path (graph.nodes[1].template) and "did you mean" suggestions for field names, node types, node ids in edges, parents and selectors, and edge handles.
    • graphrt validate --format json prints a machine-readable report.
    • Library: graphrt_core::validate::validate_text, Diagnostic, source_map::SourceMap, doc_schema::workflow_schema, Registry::descriptor_ref, Node::branch_handles, ConfigError::field.
  • x- keys (document, graph, nodes, edges) are free for tools and ignored.
  • Tools can return images that the agent node shows to the model, enabling vision loops such as computer use (screenshot, then click by coordinates).
    • ToolOutput gains images (ToolImage::Base64 {media_type, data_base64} or ToolImage::Url), checked against check_images (4 per result, 5 MiB each, png/jpeg/webp/gif, https URLs).
    • Anthropic, Gemini 3+ and Bedrock Claude/Nova receive them inside the tool result.
    • OpenAI-compatible servers and other models get them in a user message right after the tool results.
    • New agent option keep_tool_images (default 3, null for all) keeps only the latest N image-bearing results.
    • Plugin protocol: tool.call results accept images, and initialize announces features: ["tool_images"].
    • The Python, TypeScript and Rust SDKs send images only to hosts that announce it.
    • MCP image blocks are forwarded too.
    • See docs/tool-images.md.
  • graphrt plugin install <name>[@version] installs a plugin from the graphrt-plugins catalog (index.json of its catalog release, or --index <url|path> / $GRAPHRT_PLUGIN_INDEX): the latest version or the exact one, downloaded over https only with a timeout and a size cap, checked against the catalog's sha256, extracted with absolute paths, .., symlinks, hard links and device files refused, then installed like a local directory (manifest validation and checksums included).
    • The plugin's status and tos_risk are printed.
    • Anything but status stable/beta with ToS risk none/low/medium needs --yes, including unlabelled entries and unrecognised labels.
    • A directory with the same name in the current directory still wins.
  • graphrt plugin search [query]: catalog plugins with their latest version, status and a one-line description.
  • docs/plugin-manifest.md: a versioned specification of the plugin manifest (every field with its type, default and constraints, the validation rules and a compatibility policy for protocol_version), and a JSON Schema for manifests, docs/schemas/plugin-manifest.schema.json, tested against the example, fixture and scaffolded manifests and against the parser itself.

Performance

  • Engine, second round (shared outputs map, batched commits, one clock read per node, faster ids, direct template variables).
    • Benchmark harness, Apple M3 Pro, against the first round below (p50, median of 21 alternating runs on a shared machine): 1,000-node chain 0.63 -> 0.40 µs per node, 1,000-way fan-out 0.99 -> 0.52 µs, 100-way fan-out 0.79 -> 0.46 µs, template chain 1.35 -> 1.00 µs, branches 0.60 -> 0.44 µs, parallel iteration 1.25 -> 1.03 µs, loop x iteration 1.20 -> 1.00 µs.
    • Allocations per node 9.1 -> 4.1 (noop chain), 10.9 -> 5.4 (fan-out), 16.7 -> 11.0 (template chain).
    • Concurrent instant LLM runs (median of 15): 239k -> 282k runs/s at 1,000 in flight, 206k -> 230k at 100.
    • Runs bound by a 50 ms model are unchanged.
  • Engine: a node's outputs become its pool namespace and its NodeSucceeded payload without being copied (see Changed (Breaking)), string-literal output names no longer allocate, and namespace lookups scan a few entries instead of hashing with SipHash.
  • Engine: nodes that have already finished are committed together before new nodes start. In a wide fan-out every commit used to copy the namespace table and a shard because a freshly started sibling held a snapshot of it. A batch of completions now shares one copy.
  • Engine: the clock is read about once per node instead of twice. The time a finished node already read is reused for the next node's start and for any nodes skipped in the same step, and a batch of nodes started together shares one reading.
  • Engine: execution ids are written as characters into a reused per-thread buffer, which drops the UTF-8 validation pass each id needed (same format).
  • template-transform: string, number, boolean and null variables are handed to the template directly (a string shares its allocation) instead of through serde. Other values still go through serde, which masks secrets.
  • Engine: fewer allocations and less work per node execution.
    • Node task futures are stored unboxed and are less than half their former size (584 -> 264 bytes)
    • A node that runs alone (chains, fan-ins) is polled without a FuturesUnordered task.
    • The clock is read once per node start instead of twice.
    • Pool namespace lookups use a keyed FxHash-style hasher instead of SipHash.
    • Output names are shared across commits through a per-node cache (since replaced by Variables, whose literal names never allocate)
    • The root pool's shards are sized from the graph.
    • template-transform resolves its variables when the template reads them instead of building and converting a map per render.
    • Benchmark harness, Apple M3 Pro, same machine before and after (p50, median of 11 runs): 1,000-node chain 0.74 -> 0.56 µs per node, 1,000-way fan-out 0.93 -> 0.86 µs, template node 1.38 -> 1.06 µs.
    • Allocations per node 12.2 -> 9.1 (noop chain), 13.1 -> 10.9 (fan-out), 23.8 -> 16.7 (template chain).
    • Concurrent instant LLM runs are unchanged (~285k runs/s at 11 workers): their cost is outside the per-node path.
  • bench/run.sh records allocations per run and per node (graphrt-bench allocs).
  • LLM path: fewer allocations and copies per model call and per streamed chunk.
    • Chunks share their field name and move the provider's text instead of copying it.
    • The llm node renders its prompt into one pre-sized message list, builds usage directly, moves the answer out of the response and builds its metadata once per node.
    • Instant mock model, 10 chunks, Apple M3 Pro (11 cores), against 7444368: 133 -> 103 allocations per run.
    • -13% instructions per run (sequential and with 1,000 runs in flight)
    • Sequential latency 6.5 -> 5.8 µs.
    • Throughput of runs whose events are discarded (run_to_end) is unchanged at 11 workers (~265k runs/s at 100 in flight, ~290k at 1,000): with the macOS system allocator it is bound by the allocator and by the efficiency cores, not by this work.
  • ResponseAssembler: no allocation per chunk on the streaming path (stream buffers looked up by &str, template parts borrowed, only referenced outputs copied), and push_into lets consumers reuse one chunk buffer.
    • Instant LLM run consumed through the assembler: 253 -> 161 allocations, -25% instructions, time to first answer chunk 11.1 -> 9.2 µs, concurrent runs +24% (161k -> 200k runs/s at 100 in flight, 171k -> 214k at 1,000).
  • graphrt serve: live events are shared as Arc<Event> between the run feed, the broadcast channel and SSE listeners instead of deep-copied, and a streaming run's 4,096-slot channel holds 8-byte slots instead of ~256-byte events (it was over 1 MiB per streaming request).
    • LLM workflow against a local instant OpenAI-compatible endpoint, 50 connections, macOS: synchronous 32.7k -> 35.8k req/s, streaming 16.3k -> 21.8k req/s, server RSS after 40k requests 120 -> 39 MiB.
    • Static musl build in a 16 MiB, 1-CPU container with 8 streaming clients and the default --max-runs: the server was OOM-killed before (15.1 MiB peak even with --max-runs 100)
    • It now peaks at 13.8 MiB (7.0 MiB with --max-runs 100), streaming 2.2k -> 3.6k req/s.

Fixed

  • http-request timeout: {connect, read, write} in a document was silently dropped (the loader treated timeout as a node policy key), so documents' HTTP timeouts never applied.
  • The generated Kotlin bindings (bindings/kotlin) did not compile: every GraphrtException variant declared a message field that clashes with Throwable.message.
    • Kotlin now names the field detail (crates/graphrt-ffi/uniffi.toml)
    • Throwable.message still carries the text, and Swift and Python are unchanged.
    • The bindgen-cli feature now enables UniFFI's cargo-metadata so the generator reads that file.

Security

  • code node (JavaScript): a workflow could switch off the sandbox's memory and stack limits by asking for limits.memory_bytes: 0 or limits.stack_bytes: 0 (QuickJS reads zero as "unlimited"), and unbounded recursion then overflowed the native stack and aborted the whole process (for example graphrt serve).
    • An operator stack ceiling above 16 MiB had the same effect, and one above the executor's thread stack (2 MiB on tokio's blocking pool) crashed the process too.
    • Limits now have floors (1 MiB heap, 64 KiB stack) and a 16 MiB stack ceiling, and JavaScript runs on a dedicated thread sized from the stack limit, so deep recursion is always a catchable RangeError.
    • Also fixed in 0.2.1.
  • code node (JavaScript): error messages thrown by scripts are truncated to 8 KiB, so a script cannot push megabytes into events and run records. An operator time limit too large for the clock no longer panics. A long chain of promise jobs is bounded by the time limit between jobs as well.
  • Python subprocess runner: the working directory is created fresh and owner-only (0700) instead of adopting an existing directory at the predictable temp path.
  • Engine: node error messages are scrubbed of every secret the run has seen (type: secret env variables, secret-typed inputs, re-supplied resume secrets, secret outputs) before they reach node_failed / node_retry / run_failed events, error_message outputs of handled errors, the run store and OTel spans.
    • Previously an error that echoed a key (a provider body such as "Incorrect API key provided: sk-...", an HTTP error snippet from an echo endpoint, an exception in code) was recorded verbatim.
    • New public helpers in graphrt_core::redact.
    • Also fixed in 0.2.1.
  • LLM providers: error bodies of failed provider requests are scrubbed of the credentials the request carried (Authorization, x-api-key, x-goog-api-key, api-key headers, key query parameters) before they become error messages.
    • OpenAI-compatible gateways and self-hosted servers often echo the full key.
    • Also fixed in 0.2.1.
  • code node: returned strings containing a secret input (key, or "Bearer " + key) are re-tagged as secrets, so they are masked in node_succeeded events, SSE, run records and snapshots while staying usable downstream. Captured Python stdout is scrubbed. Previously they were stored in plaintext. Also fixed in 0.2.1.
  • HTTP egress policy: also blocks the IPv4-translated form ::ffff:0:a.b.c.d (judged by the embedded IPv4 address), the local-use NAT64 prefix 64:ff9b:1::/48, Teredo 2001::/32 and the Azure WireServer address 168.63.129.16. Also fixed in 0.2.1.
  • OTel HTTP exporter: redirects are no longer followed, so vendor key headers cannot follow a redirect to another host.
  • Bundles: graphrt run/serve --bundle extracted configs to a fixed, predictable directory in the shared temp dir and reused it if it existed, so another local user could pre-create it and plant symlinks or swap providers.json (e.g. pointing base_url at their server).
    • Each invocation now extracts into a new owner-only (0700) directory.
    • Signatures are checked with strict Ed25519 verification.
    • Also fixed in 0.2.1.
  • Plugins: limits.max_message_bytes is capped at 256 MiB. WebAssembly plugins get at most 4 tables of 100,000 elements (was 8 x 1,000,000), which lived outside the memory_bytes budget.
  • graphrt serve: new --max-active-runs (default 256, 0 = unlimited) caps runs executing at once. Further starts and resumes get 429. Previously "async": true requests could start unlimited parallel runs (--max-runs only bounds kept records). Also fixed in 0.2.1.
  • graphrt serve without an API key on a loopback address now accepts only loopback Host names (localhost, 127.0.0.1, [::1]), blocking DNS rebinding from web pages.
    • A non-loopback address without a key prints an explicit warning.
    • Run store I/O errors no longer return server file paths to clients, and top_k on /v1/knowledge/retrieve is capped at 100.
    • Also in 0.2.0.
  • Debug output of OtelConfig (OTLP headers) and the MCP StdioConfig (env) / HttpConfig (headers, bearer token) shows names only, never values.
  • Docs: new docs/security.md (sandbox limits, egress policy, masking guarantees and their limits, deployment knobs). SECURITY.md now has a threat model, explicit scope and supported versions (0.2.x, 0.3.x).
  • Dependencies: rusqlite 0.40 -> 0.41 (bundled SQLite 3.54), fixing RUSTSEC-2026-0459 / CVE-2026-119375 (uninitialized page-cache memory read through a crafted database and -wal pair) in graphrt-rag's SqliteStore.
    • graphrt-rag now needs Rust 1.89.
    • paste (unmaintained, build-time only, via candle) is acknowledged in deny.toml.
    • Also fixed in 0.2.1.

Install

curl -fsSL https://github.com/Graphrt/graphrt/releases/download/v0.3.0/install.sh | sh
brew install graphrt/graphrt/graphrt
cargo install graphrt-cli
docker pull ghcr.io/bimapangestu28/graphrt:0.3.0

The container image of this release was published at ghcr.io/bimapangestu28/graphrt and stays there. Starting with the next release, images are published at ghcr.io/graphrt/graphrt.

  • Windows (experimental): graphrt-x86_64-pc-windows-gnu.zip is cross-compiled from macOS and has not been run on Windows yet. Please report problems in an issue.
  • Still on 0.2.x? The security fixes are also available as 0.2.1.

Full changelog: CHANGELOG.md · v0.2.1...v0.3.0