graphwalk
Cheap, confidence-scored question answering over a knowledge graph you already have. Python library, CLI, and MCP server for agents.
graphwalk answers a question by walking the graph from the entities it names. Each hop
is a constrained classification decision: the current node's relations, plus
STOP, are the options, and a fast decision model returns a probability for each. So
every answer comes with a path and a confidence, and you can escalate the unsure
ones to a stronger model.
pip install graphwalk
graphwalk import kg.nt --graph kg.db # triples: CSV, TSV, JSONL, N-Triples; no key needed
graphwalk query kg.db "Where was the director of Inception born?" --escalate-below 0.9
When to use it (measured)
Every number below comes from an experiment in docs/, on samples of 30–300
questions. Treat them as directions, not guarantees.
| Situation | What we found |
|---|---|
| An agent exploring a KG with graph tools (MCP) | Adding graphwalk's walk tool cut a strong agent's cost by 25% (95% CI 7–45%) at equal accuracy (0.75 vs 0.71 F1, n=30, WebQSP). Text search over the same facts was as accurate and a little cheaper, but slower. |
| Existing KG, cost or latency first, or you need a per-answer confidence | walk is ~6× cheaper and ~4× faster than an LLM writing the query, and its confidence ranks answers well (AUROC 0.92 on WebQSP, up to 0.97 on MetaQA). |
| Existing KG, best accuracy | Have an LLM write the query instead: 0.66 vs 0.49 F1 on a 5,419-relation Freebase graph. |
| Questions with constraints or superlatives (CWQ) | Not graphwalk. Every system we tried scored about 0.3. |
| Questions over documents | Not graphwalk. Multi-step RAG wins by 10–19 F1. Text ingestion exists but is experimental. |
graphwalk does not claim to be more accurate than an LLM. What it offers is a cheap first answer that knows when it might be wrong.
Quickstart
Decisions use the Jev model, through OpenRouter
(OPENROUTER_API_KEY) or TypeSafe (TYPESAFE_API_KEY). Without either,
GRAPHWALK_DECISION_FALLBACK=llm lets any chat model decide (slower, not calibrated).
import asyncio
from graphwalk import Index
async def main() -> None:
async with Index.open("kg.db", escalate_below=0.9) as index:
await index.import_triples("kg.nt") # idempotent
result = await index.walk("Where was the director of Inception born?")
print(result.best.names, result.confidence, result.escalated, result.cost_usd)
asyncio.run(main())
A runnable example over a 15-triple movie graph is in
examples/kg/.
For agents (MCP)
pip install 'graphwalk[mcp]'
claude mcp add --env OPENROUTER_API_KEY=sk-or-... graphwalk -- graphwalk mcp --db kg.db
Tools: walk (answers, paths, confidence), neighbors, get_node, status, plus
locate/read/ingest for text. The usual loop: call walk first; at confidence 0.9
or above, take the answer; below it, check it with neighbors or escalate. The server
also runs over HTTP with bearer or OAuth 2.1 auth, and ships as a container. See
MCP setup.
The package carries its own guide for coding agents: graphwalk guide (or
graphwalk guide --skill for a SKILL.md), and llms.txt.
Install options
| Extra | Enables |
|---|---|
| (none) | import, walk, query, the CLI |
mcp |
the MCP server (stdio and HTTP) |
llm |
LiteLLM: escalation, the LLM decider, text ingestion |
embeddings |
local fastembed embedder (prefilter, dense locate) |
eval |
dataset loaders for the benchmarks |
Documentation
- Docs site: quickstart, agents and MCP, configuration, text ingestion, evidence.
- Results: every experiment, with CIs, costs, and the runs behind it.
- Design record and roadmap.
Status
Alpha (v0.1). The public API is what graphwalk exports; submodules may change between
minor versions. Results are from small samples, mostly one seed. The decision model
(Jev) is a hosted model from TypeSafe; this project has no affiliation with TypeSafe,
and the LLM-decider fallback keeps it usable without Jev.
Development
See CONTRIBUTING.md.
License
Apache-2.0. See LICENSE.
Metadata
Release files for graphwalk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| graphwalk-0.1.0.tar.gz | 172.8 kB | With provenance | Details for graphwalk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| graphwalk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for graphwalk-0.1.0-py3-none-any.whl |
Total release size: 391.9 kB
Release files / graphwalk-0.1.0.tar.gz
| Download URL | graphwalk-0.1.0.tar.gz |
|---|---|
| Size | 172.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76603d2da728aba9c7f26b96ce1555b0613af30bc2f2a20bbb5cb5db30ddea34
|
|
BLAKE2b-256 checksum How to use checksums |
50d48ba62fbe945a68a140eb84a3551fb490c0c7661b133f466124111efc8993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logRelease files / graphwalk-0.1.0-py3-none-any.whl
| Download URL | graphwalk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 219.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5371212696602c2040c82f049e9e9a35d2e50686cb3cbe79b4beabe2f1b3cada
|
|
BLAKE2b-256 checksum How to use checksums |
a1ed2b115267b26baa956d5dc6d080bab801d48d1eff0c79d40f447f98b20ab7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logSecurity for graphwalk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for graphwalk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.