KGLite¶
An embedded Cypher dialect for LLM-agent workloads. A knowledge graph that
runs inside your process — load data, query with Cypher, and hand the graph to
an agent via the bundled MCP server. The embedded path needs no database
service; one .kgl file can move between Python and Rust bindings.
The engine is a pure-Rust crate (kglite); the wheel
(pip install kglite) is a PyO3 wrapper around it. Bolt and MCP
protocol servers are standalone Rust binaries that wrap the same
engine. The .kgl file format is portable across all bindings.
Start here¶
Install
kglite(Python) or add thekglitecrate (Rust).Build a graph with inline records, DataFrames, Cypher, or a companion project such as codingest/kglite-datasets.
Query with Cypher or the fluent API; use
Session/Transactionwhen a failed mutation must roll back.Save a
.kgl, or serve it through the CLI, MCP, or Bolt binary.
Python quickstart · Cypher reference · Fluent API · Rust quickstart · Operators and deployment · Reference · 0.13 → 0.14 migration
Cypher first
Cypher is the primary query surface — agents already know it, and
the engine targets an explicitly documented openCypher-compatible subset
(including three-valued NULL logic), checked with independently authored local
contracts and optional Neo4j differential runs. DataFrame
loaders add_nodes() / add_connections() exist to get bulk data
in; once it’s in, you query with Cypher.
Embedded, in-process |
No database service; |
LLM-agent surface |
Bundled MCP server + |
Cypher subset, honest semantics |
Querying + mutations + |
In-memory by default |
Mapped + disk modes for Wikidata-scale; in-memory is the design centre |
Label model |
One primary type + optional secondary labels — see multi-label rationale |
One-file persistence |
|
Rust-embeddable |
Pure-Rust core; embed without PyO3 — see Rust track |
Ecosystem
kglite is the engine. Two companion projects build graphs it serves — each released and versioned on its own cadence:
kglite — the embedded Cypher knowledge-graph engine (this project): graph + Cypher + fluent API + bundled MCP server.
codingest — parses codebases into code graphs (14 languages, web-framework route detection). Build with it, query the
.kglhere. Requires kglite ≥ 0.14.kglite-datasets — fetch-build-cache loaders for public registries (SEC EDGAR, Wikidata, Sodir).
sonagram — turns a local music library into a kglite knowledge graph via sonara audio analysis (tempo, energy, mood, key); AI agents curate playlists over it through a simple bundled skill and CLI (
pip install sonagram).
Coming from 0.13? The code-graph builder and dataset loaders moved out of
the wheel in 0.14 — see the 0.13 → 0.14 migration guide.
Pin back anytime with pip install "kglite<0.14".
Pick your track
Python guide —
pip install kglite, thenimport kglite. The headline track; covers data loading, Cypher, the MCP server, agents.Rust guide — embed the engine in a Rust binary (
cargo add kglite). For graph-as-a-library use cases without the Python wheel.Operators — choose and run the CLI, MCP, or Bolt binary; storage, auth/TLS, and deployment guidance.
Reference — Python, Cypher, fluent, Rust, C ABI, and CLI reference surfaces.
Concepts — architecture + design decisions + contributor docs.