Repository navigation
Graphrt 0.2.0
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).ChunkerConfiggainsparent_max_charsandTextChunkgainsparent(breaking for struct literals)- Children carry
parent_indexmetadata.
- Knowledge base datasets can be created and deleted at runtime:
GET /v1/knowledge/resources,POST /v1/knowledge/datasetsandDELETE /v1/knowledge/datasets/{dataset}, backed byKnowledgeBase::{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 byserve,runandkb.
graphrt-rag:VectorStore::list_documents(memory and SQLite stores),DocumentSummary,KnowledgeBase::{list_documents, document_chunks, delete_document, is_managed},RagError::Unsupported.IngestReportis serializable.graphrt-rag:LocalEmbedder(featurelocal-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-v2by default,intfloat/multilingual-e5-smallfor Indonesian and other languages) or a local model directory. - Configured as
embedders: { local: { type: local, model: ... } }. - On by default in
graphrt-cli(featurelocal-embed, about +2.1 MiB).
- BERT-family models from Hugging Face (
graphrt-ffi: the SQLite knowledge store is available on mobile, so bundles usingstores: { ...: { 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 asgraphrt-plugins) work.- Absolute paths,
..and symlinks are rejected. - Only that directory is copied.
- Library:
graphrt-pluginaddsinstall_from_git_subdir(install_from_gitis unchanged).
- Absolute paths,
graphrt-core:Registry::register_lazily_described, which builds a node kind's catalog descriptor only when it is first requested.graphrt-cli: optionalmimallocfeature to replace the global allocator.
Changed
- Breaking (
graphrt-rag): clones of aKnowledgeBaseshare their datasets (so datasets created through one clone are visible to all).KnowledgeBase::datasetsreturnsVec<DatasetInfo>andchunkingreturns an ownedChunkerConfig. - Breaking (
graphrt-core): thenode_idandexec_idfields of everyEventvariant areArc<str>instead ofString, 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 ofnode_id == "llm", usenode_id.to_string()where aStringis needed, and.into()when building an event from aString.
- Breaking (
graphrt-core):GraphNode::{kind, title}and thekindandtitleofEvent::NodeStartedareArc<str>(shared, not copied per execution). Serialized events are unchanged. - Breaking (
graphrt-core): run stores keep events as serialized JSON:RunStore::append_events/eventstake and returnVec<StoredEvent>(Box<serde_json::value::RawValue>), built withevent_to_stored.stored_event_typereads an event's type.- The stored text is identical to what
event_to_jsonproduced, soGET /v1/runs/{id}/eventsis unchanged.
- Breaking (
graphrt-http):HttpClient::clientandHttpClient::manual_redirect_clientreturnResult<&reqwest::Client, ClientError>. The four underlying clients are built on first use.ClientErrorisClone.
Performance
- Startup no longer loads the system trust store for HTTP clients a run never uses: LLM providers (
graphrt-llm) andgraphrt-httpbuild their clients on the first request.graphrt run hello.yamlused 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-transformcompiles 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!, andArc<str>ids are copied without going throughDisplay.- 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 setTCP_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 servewithout--storekept 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-runsruns (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.0The 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