Skip to content

Graphrt 0.2.0

Choose a tag to compare

@BimaPangestu28 BimaPangestu28 released this 19 Nov 04:10
· 317 commits to main since this release

Knowledge bases you can manage from an app, in process embeddings, serving on small devices, and a much faster engine and server. Contains breaking API changes, see Changed.

Added

  • graphrt serve --max-runs <n>. See docs/serving.md for small-device numbers.
  • Knowledge base API in graphrt serve (with --knowledge): list datasets and documents (paged), add or replace documents from text or uploaded files (--max-upload-bytes, default 16 MiB), inspect a document's chunks, delete documents, and test retrieval, all on the knowledge base the workflows use.
    • Ingestion runs one request at a time to keep small devices responsive.
  • Documents can be disabled and re-enabled (PATCH .../documents/{document}, KnowledgeBase::set_document_enabled): a disabled document keeps its chunks and stays disabled across re-ingestion, but no search returns it (memory, SQLite and Qdrant stores, reserved chunk metadata key _disabled).
  • Parent-child chunking per dataset (chunking: { max_chars, parent_max_chars } in the knowledge config, KnowledgeBase::set_chunking): small children are embedded and searched, and retrieval returns each matching parent once, rebuilt from its children (nothing extra stored).
    • ChunkerConfig gains parent_max_chars and TextChunk gains parent (breaking for struct literals)
    • Children carry parent_index metadata.
  • Knowledge base datasets can be created and deleted at runtime: GET /v1/knowledge/resources, POST /v1/knowledge/datasets and DELETE /v1/knowledge/datasets/{dataset}, backed by KnowledgeBase::{create_dataset, remove_dataset, dataset_details, resource_names, runtime_datasets}.
    • New datasets name a store, embedder and reranker declared in the knowledge config.
    • They are saved next to it (kb.datasets.json) and recreated on start by serve, run and kb.
  • graphrt-rag: VectorStore::list_documents (memory and SQLite stores), DocumentSummary, KnowledgeBase::{list_documents, document_chunks, delete_document, is_managed}, RagError::Unsupported. IngestReport is serializable.
  • graphrt-rag: LocalEmbedder (feature local-embed), sentence embeddings computed in-process with candle on the CPU: no embedding server, API key or network once the model is cached.
    • BERT-family models from Hugging Face (sentence-transformers/all-MiniLM-L6-v2 by default, intfloat/multilingual-e5-small for Indonesian and other languages) or a local model directory.
    • Configured as embedders: { local: { type: local, model: ... } }.
    • On by default in graphrt-cli (feature local-embed, about +2.1 MiB).
  • graphrt-ffi: the SQLite knowledge store is available on mobile, so bundles using stores: { ...: { type: sqlite } } load on Android and iOS (built and linked for Android arm64, iOS not built yet).
  • graphrt plugin install <git-url> --subdir <path> installs a plugin from a subdirectory of a git repository, so monorepos with one plugin per directory (such as graphrt-plugins) work.
    • Absolute paths, .. and symlinks are rejected.
    • Only that directory is copied.
    • Library: graphrt-plugin adds install_from_git_subdir (install_from_git is unchanged).
  • graphrt-core: Registry::register_lazily_described, which builds a node kind's catalog descriptor only when it is first requested.
  • graphrt-cli: optional mimalloc feature to replace the global allocator.

Changed

  • Breaking (graphrt-rag): clones of a KnowledgeBase share their datasets (so datasets created through one clone are visible to all). KnowledgeBase::datasets returns Vec<DatasetInfo> and chunking returns an owned ChunkerConfig.
  • Breaking (graphrt-core): the node_id and exec_id fields of every Event variant are Arc<str> instead of String, so the engine shares the ids it already holds instead of allocating two strings per event (every streamed chunk included).
    • Serialized events are unchanged.
    • Migrating: compare with node_id.as_ref() == "llm" instead of node_id == "llm", use node_id.to_string() where a String is needed, and .into() when building an event from a String.
  • Breaking (graphrt-core): GraphNode::{kind, title} and the kind and title of Event::NodeStarted are Arc<str> (shared, not copied per execution). Serialized events are unchanged.
  • Breaking (graphrt-core): run stores keep events as serialized JSON: RunStore::append_events / events take and return Vec<StoredEvent> (Box<serde_json::value::RawValue>), built with event_to_stored.
    • stored_event_type reads an event's type.
    • The stored text is identical to what event_to_json produced, so GET /v1/runs/{id}/events is unchanged.
  • Breaking (graphrt-http): HttpClient::client and HttpClient::manual_redirect_client return Result<&reqwest::Client, ClientError>. The four underlying clients are built on first use. ClientError is Clone.

