watchlight-agent-sdk
Build governed AI agents. The Watchlight Agent SDK lets you put a real, fail-closed authorization decision in front of every action your agent takes — and record what happened — with the same code whether you run it on your laptop or across a production fleet.
pip install watchlight-agent-sdk
Import it as watchlight_core.
What it does
Your agent asks "may I do this?" before it acts; Watchlight answers Allow or
Deny by evaluating your policies, and the action only runs if it's permitted.
The SDK gives you:
- Authorization —
authorize_action(action, resource)gates every step, fail-closed. - Preflight — a cheap read-only "would this be allowed?" check.
- Lifecycle — a
RunHandleper agent run: submit a plan, authorize steps, complete or terminate. - Lineage — canonical, value-free execution events for audit and debugging.
- Framework plugins — ready-made integrations for LangGraph, Google ADK, AWS Bedrock, Microsoft Agent Framework, Pydantic AI, and more.
The SDK is glue: it shapes a request, hands it to a Watchlight backend, and projects the answer. Every decision is made by the backend — never in this package — which is why it's open source (Apache-2.0).
Two backends, same code
The SDK talks to a backend through one small interface, so the exact same agent and plugin code runs against either:
| 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 one to the other is a one-line change, never a rewrite.
Quickstart — a governed decision, zero infrastructure
Install the in-process engine alongside the SDK:
pip install watchlight-agent-sdk watchlight-engine
import asyncio
from watchlight_core import InProcessClient
# A Cedar policy: the research agent may read, nothing else.
POLICIES = [
{"name": "reader",
"code": 'permit(principal == User::"research-agent", action == Action::"read", resource);'},
]
async def main():
gov = InProcessClient(POLICIES) # decisions run in-process; lineage → .watchlight/audit.jsonl
print((await gov.authorize("research-agent", "read", "dataset"))["decision"]) # Allow
print((await gov.authorize("research-agent", "delete", "dataset"))["decision"]) # Deny
asyncio.run(main())
Allow
Deny
That Deny is the point: the action is refused before it runs — by the same
engine that powers the Watchlight platform, with no database and no network.
Govern a framework agent
Install the plugin for your framework and point it at a backend — your agent code doesn't change:
from watchlight_langgraph import WatchlightLangGraphPlugin # or -adk, -bedrock, -pydantic-ai, …
from watchlight_core import InProcessClient
plugin = WatchlightLangGraphPlugin()
plugin.apdp = InProcessClient(POLICIES) # the one line that differs from production
async with await plugin.start_run("research-agent") as handle:
if not await handle.authorize_action("read", "dataset"):
raise PermissionError("denied by policy")
# ... your agent runs, every action governed ...
Custom agents (any framework)
For an agent not built on a supported framework, the @watchlight decorator
governs any function:
from watchlight_core import InProcessClient, watchlight
gov = InProcessClient(POLICIES)
@watchlight(agent_id="custom-research", client=gov)
async def run_research(query: str) -> str:
...
Optional: OpenTelemetry export
Install the [otlp] extra to export a subset of the lineage stream to your OTel
collector (off by default):
pip install 'watchlight-agent-sdk[otlp]'
Learn more
- Documentation: https://docs.watchlight.ai
- Developer Edition (zero-infra quickstart) and Enterprise (the governed control plane): https://watchlight.ai
License
Apache-2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watchlight_agent_sdk-0.5.1.tar.gz.
File metadata
- Download URL: watchlight_agent_sdk-0.5.1.tar.gz
- Upload date:
- Size: 318.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a24abbe4fa27ece1daa9fe479fe70ac3d704244ede7b4f08311a19082a29129
|
|
| MD5 |
c273568654c803e422f539778c4ab11f
|
|
| BLAKE2b-256 |
8c9dd7759f2ad8189db4a33cb15b802ee9bf000307c87fc6558accfc448d23bd
|
Provenance
The following attestation bundles were made for watchlight_agent_sdk-0.5.1.tar.gz:
Publisher:
publish-python-sdk-plugins.yml on watchlight-ai-beacon/watchlight-beacon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
watchlight_agent_sdk-0.5.1.tar.gz -
Subject digest:
1a24abbe4fa27ece1daa9fe479fe70ac3d704244ede7b4f08311a19082a29129 - Sigstore transparency entry: 2504800152
- Sigstore integration time:
-
Permalink:
watchlight-ai-beacon/watchlight-beacon@5c33e27cf8cb0a2a4933758427725e9f2b977177 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/watchlight-ai-beacon
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk-plugins.yml@5c33e27cf8cb0a2a4933758427725e9f2b977177 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file watchlight_agent_sdk-0.5.1-py3-none-any.whl.
File metadata
- Download URL: watchlight_agent_sdk-0.5.1-py3-none-any.whl
- Upload date:
- Size: 199.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9455bb9315f612739b6af21b8302a17adb63f9d04c351501f9b4a32604949db
|
|
| MD5 |
37d95b2f145d08374fe10b0791a9e1dc
|
|
| BLAKE2b-256 |
648fb729e0a5d76fb754b8a35d53a96d4a507b5327814f4ae927fa2c361d67d7
|
Provenance
The following attestation bundles were made for watchlight_agent_sdk-0.5.1-py3-none-any.whl:
Publisher:
publish-python-sdk-plugins.yml on watchlight-ai-beacon/watchlight-beacon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
watchlight_agent_sdk-0.5.1-py3-none-any.whl -
Subject digest:
c9455bb9315f612739b6af21b8302a17adb63f9d04c351501f9b4a32604949db - Sigstore transparency entry: 2504800251
- Sigstore integration time:
-
Permalink:
watchlight-ai-beacon/watchlight-beacon@5c33e27cf8cb0a2a4933758427725e9f2b977177 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/watchlight-ai-beacon
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk-plugins.yml@5c33e27cf8cb0a2a4933758427725e9f2b977177 -
Trigger Event:
workflow_dispatch
-
Statement type: