LangChain integration for the Kredo agent attestation protocol
Project description
langchain-kredo
LangChain integration for the Kredo agent attestation protocol.
Check agent trust, search attestations, enforce policy, and create signed attestations — all from your LangChain pipeline.
Install
pip install langchain-kredo
Quick Start
from langchain_kredo import KredoSigningClient, KredoTrustGate
# Initialize with Ed25519 signing key (hex seed)
client = KredoSigningClient(
signing_key="your-hex-seed",
name="my-pipeline",
agent_type="agent",
)
# Check trust before delegating to an agent
gate = KredoTrustGate(client, min_score=0.3, block_warned=True)
result = gate.check("ed25519:agent-pubkey-here")
if result.passed:
print(f"Agent trusted (score: {result.score})")
Components
KredoSigningClient
Wraps the Kredo Discovery API with Ed25519 signing. Read operations query api.aikredo.com. Write operations build Pydantic models, sign with your key, and submit.
client = KredoSigningClient(
signing_key=sk, # SigningKey, bytes, hex string, or env var
name="my-agent",
agent_type="agent", # "agent" or "human"
)
# Read
profile = client.get_profile("ed25519:...")
results = client.search(domain="security", min_proficiency=3)
taxonomy = client.get_taxonomy()
# Write (requires signing key)
client.register()
client.attest_skill(
subject_pubkey="ed25519:...",
domain="security",
skill="vulnerability_assessment",
proficiency=4,
context="Demonstrated expert-level vuln assessment in CTF",
)
Key resolution order: signing_key param > KREDO_PRIVATE_KEY env var > read-only mode.
LangChain Tools
Four tools for agent pipelines:
from langchain_kredo import (
KredoCheckTrustTool,
KredoSearchAttestationsTool,
KredoSubmitAttestationTool,
KredoGetTaxonomyTool,
)
tools = [
KredoCheckTrustTool(client=client),
KredoSearchAttestationsTool(client=client),
KredoSubmitAttestationTool(client=client),
KredoGetTaxonomyTool(client=client),
]
| Tool | Name | Purpose |
|---|---|---|
KredoCheckTrustTool |
kredo_check_trust |
Check agent reputation + skills + warnings |
KredoSearchAttestationsTool |
kredo_search_attestations |
Find agents by skill/domain/proficiency |
KredoSubmitAttestationTool |
kredo_submit_attestation |
Sign and submit skill attestation |
KredoGetTaxonomyTool |
kredo_get_taxonomy |
Browse valid domains/skills |
KredoCallbackHandler
Tracks chain execution and builds attestation evidence:
from langchain_kredo import KredoCallbackHandler
handler = KredoCallbackHandler()
chain.invoke(input, config={"callbacks": [handler]})
for record in handler.get_records():
print(record.build_evidence_context())
# Chain abc-123
# Duration: 1500ms
# Tools used: 3
# Success rate: 100%
# ...
# Use evidence in an attestation
client.attest_skill(
subject_pubkey="ed25519:...",
domain="security",
skill="incident_response",
proficiency=3,
context=record.build_evidence_context(),
artifacts=record.build_artifacts(),
)
The handler never submits automatically. You decide when and what to attest.
KredoTrustGate
Policy enforcement for agent selection:
from langchain_kredo import KredoTrustGate
gate = KredoTrustGate(client, min_score=0.3, block_warned=True)
# Non-throwing check
result = gate.check("ed25519:...")
if result.passed:
...
# Throwing enforcement
result = gate.enforce("ed25519:...") # raises InsufficientTrustError
# Decorator
@gate.require(min_score=0.7)
def sensitive_operation(pubkey: str):
...
# Select best candidate
best = gate.select_best(
["ed25519:agent-a", "ed25519:agent-b"],
domain="security",
)
Design Decisions
- No auto-attestation — The callback handler collects evidence but never submits. Attestations are cryptographic claims with reputation consequences.
attest_warningnot a tool — Behavioral warnings are too serious for LLM autonomy. Available on the client but not exposed as a LangChain tool.- No local store — SDK uses the Discovery API only. LangChain developers query
api.aikredo.com, not a local database. - Sync with async passthrough — Kredo uses stdlib urllib (sync). Async tool methods delegate to sync. Acceptable for v0.1.
Development
cd langchain-kredo
pip install -e ".[dev]"
pytest tests/ -v
License
MIT
Project details
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_kredo-0.1.0.tar.gz.
File metadata
- Download URL: langchain_kredo-0.1.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bffdd75a10e705b3e768a3827085268d1bd1821d428a3f08022466c2d856490
|
|
| MD5 |
68f22a3563402d132a4714371a271159
|
|
| BLAKE2b-256 |
b2026d3d8fc007758d47825065086b1d9e4143c44112253a7f6bd79000fcdd46
|
File details
Details for the file langchain_kredo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_kredo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d349b9785e5d40337c12742e3d5658060bd9dc4b8a93d4bdd4b3c14ddc00adff
|
|
| MD5 |
de07f7541775da96ab29caebae314203
|
|
| BLAKE2b-256 |
4fbb7aecb5576573bbd6b0609de7bcabf030e523c1a897134730fdb860c8a65f
|