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.
LangGraphand 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(...)andhandle.authorize_action_detailed(...)ask for a decision before an action. A Deny returnsFalse(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, ...)(inwatchlight_langgraph.governance) wraps a tool implementation: it runs the tool only on Allow, raisesToolDeniedon Deny, and pauses the graph with LangGraphinterruptwhen a human approval is needed.handle.submit_plan(...)andhandle.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 (raisesAgentNotRegisteredorGovernanceUnavailable) 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_actionorgoverned_tool_callis 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
from watchlight_langgraph import WatchlightLangGraphPlugin
from watchlight_core import InProcessClient
# A Cedar policy: the research agent may read, nothing else.
POLICIES = [
{"name": "reader",
"code": 'permit(principal == Agent::"research-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(),
)
Links
- Documentation: https://docs.watchlight.ai/de
- Website: https://watchlight.ai
License
Apache-2.0
Metadata
Release files for watchlight-langgraph 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| watchlight_langgraph-0.4.2.tar.gz | 94.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| watchlight_langgraph-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 150.1 kB
Release files / watchlight_langgraph-0.4.2.tar.gz
| Download URL | watchlight_langgraph-0.4.2.tar.gz |
|---|---|
| Size | 94.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24bff987021234fe6399ec313921eddac4f796effbf09ab7dc857ee8a8434e25
|
|
BLAKE2b-256 checksum How to use checksums |
1b755ac4fcd7c13b72d960d00c6ae6224bfff91e657a818fec358c5664acf8fb
|
| 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 6, 2026.
Transparency logRelease files / watchlight_langgraph-0.4.2-py3-none-any.whl
| Download URL | watchlight_langgraph-0.4.2-py3-none-any.whl |
|---|---|
| Size | 55.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
924d2e0515e663c23f2c826601b5a09280e61370118736e10f843107b2b62ba8
|
|
BLAKE2b-256 checksum How to use checksums |
8b79b31dee193e1937cf8ec15bfe96938999fa985f118df60d52426e052cae94
|
| 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 6, 2026.
Transparency log