Query-time knowledge graphs without the upkeep headache
SAG is a RAG engine that builds knowledge graphs on demand at query time instead of maintaining a static graph upfront.

What it does
SAG ingests raw text, decomposes it into “semantic atomic events,” and extracts weighted multi-dimensional entities such as Time, Location, Person, Topic, Action, and Tags. At search time, it dynamically constructs a relationship network across those events and ranks results through a three-stage pipeline: entity recall, multi-hop BFS expansion, and PageRank reranking. The system stores structured data in MySQL and vectors in Elasticsearch or another VecDB.
The interesting bit
The project treats pre-built knowledge graphs as too expensive to maintain. It flips the GraphRAG model by keeping events and entities in SQL tables, then weaving the graph edges on demand during retrieval. A configurable “5W1H” entity schema with per-dimension weights lets you tune how the engine interprets and connects concepts.
Key highlights
- Query-time graph construction: no static knowledge graph to curate or keep updated
- Three-stage retrieval:
Recall→Expand(configurable-depthBFS) →RerankwithPageRank - Custom entity dimensions: extend the default 5W1H schema with domain-specific types and weights
- Hybrid storage layer:
MySQLfor events and entity relations,Elasticsearch/VecDBfor vector retrieval - Open core: the retrieval engine is
Apache 2.0, though team features and managed hosting are reserved for a commercial tier atzleap.ai
Caveats
- Several practical features—team collaboration, auto-syncing data sources, and one-click report generation—are gated behind the commercial “complete version”; the open-source release is single-user and requires self-hosting.
- The repository metadata lists TypeScript, yet the README and SDK examples center on Python and
FastAPI, which suggests the open-source engine is Python-based with a TypeScript frontend or the metadata is simply misleading. - Accuracy and scalability claims in the README rely on self-graded star charts rather than independent benchmarks.
Verdict A solid candidate if you want GraphRAG-style relationship search without the operational burden of a persistent graph database. Look elsewhere if you need a managed, multi-user knowledge base out of the box.
Frequently asked
- What is Zleap-AI/SAG?
- SAG is a RAG engine that builds knowledge graphs on demand at query time instead of maintaining a static graph upfront.
- Is SAG open source?
- Yes — Zleap-AI/SAG is open source, released under the MIT license.
- What language is SAG written in?
- Zleap-AI/SAG is primarily written in TypeScript.
- How popular is SAG?
- Zleap-AI/SAG has 2.2k stars on GitHub and is currently accelerating.
- Where can I find SAG?
- Zleap-AI/SAG is on GitHub at https://github.com/Zleap-AI/SAG.