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.5.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.5.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lodestar_langgraph-0.5.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.5.0.tar.gz
Algorithm Hash digest
SHA256 a35f1a667e5dc893e906e5187e5a1ac7fcf840e0287e20d957d223be40517c4c
MD5 25f42070a5dd0eaad3e5a80007bc6b9b
BLAKE2b-256 86a3cced14c7fb0d1ec11362edbfd7c3e31eec33139ce1aee9b74e628476ef4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lodestar_langgraph-0.5.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.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lodestar_langgraph-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 becbe4e69253996e69f46530689aa755d187582e879768f284f9fd4c4b1858de
MD5 16fea12d9461c9411c69d42a50e46cb9
BLAKE2b-256 8fe3bd6b91dce5a99aefc6f295605b033d6c7e7dfa343dc6d898a5d5604739f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for lodestar_langgraph-0.5.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