Skip to main content

Govern a LangGraph agent's native tool calls with Lodestar — the thin native hook that remotes each tool call through the Lodestar Action Kernel over NDJSON-RPC (ADR-0024).

Project description

lodestar-langgraph

Govern a LangGraph agent's native tool calls with Lodestar — the open epistemic-governance framework for AI agents.

LangGraph runs tools natively in-process and does not speak MCP, so the MCP proxy cannot wrap it. This package is the thin native hook (ADR-0024): it spawns the TypeScript governance-gate sidecar (lodestar runtime gate) and remotes each native tool call through the Lodestar Action Kernel over newline-delimited JSON-RPC. The same machinery the MCP proxy runs — two-phase propose → arbitrate → execute, the signed policy gate, cognitive-core ingestion (external-document content can't auto-promote), sentinel arbitration, and the signed-approval L4 hold path — now applies to LangGraph, with no change to the engine.

The tool body runs only inside the gate's execute phase, reached only after the gate (and any approval hold) clears: "tools that do work before approval are bugs" — across the Python↔TS boundary.

Install

pip install "lodestar-langgraph[langgraph]"
# and the Lodestar CLI (Bun/npm), which provides `lodestar runtime gate`:
npm install -g @qmilab/lodestar-cli   # or: bun add -g @qmilab/lodestar-cli

Use

from langgraph.prebuilt import ToolNode
from lodestar_langgraph import GateClient, govern_tools, governed_call

with GateClient("runtime-gate.config.json") as gate:
    governed = govern_tools(gate, my_tools)      # register + wrap the toolset
    llm = llm.bind_tools(governed)               # the model only sees governed tools
    tool_node = ToolNode(governed)               # and so does the executor
    # ... build and run your graph as usual; every tool call is now governed.

    # A custom node invokes a governed tool through the helper, never raw:
    result = governed_call(gate, "search_web", {"q": "lodestar"})

The gate's config (runtime-gate.config.json) is a RuntimeGateConfig — the signed policy document, approver keys, sentinel ids, persistence, and durable log root all live there. The hook never holds credentials or policy.

Scope (honest, ADR-0004 lineage)

This is governance over declared actions, not OS containment of the process. Raw I/O performed outside the tool abstraction — a custom node that calls requests.get() directly instead of a registered tool — is outside the governed surface, exactly as guard.wrap() and the MCP proxy only govern the tools they are given. A call for an unregistered tool is denied (fail closed). Pair the adapter with network/filesystem controls for defense in depth.

Holds

An L4 action the trust-ladder floor parks for approval is resolved by block-polling the gate up to the deadline for a signed approval (hold_wait_ms) — the headless default. For the idiomatic LangGraph interrupt() integration, call gate.govern(...) directly, raise interrupt with the returned action_id / request_id, and call gate.resume(...) on Command(resume=…).

Apache-2.0. Part of the Lodestar monorepo (runtimes/langgraph/).

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

lodestar_langgraph-0.4.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lodestar_langgraph-0.4.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file lodestar_langgraph-0.4.0.tar.gz.

File metadata

  • Download URL: lodestar_langgraph-0.4.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lodestar_langgraph-0.4.0.tar.gz
Algorithm Hash digest
SHA256 956bcf552911208406691a1767f1a6d9cc5714c7fdde3fd4fc94ce337c389b3a
MD5 b1937743a15607d662648edf114ba579
BLAKE2b-256 338dd202c71429038da40ae8d132f45ffeb859ecbb98d5551809f9befb6789ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for lodestar_langgraph-0.4.0.tar.gz:

Publisher: publish-pypi.yml on qmilab/lodestar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lodestar_langgraph-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lodestar_langgraph-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15d8f70d571ce4a1bb13ced1b66bbfcdf1b98a1391fd4c74f00935f367af6c98
MD5 da939fb374d4ab6914868415e5531b31
BLAKE2b-256 512d8460fc089989b864136ddfcf0283a7b9d9e15839e796434c1c58d557cc56

See more details on using hashes here.

Provenance

The following attestation bundles were made for lodestar_langgraph-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on qmilab/lodestar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page