langchain-ckg
11 agent-stack knowledge graphs, bundled in the wheel. Offline, typed, SHA-256 anchored.
Your coding assistant writes LangChain code from 2024. LangChain v1 renamed create_react_agent → create_agent, moved it to langchain.agents, renamed prompt → system_prompt, and exiled legacy chains to langchain-classic — and every model trained before late 2025 emits the old API by default, while vector indexes of old tutorials confirm it.
This package ships the antidote inside the wheel: pre-built knowledge graphs of the agent stack — LangGraph (including the v1 migration as typed REPLACES edges), MCP, agent memory, the major agent platforms — where every node carries the SHA-256 of the docs page it was extracted from. "Is this current?" becomes a mechanical check, not a hope.
RAG CKG
──────────────────────────────────── ─────────────────────────────────────
Retrieve document chunks Traverse typed dependency graph
Probabilistic similarity match Deterministic BFS from matched concept
No provenance SHA-256 per node — verify any claim
2,982 tokens/query 269 tokens/query (11× cheaper)
F1 = 0.123 F1 = 0.471 (4× better)
Benchmark paper · Dataset · patent-pending methodology
Installation
pip install langchain-ckg
Depends only on langchain-core and httpx. The 11 graphs add ~120KB to the wheel.
Instantiation
from langchain_ckg import CKGRetriever, available_domains
retriever = CKGRetriever() # bundled langgraph domain, offline
print(available_domains()) # all 11 bundled domains
Usage
docs = retriever.invoke("checkpointer")
print(docs[0].page_content)
# # Checkpointer (langgraph)
# ## Prerequisites
# - MemorySaver
# - StateGraph
# - LangGraph Framework
# ## Builds toward
# - thread_id
# Source: https://docs.langchain.com/oss/python/langgraph/persistence
# Source hash: sha256:114c96d9...
print(docs[0].metadata["source_url"]) # provenance in metadata too
Verify any answer against the live docs — no trust required:
curl -s https://docs.langchain.com/oss/python/langgraph/persistence | shasum -a 256
# equals the stored source_hash, or the edge is stale — deterministic either way
Use within an agent
from langchain.agents import create_agent
from langchain.tools import tool
from langchain_ckg import CKGRetriever
retriever = CKGRetriever()
@tool
def langgraph_map(query: str) -> str:
"""Look up current LangGraph concepts, their prerequisites, and source docs."""
return "\n\n".join(d.page_content for d in retriever.invoke(query))
agent = create_agent(model="anthropic:claude-opus-5", tools=[langgraph_map])
One-liner alternative: from langchain_core.tools import create_retriever_tool (works on langchain 0.3.x and 1.x).
Bundled domains
| Domain | What it maps |
|---|---|
langgraph (default) |
StateGraph → checkpointers → streaming → multi-agent, plus the v1 migration as REPLACES edges |
mcp-protocol |
Model Context Protocol — hosts, servers, transports, tools |
agent-memory |
memory design patterns: episodic, semantic, working, cross-session |
agent-loop-patterns |
supervisor, worker, handoff, reflection loops |
aws-bedrock-agentcore |
AWS's agent runtime — gateways, identity, memory, tools |
google-gemini-agent-platform |
Vertex Agent Engine / Gemini agent stack |
a2a-protocol |
agent-to-agent protocol — cards, tasks, artifacts |
microsoft-ai-agent-stack |
Agent Framework (the Semantic Kernel + AutoGen successor) |
crewai |
crews, tasks, processes, flows |
llamaindex |
agents, workflows, query engines |
palantir-foundry |
ontology-first platform — Object/Link/Action Types |
Examples: examples/stale_api_correction.py · examples/agent_memory_map.py — both run offline with no API key.
Hosted retriever — the full 100+ domain library
CKGHostedRetriever queries a hosted CKG MCP endpoint (NVIDIA stack, finance, healthcare, compliance domains). 48-hour free window, then 402 with upgrade options.
from langchain_ckg import CKGHostedRetriever
retriever = CKGHostedRetriever(domain="nvidia-nemo") # free 48h
retriever = CKGHostedRetriever(domain="nvidia-nemo",
license_key="CKGAP-...") # graphifymd.com/pricing
Autonomous payment rails (x402 · Lightning · license key)
# x402 — agent pays itself in USDC on Base L2 when it hits a 402
retriever = CKGHostedRetriever(
domain="nvidia-nemo",
x402_private_key="0x<evm-private-key>", # pip install 'langchain-ckg[x402]'
)
# Lightning — pre-paid invoice, ~$0.001/call
retriever = CKGHostedRetriever(
domain="nvidia-nemo",
lightning_invoice_id="<invoice-id>", # GET {endpoint}/lightning/invoice
)
| Tier | Price | Calls |
|---|---|---|
| Starter | $1 | 100 |
| Bundle | $4 | 500 |
| Dev | $29/mo | Unlimited |
Metered billing: PolarUsageCallback(api_key=..., external_customer_id=...) fires a Polar meter event per retrieval — pass via retriever.invoke(query, config={"callbacks": [cb]}).
Trust anchor chain
Every node carries a SHA-256 hash of its source page bytes at extraction time:
source_url: https://docs.langchain.com/oss/python/langgraph/... ← fetch hint
source_hash: sha256:<64-char hex> ← trust anchor
Full audit chain: edge answer → graph commit → source_hash → source_url. A hash mismatch means the upstream docs changed — the graph tells you it's stale instead of quietly guessing. Four bundled domains (agent-memory, agent-loop-patterns, crewai, llamaindex) currently carry extraction-internal references (metadata.provenance = "extraction-internal") pending re-anchor to public URLs; the rest verify with curl today.
API reference
CKGRetriever(domain="langgraph", depth=3, k=5) — bundled/local, sync .invoke() (async via default ainvoke delegation).
CKGHostedRetriever(endpoint=..., domain=..., license_key=..., x402_private_key=..., lightning_invoice_id=..., depth=3, k=5) — hosted MCP.
available_domains() -> list[str] — bundled domain names.
Links
graphifymd.com · Pricing · PyPI · Benchmark · Dataset
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_ckg-0.6.0.tar.gz.
File metadata
- Download URL: langchain_ckg-0.6.0.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70010b5be502770e004aee98cc02b200d942168d7d04917083facc961b8ee453
|
|
| MD5 |
af04ce6e5e7fde94f23dcb64745311e4
|
|
| BLAKE2b-256 |
1981447fa6f612bf240117d08c69734014733aebc8d5aaa9eb743a75505ca7da
|
File details
Details for the file langchain_ckg-0.6.0-py3-none-any.whl.
File metadata
- Download URL: langchain_ckg-0.6.0-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be9ffb435b9edc5ba8a66c37359143951735ccd61fb771ee78fff09aa449823
|
|
| MD5 |
ec9b7ea8259e3d7c74fe3ac54e5bd620
|
|
| BLAKE2b-256 |
bfda40d9849e76214c9c919af9f4ae137723528b5483c92859697ba89e13041d
|