LangChain integration for the Kredo agent attestation protocol
Project description
langchain-kredo
LangChain integration for the Kredo agent attestation protocol.
One line of code. Signed attestation. Done.
Install
pip install langchain-kredo
One-Liner
from langchain_kredo import attest
# That's it. Resolves name, looks up skill, signs, submits.
attest("jim", "incident-triage", "Triaged 3 incidents correctly in SOC exercise")
# With a URL — auto-detected as evidence artifact
attest("jim", "code-review", "https://github.com/org/repo/pull/47")
# With explicit proficiency (1-5, default 3)
attest("jim", "threat-hunting", "Found lateral movement in 4 minutes", proficiency=5)
Set KREDO_PRIVATE_KEY env var (hex seed) and go. Subject resolved by name or pubkey. Skill resolved by reverse taxonomy lookup — just say "incident-triage", it finds the domain.
Trust Gate
Policy enforcement for agent pipelines:
from langchain_kredo import KredoSigningClient, KredoTrustGate
client = KredoSigningClient(signing_key="your-hex-seed")
gate = KredoTrustGate(client, min_score=0.3, block_warned=True)
# Check trust
result = gate.check("ed25519:agent-pubkey")
# result.passed, result.score, result.skills, result.attestor_count
# Select best agent for a task (ranks by reputation + diversity + domain proficiency)
best = gate.select_best(candidates, domain="security-operations", skill="incident-triage")
# Build-vs-buy: delegate or self-compute?
delegate = gate.should_delegate(candidates, domain="code-generation", self_proficiency=2)
# Decorator
@gate.require(min_score=0.7)
def sensitive_operation(pubkey: str):
...
LangChain Tools
Four tools for agent toolboxes:
from langchain_kredo import KredoCheckTrustTool, KredoSearchAttestationsTool
tools = [
KredoCheckTrustTool(client=client),
KredoSearchAttestationsTool(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 |
Callback Handler
Tracks chain execution, builds attestation evidence automatically:
from langchain_kredo import KredoCallbackHandler
handler = KredoCallbackHandler()
chain.invoke(input, config={"callbacks": [handler]})
for record in handler.get_records():
if record.success_rate >= 0.9:
client.attest_skill(
subject_pubkey="ed25519:...",
domain="security-operations",
skill="incident-triage",
proficiency=3,
context=record.build_evidence_context(),
artifacts=record.build_artifacts(),
)
Collects evidence but never auto-submits. You decide when and what to attest.
Client
Full signing-aware client for when you need more control:
client = KredoSigningClient(
signing_key=sk, # SigningKey, bytes, hex string, or env var
name="my-agent",
agent_type="agent",
)
# Read
profile = client.get_profile("ed25519:...")
my_profile = client.my_profile() # your own profile
results = client.search(domain="security-operations")
# Write
client.register()
client.attest_skill(
subject_pubkey="ed25519:...",
domain="security-operations",
skill="incident-triage",
proficiency=4,
context="Demonstrated expert-level triage in SOC exercise",
)
Development
cd langchain-kredo
pip install -e ".[dev]"
pytest tests/ -v # 82 tests
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.2.0.tar.gz.
File metadata
- Download URL: langchain_kredo-0.2.0.tar.gz
- Upload date:
- Size: 17.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 |
bd4b70fa8106d5989496c88e7275c5bae8059738121a16fd2efc684a1747fccf
|
|
| MD5 |
78cc384c49b6d0bb30bcb99751d42808
|
|
| BLAKE2b-256 |
bab1a39584fe43f5165ffe88b3d74379c144d43651f83f62285bf3a899c10b59
|
File details
Details for the file langchain_kredo-0.2.0-py3-none-any.whl.
File metadata
- Download URL: langchain_kredo-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.5 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 |
d90fa666f4f3d03395c0cdd2be9abc16ebbc38632000b986c13aed232c797d4b
|
|
| MD5 |
04cdc20fa59e6fc951109d85d0f38dd8
|
|
| BLAKE2b-256 |
e31c39e77f2505250fb05130d4657818143470c7653aeeb90c2b3d5c7fe979e4
|