AgentOath trust protocol integration for LangChain -- automatic trust receipts for chains, tools, and LLM calls.
Project description
langchain-agentoath
AgentOath trust protocol integration for LangChain.
Automatically generates cryptographically signed trust receipts for every LangChain chain execution, tool call, and LLM interaction.
Installation
pip install langchain-agentoath
For full LangChain integration (optional):
pip install langchain-agentoath[langchain]
Quick Start
Callback Handler -- automatic receipts
from agentoath import TrustAgent
from langchain_agentoath import AgentOathCallbackHandler
# Create an agent identity
agent = TrustAgent.create(name="MyChain", capabilities=["chat"])
# Create the callback handler
handler = AgentOathCallbackHandler(agent)
# Attach to any LangChain chain
result = chain.invoke(
{"input": "What is the weather?"},
config={"callbacks": [handler]},
)
# Every chain/tool/LLM event now has a signed receipt
for receipt in handler.receipts:
print(receipt.action, receipt.rating, receipt.description)
TrustedChain -- wrapper with pre/post receipts
from langchain_agentoath import TrustedChain
trusted = TrustedChain(chain=my_chain, agent=agent)
result = trusted.invoke({"input": "hello"})
# Pre-execution + post-execution + per-step receipts
print(f"Generated {len(trusted.receipts)} trust receipts")
Trust-aware Tools
from langchain_agentoath import VerifyAgentTool, SignReceiptTool, CheckTrustTool
tools = [
VerifyAgentTool(trust_agent=agent),
SignReceiptTool(trust_agent=agent),
CheckTrustTool(trust_agent=agent, min_score=0.7),
]
# Use in any LangChain agent
result = tools[0].run('{"agent_did": "did:trust:agent:abc123"}')
TrustFilteredRetriever -- trust-gated RAG
from langchain_agentoath import TrustFilteredRetriever
retriever = TrustFilteredRetriever(
base_retriever=my_vector_store.as_retriever(),
agent=agent,
min_trust_score=0.6,
)
# Only returns documents from agents with trust score >= 0.6
docs = retriever.get_relevant_documents("important query")
Components
| Component | Description |
|---|---|
AgentOathCallbackHandler |
LangChain callback that auto-creates trust receipts for all events |
TrustedChain |
Chain wrapper with pre/post execution receipts |
VerifyAgentTool |
LangChain tool to verify agent identity and trust score |
SignReceiptTool |
LangChain tool to sign trust receipts |
CheckTrustTool |
LangChain tool to check trust before delegation |
TrustFilteredRetriever |
Retriever that filters documents by agent trust score |
License
Apache-2.0
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 langchain_agentoath-0.1.0.tar.gz.
File metadata
- Download URL: langchain_agentoath-0.1.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9afc52e0f93a2ba118e39f061609d5913e6161b68768367f7f3126dd20267323
|
|
| MD5 |
926b70a36dc85ace2d8ba10c3125eea8
|
|
| BLAKE2b-256 |
a1a0b788d4a54eed6330096592444e962fcf2305363f3aba9ab79d38156aa379
|
File details
Details for the file langchain_agentoath-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_agentoath-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbec04bd1cd6c92c87ce32acc0baa4d7c9547fd09483710731c49f9de7b849ba
|
|
| MD5 |
1b639abb60f73859cf1abec4b721e271
|
|
| BLAKE2b-256 |
405b47f9a9f6bed35e28f97d75968846a0e67287b7cd17d3744d4f64387ac4da
|