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.
Key handling: Your signing key is a 32-byte Ed25519 seed. Store it as an environment variable, never hardcode it. Generate one with kredo identity create or any Ed25519 library.
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. Read-only tools are safe for autonomous LLM use. The submit tool requires human approval by default.
from langchain_kredo import KredoCheckTrustTool, KredoSearchAttestationsTool
# Safe for LLM agents — read-only
tools = [
KredoCheckTrustTool(client=client),
KredoSearchAttestationsTool(client=client),
]
| Tool | Name | LLM-Safe | Purpose |
|---|---|---|---|
KredoCheckTrustTool |
kredo_check_trust |
Yes | Check agent reputation + skills + warnings |
KredoSearchAttestationsTool |
kredo_search_attestations |
Yes | Find agents by skill/domain/proficiency |
KredoSubmitAttestationTool |
kredo_submit_attestation |
No | Sign and submit skill attestation |
KredoGetTaxonomyTool |
kredo_get_taxonomy |
Yes | Browse valid domains/skills |
Warning: KredoSubmitAttestationTool signs and submits irreversible cryptographic claims. By default it returns a preview for human approval. Only set require_human_approval=False if your pipeline has an explicit confirmation mechanism.
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 # 86 tests
License
MIT
Metadata
Release files for langchain-kredo 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_kredo-0.3.3.tar.gz | 19.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_kredo-0.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.6 kB
Release files / langchain_kredo-0.3.3.tar.gz
| Download URL | langchain_kredo-0.3.3.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe08e720dec42f3794bbd79fba14f719e130f3fdae767ddf96eacf8e5e71ef1c
|
|
BLAKE2b-256 checksum How to use checksums |
ff725224ae8cf3711f6e29a0ec175f836cd72ae3c3ae94bb8b59cc1ab1e4b509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / langchain_kredo-0.3.3-py3-none-any.whl
| Download URL | langchain_kredo-0.3.3-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36df1b0efaac91a57b79796a9980bf030d2d28e7225f5ee7ad592036a2f67b62
|
|
BLAKE2b-256 checksum How to use checksums |
67094b81aaa6cd42f06a402a500d7c65bba3a6f62e0c39bfe072362e365d3942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|