Skip to main content

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's TrustLayer; this package only translates framework events. (Verify it: GraduationEngine appears only in the display-only progress helper, and no Decision/Verdict is 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. InMemoryApprovalHistory resets 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

Metadata

Release files for warrantd-langgraph 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for warrantd-langgraph 0.1.0
File Size Uploaded
warrantd_langgraph-0.1.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for warrantd-langgraph 0.1.0
File Interpreter ABI Platform
warrantd_langgraph-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / warrantd_langgraph-0.1.0.tar.gz

Download URL warrantd_langgraph-0.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d196391f3a2689561ff8eca1645fdc3d27d4fc202709ce0a69f95de4a0d42fab
BLAKE2b-256 checksum
How to use checksums
2f317747b0835cfa4ef01cfa0a23a06d81ae83c862631f823504a0a736560582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release files / warrantd_langgraph-0.1.0-py3-none-any.whl

Download URL warrantd_langgraph-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6eeb79e95c41e2914023d423764221eda2c00ea8f42a224a97ff097a637e1f7d
BLAKE2b-256 checksum
How to use checksums
17add1a90b13185389ccaaf69b2cf948f5c05cb8de3f90d7556bd05360c829c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page