TrustChain Agent OS
Trust-native protocol layer for AI agents.
Every agent protocol (MCP, A2A, ACP, ANP) handles communication. None handle trust. TrustChain Agent OS is the missing layer underneath all of them — a gateway and a set of framework adapters that bring bilateral signed interaction records, NetFlow Sybil resistance, and automatic trust scoring to 12 major agent frameworks. 205 tests.
Read the full TrustChain overview → — what it is, how it works, and why it matters.
Built on trustchain-py and the trustchain Rust node.
Key Features
- Framework adapters — drop-in trust layer for 12 frameworks: LangGraph, CrewAI, AutoGen, OpenAI Agents, Google ADK, ElizaOS, Claude (Anthropic), Smolagents, PydanticAI, Semantic Kernel, Agno, and LlamaIndex; no agent code changes required beyond initialization
- MCP gateway — FastAPI server that exposes downstream MCP tool servers behind a trust middleware; every tool call is recorded as a bilateral interaction
- Trust-gated services —
@servicedecorator enforcesmin_trustthresholds before any call reaches agent business logic - TrustAgent primitive — lightweight agent abstraction with built-in identity, trust tracking, and service registry
- Automatic trust accumulation — interaction history builds over time; trust scores improve as parties transact honestly
- Fraud resistance — double-spend detection and hard-zero scoring propagate across the interaction graph
Installation
pip install trustchain-agent-os
Optional extras
pip install trustchain-agent-os[gateway] # FastAPI + uvicorn for the MCP gateway
pip install trustchain-agent-os[viz] # Streamlit + Plotly trust graph visualizations
pip install trustchain-agent-os[dev] # pytest + pytest-asyncio
Requires Python 3.11+. Depends on trustchain-py>=2.0 and fastmcp>=3.0.
Quick Start
TrustAgent (minimal)
import asyncio
from agent_os import TrustAgent, TrustContext
buyer = TrustAgent(name="buyer")
seller = TrustAgent(name="seller")
@seller.service("compute", min_trust=0.0)
async def compute(data: dict, ctx: TrustContext) -> dict:
return {"result": data["x"] ** 2}
async def main():
for i in range(1, 11):
ok, reason, result = await buyer.call_service(seller, "compute", {"x": i})
print(
f"Round {i}: {i}^2 = {result['result']}"
f" buyer={buyer.trust_score:.3f} seller={seller.trust_score:.3f}"
)
asyncio.run(main())
Trust scores grow with every completed interaction. After a few rounds the seller can raise min_trust to gate access to higher-value services.
Trust-gated service
@seller.service("premium_analysis", min_trust=0.7)
async def premium_analysis(data: dict, ctx: TrustContext) -> dict:
# Only reachable after the buyer has established sufficient trust history
return {"analysis": "..."}
MCP gateway
# gateway/server.py — run with: uvicorn gateway.server:app
from gateway import create_gateway
app = create_gateway(
upstream_servers=[
{"name": "tools", "url": "http://localhost:3000/mcp"},
],
trust_threshold=0.5, # minimum trust score to call any tool
)
pip install trustchain-agent-os[gateway]
uvicorn gateway.server:app --port 8080
Every tool call arriving at the gateway is checked against the caller's trust score. The result is recorded as a bilateral interaction block, building the caller's trust history over time.
Framework Adapters
Each adapter wraps a framework's native agent/crew/graph abstraction to add TrustChain identity and bilateral interaction recording. Adapters share a common interface through tc_frameworks.base.TrustChainAdapter.
LangGraph
from tc_frameworks.adapters.langgraph_adapter import LangGraphTrustAdapter
adapter = LangGraphTrustAdapter(agent_name="my-langgraph-agent")
result = await adapter.invoke({"messages": [{"role": "user", "content": "hello"}]})
CrewAI
from tc_frameworks.adapters.crewai_adapter import CrewAITrustAdapter
adapter = CrewAITrustAdapter(agent_name="my-crew")
result = await adapter.invoke({"task": "summarize recent news"})
AutoGen
from tc_frameworks.adapters.autogen_adapter import AutoGenTrustAdapter
adapter = AutoGenTrustAdapter(agent_name="my-autogen-agent")
result = await adapter.invoke({"message": "analyze this dataset"})
OpenAI Agents SDK
from tc_frameworks.adapters.openai_agents_adapter import OpenAIAgentsTrustAdapter
adapter = OpenAIAgentsTrustAdapter(agent_name="my-openai-agent")
result = await adapter.invoke({"input": "draft an email"})
Google ADK
from tc_frameworks.adapters.google_adk_adapter import GoogleADKTrustAdapter
adapter = GoogleADKTrustAdapter(agent_name="my-adk-agent")
result = await adapter.invoke({"query": "search for recent papers"})
ElizaOS
from tc_frameworks.adapters.elizaos_adapter import ElizaOSTrustAdapter
adapter = ElizaOSTrustAdapter(agent_name="my-eliza-agent")
result = await adapter.invoke({"message": "hello"})
All adapters are cached — the underlying agent/crew/graph is built once on first invocation and reused across calls.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Your Agent (LangGraph / CrewAI / AutoGen / OpenAI / ADK / ...) │
├──────────────────────────┬──────────────────────────────────────┤
│ tc_frameworks adapters │ agent_os.TrustAgent + decorators │
│ (per-framework wrappers)│ (lightweight agent primitive) │
├──────────────────────────┴──────────────────────────────────────┤
│ gateway/ │
│ FastAPI MCP gateway · trust middleware · interaction recorder │
│ peer registry · trust_tools (MCP tool wrappers) │
├─────────────────────────────────────────────────────────────────┤
│ trustchain-py (Python) │
│ Identity · HalfBlock · BlockStore · TrustEngine · NetFlow │
├─────────────────────────────────────────────────────────────────┤
│ trustchain-node (Rust sidecar, optional) │
│ QUIC P2P · SQLite WAL · transparent proxy :8203 │
└─────────────────────────────────────────────────────────────────┘
Project Structure
trustchain-agent-os/
├── agent_os/
│ ├── agent.py TrustAgent: identity, service registry, call_service
│ ├── context.py TrustContext: per-call trust metadata
│ └── decorators.py @service decorator with min_trust enforcement
│
├── gateway/
│ ├── server.py FastAPI application factory (create_gateway)
│ ├── middleware.py Trust enforcement middleware
│ ├── recorder.py Bilateral interaction recording
│ ├── registry.py Peer and upstream server registry
│ ├── node.py TrustChain node lifecycle management
│ ├── config.py Gateway configuration (UpstreamServer, GatewayConfig)
│ └── trust_tools.py MCP tool wrappers with trust metadata
│
├── tc_frameworks/
│ ├── base.py TrustChainAdapter base class
│ ├── adapters/ Real framework adapters (12)
│ │ ├── langgraph_adapter.py
│ │ ├── crewai_adapter.py
│ │ ├── autogen_adapter.py
│ │ ├── openai_agents_adapter.py
│ │ ├── google_adk_adapter.py
│ │ ├── elizaos_adapter.py
│ │ ├── claude_agent_adapter.py
│ │ ├── smolagents_adapter.py
│ │ ├── pydantic_ai_adapter.py
│ │ ├── semantic_kernel_adapter.py
│ │ ├── agno_adapter.py
│ │ └── llamaindex_adapter.py
│ └── mock/ Mock adapters for testing (6)
│
├── examples/ Runnable examples
│ ├── hello_trust.py Minimal TrustAgent demo
│ ├── trust_gate.py Trust-gated service demo
│ ├── framework_interop.py 11 frameworks, one trust ledger (USB-C of trust)
│ ├── multi_provider_team.py Collaborative pipeline with trust gates
│ ├── agent_marketplace.py Competitive agents with Sybil detection
│ ├── marketplace.py Multi-agent marketplace simulation
│ ├── network.py P2P network simulation
│ ├── llm_agents.py LLM-backed agents with trust
│ └── demo_gateway.py MCP gateway demo
│
├── docs/
│ ├── TRUSTCHAIN-OVERVIEW.md Comprehensive project overview and use cases
│ └── results/ Demo run outputs with analysis
│
└── tests/
├── integration/ 126 integration tests
└── smoke/ 45 smoke, e2e, and stress tests
Why TrustChain vs. API Keys
| Problem | API Keys / OAuth | TrustChain |
|---|---|---|
| Agent A calls Agent B | Credential exchange, shared secrets | Bilateral signed proof; no shared secrets |
| Sybil attacks | Trivially circumvented with new accounts | Max-flow graph analysis — fake identities cannot create real transaction paths |
| "Who do I trust?" | Centralized registries | Each agent computes trust from its own chain view |
| Accountability | Server logs (mutable, unilateral) | Append-only chains with hash links — tampering is cryptographically detectable |
| Cold start | Credentials granted upfront | Bootstrap interactions, then earn trust through real history |
| Discovery | Registry must be trusted | Any discovery source returns (endpoint, pubkey); trust is ground truth from the bilateral ledger |
Development
git clone https://github.com/viftode4/trustchain-agent-os.git
cd trustchain-agent-os
pip install -e ".[dev]"
pytest tests/ -v
The CI pipeline checks out trustchain-py from its sibling repository before install.
Related Projects
- trustchain — Rust node: production sidecar binary, 4 crates, QUIC P2P, MCP server, 214 tests
- trustchain-py — Python SDK: zero-config
trustchain.init(), full protocol bindings, 174 tests
License
MIT
Metadata
Release files for trustchain-agent-os 2.0.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 | |
|---|---|---|---|---|
| trustchain_agent_os-2.0.0.tar.gz | 148.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trustchain_agent_os-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 200.0 kB
Release files / trustchain_agent_os-2.0.0.tar.gz
| Download URL | trustchain_agent_os-2.0.0.tar.gz |
|---|---|
| Size | 148.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
033e201a6bcf7c346d3e45c1563ff48df749c9715ea77e90324fec1c711124f2
|
|
BLAKE2b-256 checksum How to use checksums |
904b26b8c61345f5b43071641fa5525da95e42dc72e1a980d62775795d1bcf63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 3, 2026.
Transparency logRelease files / trustchain_agent_os-2.0.0-py3-none-any.whl
| Download URL | trustchain_agent_os-2.0.0-py3-none-any.whl |
|---|---|
| Size | 51.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0816cb7b71d5a11c9e520449b7571b205b897639d956eb01c4d67cc8d8e52c5b
|
|
BLAKE2b-256 checksum How to use checksums |
6bb4329a766ddc6de5370955abbd97702aadd74610cef1f15a206ce5833e779b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 3, 2026.
Transparency logSecurity for trustchain-agent-os 2.0.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 trustchain_agent_os-2.0.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 Mar 3, 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.