Performance

  • Startup no longer loads the system trust store for HTTP clients a run never uses: LLM providers (graphrt-llm) and graphrt-http build their clients on the first request. graphrt run hello.yaml used to read every CA certificate six times (361 file opens, now 1).
  • Built-in node kinds build their catalog descriptors lazily: node registry construction went from ~530 µs to ~7 µs.
  • template-transform compiles its template once instead of on every run: ~20% less engine time per template node.
  • Net effect, graphrt run hello.yaml (static musl binary, Linux arm64): 10.1 ms -> 6.5 ms wall clock, 3.1 ms -> 0.6 ms user CPU.
  • Fewer allocations per run and per node execution: a variable pool allocates its namespace shards on first write (an empty pool was 33 allocations, one per execution frame), namespace keys are reused instead of re-allocated on every write, node commits without variable writes skip the undo log, execution ids are written without format!, and Arc<str> ids are copied without going through Display.
    • On the benchmark harness (Apple M-series, same machine before and after): 1,000 concurrent instant runs 63k -> 82k runs/s (+31%), per-node scheduling 1.55 -> 1.27 µs (noop chain) and 2.31 -> 1.57 µs (1,000-way fan-out), time to first streamed chunk overhead 14.5 -> 11.6 µs.
  • Shared Arc<str> event ids (see Changed) took the same benchmark to 94k runs/s (+49% over 0.1.0 in total), 1.06 µs per noop node and a 10.2 µs streaming overhead. The response assembler and the OpenTelemetry tracer key their maps by the shared ids too.
  • Cheaper per-frame bookkeeping: index-keyed maps use a multiplicative hasher and are sized up front, and the scope's id set is built only when a node writes variables.
    • Against 0.1.0 on the same machine: 0.87 µs per node on a 1,000-node chain (was 1.55), 1.18 µs on a 1,000-way fan-out (2.31), 98k instant runs/s (63k)
    • Raw data in bench/results/2026-11-1{8,9}-*.
  • graphrt serve: a run's 4,096-slot broadcast channel is created only when something subscribes to its events (it took ~30% of server CPU), and accepted connections set TCP_NODELAY (streamed responses no longer wait ~40 ms for a delayed ACK on Linux).
    • Static musl, Linux arm64, 1 CPU: synchronous runs 2,875 -> 20,613 req/s, streaming 382 -> 3,392 req/s, async 4,232 -> 20,499 req/s.
    • macOS native synchronous 26k -> 46k req/s.
  • Engine: fewer allocations per node execution (ids built on the stack, shared Arc<str> kind/title, outputs no longer copied into the pool), run events queued in a reusable buffer with an atomic waker instead of an mpsc channel, and stored events kept as JSON text (297 ns and 2.6 allocations per event, was 485 ns and 14.3).
    • Per-node scheduling another 7-15% lower (0.73 µs on a 1,000-node chain).
  • bench/run.sh: the harness's global allocation counter is enabled only in the sections that read it. It had capped the concurrency section at ~60-80k runs/s. With it gated the same machine measures ~300k runs/s for the llm graph and ~390k for a no-LLM graph at 11 workers (a measurement fix, not a runtime speed-up).

Fixed

  • graphrt serve without --store kept every run (record and events) in memory forever: under a 32 MiB limit the server was OOM-killed after ~1,800 runs. The in-memory store now keeps at most --max-runs runs (default 1000), dropping the oldest finished runs first and always keeping running and paused ones.

Install

curl -fsSL https://github.com/Graphrt/graphrt/releases/download/v0.2.0/install.sh | sh
# or
cargo install graphrt-cli
docker pull ghcr.io/bimapangestu28/graphrt:0.2.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.

Full changelog: CHANGELOG.md · v0.1.0...v0.2.0