Skip to main content

watchlight-langgraph

Governance primitives for LangGraph agents with Watchlight: authorize the actions you gate, validate plans, and spawn attenuated sub-agents.

pip install watchlight-langgraph

Independent third-party plugin. This is an independent integration built by Watchlight AI. It is not affiliated with, endorsed by, or sponsored by LangChain. LangGraph and related names are trademarks of LangChain, used here nominatively only to describe compatibility.

What it does

watchlight-langgraph gives you explicit governance primitives that you call from your LangGraph nodes. LangGraph is extended by graph composition, so the plugin does not intercept your tools or model calls by itself: an action is governed only when your code routes it through one of the calls below. The policy decisions run on Watchlight's compiled engine, either in-process for local development or against the governed control plane in production.

What is enforced, and where:

  • handle.authorize_action(...) and handle.authorize_action_detailed(...) ask for a decision before an action. A Deny returns False (or a Deny result). If the backend cannot be reached, the call raises, so the action does not run as long as you do not catch and ignore that exception.
  • governed_tool_call(handle, tool_name, ...) (in watchlight_langgraph.governance) wraps a tool implementation: it runs the tool only on Allow, raises ToolDenied on Deny, and pauses the graph with LangGraph interrupt when a human approval is needed.
  • handle.submit_plan(...) and handle.preflight_step(...) validate a plan or a step and return Allow, Modify or Deny. Your code must act on the result.
  • handle.spawn_subagent(...) asks the backend for an attenuated child run. A refused spawn raises, and the child gets its own credential and scope.
  • plugin.start_run(...) refuses to start (raises AgentNotRegistered or GovernanceUnavailable) when the agent is not registered, the backend does not accept the session, or a wl-proxy URL is configured but governed egress cannot be set up.

What is not enforced:

  • The callback handlers (WatchlightCallbackHandler, WatchlightAsyncCallbackHandler, handle.callback_handler()) only observe. They record tool, model and chain events for lineage and never block a call.
  • A tool or model call that your graph makes without going through authorize_action or governed_tool_call is observed by the callbacks but not authorized.

Quickstart

Point the plugin at a backend and wrap your run. Your agent code doesn't change — only the backend does.

For local development, the zero-infrastructure Developer Edition runs the compiled engine in-process (requires the watchlight-engine package):

pip install watchlight-langgraph "watchlight-engine>=0.2.4,<0.3"
from watchlight_langgraph import WatchlightLangGraphPlugin
from watchlight_core import InProcessClient

# A Cedar policy: an agent may read, nothing else.
# The principal is the agent's id, Agent::"<agent uuid>", never its slug, so
# `principal is Agent` is the rule that matches on every backend.
POLICIES = [
    {"name": "reader",
     "code": 'permit(principal is Agent, action == Action::"read", resource);'},
]

plugin = WatchlightLangGraphPlugin()
plugin.apdp = InProcessClient(POLICIES)   # decisions run in-process, no server, no network

async def run_agent(question: str):
    async with await plugin.start_run(agent_slug="research-agent") as handle:
        # Validate a multi-step plan ahead of execution (Allow / Modify / Deny).
        result = await handle.submit_plan(["read dataset", "summarize"])
        if result.is_deny():
            raise PermissionError(f"Plan denied: {result.violations}")

        # Gate each action authoritatively. Returns True on Allow, False on Deny.
        if not await handle.authorize_action("read", "dataset"):
            raise PermissionError("Denied by policy")

        # ... your LangGraph agent runs, every action governed ...

authorize_action returns False on a denial and raises when the backend cannot be reached. Either way the guarded action does not run, as long as your code does not swallow the exception.

Attributing runs to an AI application

Every governed run can be attributed to the AI application the agent belongs to. Pass application_id="<application UUID>" to WatchlightLangGraphPlugin(...), or per run to start_run(...), or set WATCHLIGHT_APPLICATION_ID in the environment — an explicit argument wins over the env var. The id is sent on session create and bound to the run credential and to every sub-agent the run spawns; wl-apdp refuses the session if the agent is not a member of that application. An agent in exactly one application needs nothing here. The id is explicit configuration, never inferred from prompts or names, and it is an Enterprise feature: the in-process Developer Edition engine refuses it.

Two backends, same code

Backend Runs
Developer Edition InProcessClient The compiled engine, in-process — no server, no network
Enterprise ApdpClient The governed control plane: signed lineage, drift detection, fleet-wide governance

Moving from local to production is a one-line change:

from watchlight_core import ApdpClient, Credential

plugin = WatchlightLangGraphPlugin()
# The plugin credential comes from your secret store or the environment
# (WATCHLIGHT_PLUGIN_TOKEN), never from source code.
plugin.apdp = ApdpClient(
    "https://apdp.your-company.example",
    credential=Credential.from_default(),
)

License

Apache-2.0

Metadata

Release files for watchlight-langgraph 0.5.1

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

Source distribution (sdist)

Source distribution for watchlight-langgraph 0.5.1
File Size Uploaded Provenance Actions
watchlight_langgraph-0.5.1.tar.gz 95.6 kB With provenance Details for watchlight_langgraph-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for watchlight-langgraph 0.5.1
File Interpreter ABI Platform Actions
watchlight_langgraph-0.5.1-py3-none-any.whl Python 3 none any Details for watchlight_langgraph-0.5.1-py3-none-any.whl

Total release size: 151.7 kB

Release files / watchlight_langgraph-0.5.1.tar.gz

Download URL watchlight_langgraph-0.5.1.tar.gz
Size 95.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e6967b8d1430f05d54c3f9cbdee4a48e210bb36ae23bdd9ae30db515790ae518
BLAKE2b-256 checksum
How to use checksums
349bffb3a39a80edf5de3a1149bbd717de38adb960aa44f857c2d60c5747dc12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 25, 2026.

Transparency log

Release files / watchlight_langgraph-0.5.1-py3-none-any.whl

Download URL watchlight_langgraph-0.5.1-py3-none-any.whl
Size 56.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ceaa3b5d1e8c63b1cb4063fb649ff10bd47abd4a9dd43843c11762f1f63f95e
BLAKE2b-256 checksum
How to use checksums
780922c2033e4cd726326f1af15b215df0d54c4074431d9aa545904945db1508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 25, 2026.

Transparency log

Security for watchlight-langgraph 0.5.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for watchlight_langgraph-0.5.1.tar.gz

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 Oct 25, 2026.

Transparency log

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