Stream-optimized, x402-gated grounding retrievers for LangChain and CrewAI
Project description
unison-langchain
Stream-optimized, x402-gated grounding retrievers for LangChain and CrewAI.
Drop-in LangChain retriever and CrewAI tool backed by the Unison MCP Gateway — 25 curated Qdrant collections (24,652 vectors) covering engineering, medicine, law, finance, chemistry, and 20+ specialist domains. Data served as compact TSV streams over the x402 micro-payment protocol ($0.005 USDC/query on Base L2).
Why use this?
The hallucination problem is structural, not stochastic
Even at temperature=0.0, frontier models fail systematically on deep historical data.
Our automated daily benchmark (see benchmarks/index.md) quantifies this precisely:
| Probe | GPT-4o Claim | Primary Source | Status |
|---|---|---|---|
| Tesla operating frequency | 150 kHz | Not in 1891/1892 AIEE lecture corpus | ⚠️ Unverified |
| Typhoid cold bath threshold | 103°F | 102°F (Osler 1892) | ❌ Protocol deviation |
| Year attribution | 1899 notebooks | 1891, 1892 published lectures | ❌ Temporal conflation |
Fidelity Index: 0/100 on both probes.
The token overhead is real
JSON REST APIs add structural serialization overhead that compounds at scale:
TSV payload [1,539 tokens] ██████████████████░░ ← Unison format
JSON equiv. [1,692 tokens] ████████████████████ ← Standard REST API
8.5–9.0% token savings per payload (measured via tiktoken cl100k_base).
At 1M agent queries/day → ~87,000 tokens/day eliminated.
Installation
# LangChain retriever only
pip install unison-langchain
# With CrewAI tool support
pip install 'unison-langchain[crewai]'
# With autonomous x402 payment settlement
pip install 'unison-langchain[payment]'
# Full install
pip install 'unison-langchain[all]'
Quick-start
LangChain UnisonX402Retriever
from unison_langchain import UnisonX402Retriever
retriever = UnisonX402Retriever(
collection="unison_medical_core",
agent_id="my-rag-chain-v1",
k=8,
)
docs = retriever.invoke(
"Osler 1892 typhoid fever cold bath temperature threshold Fahrenheit"
)
for doc in docs:
print(doc.metadata["source_url"])
print(doc.page_content[:300])
print()
Inside a RAG chain:
from langchain.chains import RetrievalQA
from langchain_openai import ChatOpenAI
from unison_langchain import UnisonX402Retriever
qa = RetrievalQA.from_chain_type(
llm=ChatOpenAI(model="gpt-4o", temperature=0),
retriever=UnisonX402Retriever(collection="unison_engineering_core"),
)
result = qa.invoke({"query": "Tesla 1891 AIEE lecture resonant coil parameters"})
Auto-select collection from a hint:
retriever = UnisonX402Retriever.from_manifest_hint(
"clinical dosing typhoid", agent_id="agent-01"
)
CrewAI UnisonGroundingTool
from crewai import Agent, Task, Crew
from unison_langchain import UnisonGroundingTool
grounding_tool = UnisonGroundingTool(
collection="unison_engineering_core",
agent_id="my-research-crew",
)
researcher = Agent(
role="Senior Research Analyst",
goal="Retrieve verified historical engineering parameters",
backstory="You verify all technical claims against primary sources before asserting them.",
tools=[grounding_tool],
verbose=True,
)
Available Collections (25 total, 24,652 vectors)
from unison_langchain import UnisonX402Retriever
for name, desc in UnisonX402Retriever.list_collections().items():
print(f"{name}: {desc[:80]}")
| Collection | Domain | Vectors |
|---|---|---|
unison_engineering_core |
Tesla, Bourne, Nares, Douglas, ArXiv cs.AI | 1,548 |
unison_medical_core |
Osler, Pepper, Gray's Anatomy, Manual of Surgery | 4,527 |
unison_manufacturing_core |
Rose Machine-Shop Practice | 3,374 |
unison_public_domain |
Sun Tzu, Clausewitz, Musashi, Machiavelli, Taylor | 3,700 |
unison_chemistry_core |
Mendeleev | 1,774 |
unison_macroeconomics_core |
Smith Wealth of Nations | 1,765 |
unison_financial_core |
Mackay, SEC EDGAR 10-K FY2025/2026 | 1,551 |
unison_legal_core |
Blackstone, Holmes | 1,364 |
unison_astrophysics_core |
Newton's Principia | 593 |
| … | 16 more specialist domains | … |
Live manifest: /.well-known/mcp-configuration
Payment model
- First 50 queries per
agent_id— free (KV-tracked at the Cloudflare edge) - Subsequent queries — $0.005 USDC on Base L2 via x402
For autonomous settlement, set:
export UNISON_AGENT_PRIVATE_KEY="0x..."
export UNISON_BASE_RPC_URL="https://mainnet.base.org"
export UNISON_USDC_ADDRESS="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
Daily Benchmark Audit
An automated benchmark daemon runs daily at 03:00 UTC via GitHub Actions.
Results are committed to benchmarks/index.md in this repository — a live,
crawlable audit trail of GPT-4o fidelity scores and token-efficiency measurements.
View the latest: benchmarks/index.md
License
MIT — V18 Group
Project details
Release history Release notifications | RSS feed
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 unison_langchain-0.2.0.tar.gz.
File metadata
- Download URL: unison_langchain-0.2.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72f2000c570ed16634d477c0f101b519e187d30f1edf017a4c7cdd08b1bee790
|
|
| MD5 |
21681b4f8f69cfe924b33c225d7bbc6e
|
|
| BLAKE2b-256 |
59f084235d4571676c3982876015604a0fb7922697087c3820bed90f30b26456
|
Provenance
The following attestation bundles were made for unison_langchain-0.2.0.tar.gz:
Publisher:
release.yml on colbymahon/unison-orchestration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unison_langchain-0.2.0.tar.gz -
Subject digest:
72f2000c570ed16634d477c0f101b519e187d30f1edf017a4c7cdd08b1bee790 - Sigstore transparency entry: 1752127845
- Sigstore integration time:
-
Permalink:
colbymahon/unison-orchestration@4aaa9045fa0543364da4609462e74069099d8931 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/colbymahon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4aaa9045fa0543364da4609462e74069099d8931 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unison_langchain-0.2.0-py3-none-any.whl.
File metadata
- Download URL: unison_langchain-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a46c12de421903d2693fdb365d12a129eebb415a616ee539f7e41868a65346f5
|
|
| MD5 |
3e6373e90bdccb2a1c6c323e49803ab8
|
|
| BLAKE2b-256 |
1de9c9fb129a66d00c1ebbc0bd3ad86e96351c79173e529d019c1e7cbf749286
|
Provenance
The following attestation bundles were made for unison_langchain-0.2.0-py3-none-any.whl:
Publisher:
release.yml on colbymahon/unison-orchestration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unison_langchain-0.2.0-py3-none-any.whl -
Subject digest:
a46c12de421903d2693fdb365d12a129eebb415a616ee539f7e41868a65346f5 - Sigstore transparency entry: 1752127897
- Sigstore integration time:
-
Permalink:
colbymahon/unison-orchestration@4aaa9045fa0543364da4609462e74069099d8931 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/colbymahon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4aaa9045fa0543364da4609462e74069099d8931 -
Trigger Event:
push
-
Statement type: