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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lodestar_langgraph-0.3.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lodestar_langgraph-0.3.0.tar.gz
Algorithm Hash digest
SHA256 feda59076787fffd7137b119288bfcc595760a298fa6f4c687647b48670d16ae
MD5 160d41023dea712cf1e4a4d5badb336b
BLAKE2b-256 c8e776f948ce23625957793f39fed2c9f5defea1a97914dd05df20ae2eacb9f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lodestar_langgraph-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for lodestar_langgraph-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4adaff95dc36f604601b65048a39f5cdb2f85a1eadb2cadcecd6403885649968
MD5 048bae280652543028ea86f703b03c08
BLAKE2b-256 c047d5ef210de48d3204c9b02889831441afedce7563f368b1cdb99cd9f1cabf

See more details on using hashes here.

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