Earned autonomy for LangGraph — evaluate, interrupt, approve, resume.
Project description
warrantd-langgraph
Splice earned autonomy into LangGraph's interrupt/HITL loop — evaluate, approve, resume.
LangGraph already ships the human-in-the-loop machinery: interrupt() pauses
a graph, Command(resume=...) continues it. What it doesn't ship is a policy
for when to interrupt — that's usually a hardcoded list of tool names.
This adapter makes it dynamic: earned autonomy from warrantd. A tool starts at MANUAL (every call interrupts for a human), earns SUPERVISED through clean approvals (runs uninterrupted within a value cap), and is bounded by ceilings no metric can move.
pip install warrantd-langgraph
Quickstart
from decimal import Decimal
from langgraph.checkpoint.memory import MemorySaver
from langgraph.prebuilt import create_react_agent
from langgraph.types import Command
from warrantd import (
ActionClass, ApprovalHistorySignal, AutonomyState, GraduationThresholds,
InMemoryApprovalHistory, RiskTier, TrustLayer, TrustPolicy,
)
from warrantd_langgraph import ToolBinding, guard_tools
policy = TrustPolicy(
actions={"issue_refund": ActionClass(
name="issue_refund", risk=RiskTier.REVERSIBLE_WRITE,
auto_cap=Decimal("100"), hard_cap=Decimal("1000"),
max_state=AutonomyState.SUPERVISED,
)},
thresholds=GraduationThresholds(
pass_rate={AutonomyState.SUPERVISED: 1.0, AutonomyState.AUTONOMOUS: 1.0},
adversarial_pass_rate={AutonomyState.SUPERVISED: 0.0, AutonomyState.AUTONOMOUS: 0.9},
min_samples={AutonomyState.SUPERVISED: 5, AutonomyState.AUTONOMOUS: 1000},
),
)
evidence = InMemoryApprovalHistory()
trust = TrustLayer(policy, audit=my_audit_sink,
signals=[ApprovalHistorySignal(evidence, window=10)])
agent = create_react_agent(
model,
guard_tools([issue_refund], trust=trust, policy=policy, evidence=evidence,
bindings={"issue_refund": ToolBinding(value_param="amount")}),
checkpointer=MemorySaver(), # interrupts need a checkpointer
)
config = {"configurable": {"thread_id": "t1"}}
result = agent.invoke({"messages": [("user", "refund INV-1 by $50")]}, config)
for intr in result.get("__interrupt__", []): # REQUIRE_APPROVAL: paused
print(intr.value["graduation"]["sentence"])
# -> "this class is 4/10 approvals from SUPERVISED — your decision
# feeds its trust record"
result = agent.invoke(
Command(resume={intr.id: {"approved": True, "approver": "alice"}}),
config,
)
The resume payload is the evidence hook: approved and approver are
recorded into the class's trust record before the tool runs (or is declined —
a human "no" counts too, and the optional comment is surfaced to the model).
After enough clean approvals the same call stops interrupting. A call
above hard_cap never interrupts either: it is blocked outright, with the
reason returned as the tool result so the model can adapt. Ceilings never
move.
What this adapter does NOT do
- No decision logic. Every verdict comes from
warrantd-core'sTrustLayer; this package only translates framework events. (Verify it:GraduationEngineappears only in the display-only progress helper, and noDecision/Verdictis ever constructed here.) - No approval UI. Your interrupt handler is the UI; the interrupt payload carries everything to render (args preview, value, reason, the graduation sentence).
- No MCP gating. For gating MCP servers with zero agent changes, use warrantd-gateway.
- No persistence by default.
InMemoryApprovalHistoryresets on restart. For hash-chained, restart-proof evidence:
pip install "warrantd-langgraph[gateway]"
from warrantd_langgraph.stores import sqlite_store
evidence = sqlite_store(".warrantd/evidence.db") # also usable as audit=
Learn more
- Why earned autonomy:
DESIGN.md— Trust is earned, not configured - Runnable example (no API key needed):
examples/langgraph/earned_autonomy.py - API promises:
STABILITY.md
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 warrantd_langgraph-0.1.0.tar.gz.
File metadata
- Download URL: warrantd_langgraph-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d196391f3a2689561ff8eca1645fdc3d27d4fc202709ce0a69f95de4a0d42fab
|
|
| MD5 |
fb2f25d7be9f25a0cd419a6ae2175fe4
|
|
| BLAKE2b-256 |
2f317747b0835cfa4ef01cfa0a23a06d81ae83c862631f823504a0a736560582
|
Provenance
The following attestation bundles were made for warrantd_langgraph-0.1.0.tar.gz:
Publisher:
release.yml on moritzkazooba-wq/warrantd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warrantd_langgraph-0.1.0.tar.gz -
Subject digest:
d196391f3a2689561ff8eca1645fdc3d27d4fc202709ce0a69f95de4a0d42fab - Sigstore transparency entry: 1797681834
- Sigstore integration time:
-
Permalink:
moritzkazooba-wq/warrantd@c7b082e3d207f7091d0ac9735b9b8e1ccaa21aad -
Branch / Tag:
refs/tags/warrantd-langgraph-v0.1.0 - Owner: https://github.com/moritzkazooba-wq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c7b082e3d207f7091d0ac9735b9b8e1ccaa21aad -
Trigger Event:
release
-
Statement type:
File details
Details for the file warrantd_langgraph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: warrantd_langgraph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eeb79e95c41e2914023d423764221eda2c00ea8f42a224a97ff097a637e1f7d
|
|
| MD5 |
c7e5e33fe52685ae2f7066e4e67b4dc3
|
|
| BLAKE2b-256 |
17add1a90b13185389ccaaf69b2cf948f5c05cb8de3f90d7556bd05360c829c6
|
Provenance
The following attestation bundles were made for warrantd_langgraph-0.1.0-py3-none-any.whl:
Publisher:
release.yml on moritzkazooba-wq/warrantd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
warrantd_langgraph-0.1.0-py3-none-any.whl -
Subject digest:
6eeb79e95c41e2914023d423764221eda2c00ea8f42a224a97ff097a637e1f7d - Sigstore transparency entry: 1797682010
- Sigstore integration time:
-
Permalink:
moritzkazooba-wq/warrantd@c7b082e3d207f7091d0ac9735b9b8e1ccaa21aad -
Branch / Tag:
refs/tags/warrantd-langgraph-v0.1.0 - Owner: https://github.com/moritzkazooba-wq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c7b082e3d207f7091d0ac9735b9b8e1ccaa21aad -
Trigger Event:
release
-
Statement type: