Skip to main content

chap-langgraph

Bridge between LangGraph and the CHAP Coordinator. Wraps the human-in-the-loop interrupt boundary so every review decision becomes a hash-linked, replayable audit entry, without changing the inside of your existing graph nodes.

LangGraph event              CHAP envelope
-----------------            -------------------------
interrupt() called           task.complete + review.request
Command(resume=...) sent     decide.approve | decide.reject | decide.override

The bridge adds three lines to your existing LangGraph node. The override path also turns reviewer edits into JSON Patches automatically, so the audit chain captures what changed and why, not just approved/ rejected.

Install

pip install chap-langgraph

Depends on chap-coordinator>=0.3.4. LangGraph itself is optional: the bridge accepts any dict-shaped state and any opaque decision payload, so it works in environments without LangGraph and is trivial to unit-test.

Quick start

from chap_coordinator import Coordinator
from chap_langgraph import ChapBridge, hil_review

coord = Coordinator(default_profiles=["core/1.0", "review/1.0"])
bridge = ChapBridge(
    coord,
    workspace="wsp_drafter",
    agent="agent:drafter#v1",
    reviewer="human:alice@example.org",
)

# Inside your existing LangGraph node:
def drafter_node(state):
    draft = produce_draft(state)
    chap_state = hil_review(bridge, draft, kind="draft_response")
    return chap_state            # spread into LangGraph state, then interrupt()

# After the interrupt resumes with Command(resume=decision):
def resolve_review(state, decision):
    applied = bridge.apply_decision(state["chap_task_id"], decision)
    return {"draft": applied or state["chap_artefact"], **state}

The decision payload mirrors what a reviewer typically returns:

"approve"                                           # decide.approve
"reject"                                            # decide.reject
{"action": "reject", "rationale": "..."}            # decide.reject (rich)
{"diff": [...], "rationale": "...", "tags": [...]}  # decide.override

What you get in the audit chain

After one hil_review + apply_decision cycle, calling bridge.audit() returns the full chain:

seq=0  workspace.create
seq=1  participant.join     agent:drafter#v1
seq=2  participant.join     human:alice@example.org
seq=3  task.create          kind=draft_response
seq=4  task.complete        agent:drafter#v1
seq=5  review.request       to=human:alice@example.org
seq=6  decide.override      diff=[...] rationale="..." tags=[...]

Every entry carries prev_hash, so you can verify the chain externally or anchor it to a SCITT transparency service with the audit-scitt/1.0 profile.

Examples

See examples/ for runnable end-to-end demos:

  • examples/01-basic-review.py: single drafter node, one human approval.
  • examples/02-override-cycle.py: agent draft, human edits, audit chain.

Compatibility

Tested against:

  • chap-coordinator 0.3.4
  • langgraph 0.2.x (optional)
  • Python 3.10, 3.11, 3.12, 3.13

License

Apache 2.0. See LICENSE.

Metadata

Release files for chap-langgraph 0.3.4

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

Source distribution (sdist)

Source distribution for chap-langgraph 0.3.4
File Size Uploaded Provenance Actions
chap_langgraph-0.3.4.tar.gz 12.6 kB Without provenance Details for chap_langgraph-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chap-langgraph 0.3.4
File Interpreter ABI Platform Actions
chap_langgraph-0.3.4-py3-none-any.whl Python 3 none any Details for chap_langgraph-0.3.4-py3-none-any.whl

Total release size: 24.0 kB

Release files / chap_langgraph-0.3.4.tar.gz

Download URL chap_langgraph-0.3.4.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2ac85b4610da7ee92ecf5fe65b3e8f70e495a0f05bd49c64de7a8b405de25ee0
BLAKE2b-256 checksum
How to use checksums
294eb2910ee23b47fdaf7394153606412741d669cc879f5d01358c3644ecddfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / chap_langgraph-0.3.4-py3-none-any.whl

Download URL chap_langgraph-0.3.4-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e154bdb240eca67baf9da4814a9ac3cfb3d06df6f365f129f042ad46c841d611
BLAKE2b-256 checksum
How to use checksums
ab4736de5f92d778c174d542294b9c470a39a9c1d9320a3bcfb16d77fdb16a81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for chap-langgraph 0.3.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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