watchlight-langgraph 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,78 @@
1
+ """Watchlight LangGraph — Governance plugin for LangGraph plan-and-execute agents.
2
+
3
+ Provides governance primitives — `start_run`, `submit_plan`,
4
+ `preflight_step`, `authorize_action`, `complete` — that the customer
5
+ threads into their LangGraph topology. Unlike the Google ADK plugin
6
+ (register-and-forget callbacks), LangGraph's extensibility is via graph
7
+ composition, so we expose explicit primitives and let the customer wire
8
+ them into the nodes that need governance.
9
+
10
+ Example::
11
+
12
+ from watchlight_langgraph import WatchlightLangGraphPlugin
13
+
14
+ wl = WatchlightLangGraphPlugin(apdp_url="http://localhost:8081")
15
+
16
+ async def run_agent(question: str):
17
+ async with await wl.start_run(agent_slug="research-analyst") as handle:
18
+ state = await graph.ainvoke({"input": question})
19
+ result = await handle.submit_plan(state["plan"])
20
+ if result.is_deny():
21
+ raise PermissionError(f"Plan denied: {result.violations}")
22
+ if result.is_modify():
23
+ state["plan"] = result.modified_plan
24
+ # ... continue execution
25
+
26
+ The plugin populates the same `last_*` attributes as the Google ADK
27
+ plugin (`watchlight_adk`) so a shared governance-card UI widget can
28
+ render both frameworks identically.
29
+ """
30
+
31
+ from watchlight_langgraph.apdp_client import ApdpClient
32
+ from watchlight_langgraph.callbacks import (
33
+ WatchlightAsyncCallbackHandler,
34
+ WatchlightCallbackHandler,
35
+ fresh_execution_id,
36
+ )
37
+ from watchlight_langgraph.plugin import (
38
+ AgentNotRegistered,
39
+ GovernanceUnavailable,
40
+ PlanResult,
41
+ PreflightResult,
42
+ RunHandle,
43
+ WatchlightError,
44
+ WatchlightLangGraphPlugin,
45
+ governance_mode,
46
+ )
47
+ from watchlight_langgraph.state_adapter import state_from_langgraph_plugin
48
+ from watchlight_langgraph.synthetic_tools import (
49
+ build_synthetic_langchain_tools,
50
+ merge_customer_tools_with_synthetic,
51
+ should_skip_authorize_for_tool_call,
52
+ )
53
+ from watchlight_langgraph.traces import (
54
+ translate_langgraph_event,
55
+ translate_langgraph_events,
56
+ )
57
+
58
+ __all__ = [
59
+ "ApdpClient",
60
+ "AgentNotRegistered",
61
+ "GovernanceUnavailable",
62
+ "PlanResult",
63
+ "PreflightResult",
64
+ "RunHandle",
65
+ "WatchlightAsyncCallbackHandler",
66
+ "WatchlightCallbackHandler",
67
+ "WatchlightError",
68
+ "WatchlightLangGraphPlugin",
69
+ "build_synthetic_langchain_tools",
70
+ "fresh_execution_id",
71
+ "governance_mode",
72
+ "merge_customer_tools_with_synthetic",
73
+ "should_skip_authorize_for_tool_call",
74
+ "state_from_langgraph_plugin",
75
+ "translate_langgraph_event",
76
+ "translate_langgraph_events",
77
+ ]
78
+ __version__ = "0.4.0"
@@ -0,0 +1,13 @@
1
+ """Backwards-compatible re-export of :class:`ApdpClient` from
2
+ :mod:`watchlight_core`.
3
+
4
+ Earlier releases shipped a near-identical copy of the client in this
5
+ module. New code should import directly from ``watchlight_core``; this
6
+ shim exists only so existing
7
+ ``from watchlight_langgraph.apdp_client import ApdpClient`` imports
8
+ continue to resolve.
9
+ """
10
+
11
+ from watchlight_core import ApdpClient
12
+
13
+ __all__ = ["ApdpClient"]