Skip to main content
The Sakshi SDK is how a Python agent talks to the governance layer. It carries no provider dependencies and never sends a raw identifier: everything you pass is tokenized at ingest, before it is stored or hashed. Sakshi runs single-tenant in your environment, so the base_url in these examples is your own deployment.
The distribution is sakshi-sdk; the import is sakshi. Install the latest version from PyPI. Python 3.9 or newer.

Hello, witness

Six lines: create the client, register the agent (idempotent by name), and witness one decision. The record is written to the chain when the with block exits.

Two ways to integrate

Both land on the same chain. Pick per agent, or mix them in one process.

Explicit witness and enforce

Open a witness session and record the steps as they happen, and route consequential actions through enforce before they run. Full control over what evidence a decision carries. This is the reference API on the Python SDK page.

One-line middlewares

Wrap the client you already use (OpenAI-compatible, Anthropic, Gemini, Bedrock, LangGraph) with a single call. Every model call is recorded on the active witness session, with the served model identity auto-filled. See Integrations.

Capture is fail-open, enforcement is fail-closed

The two operations have opposite failure modes on purpose.

witness: fail-open

Decision capture buffers on a background worker. If the platform is unreachable, your agent keeps running and records are dropped with a warning. Governance infrastructure must never take production down. Pass fail_open=False for synchronous capture that raises, for batch jobs where losing evidence is worse than stopping.

enforce: fail-closed

Routing an action through its autonomy envelope fails closed. If Sakshi cannot be reached, enforce raises rather than letting an ungoverned action through. An ungoverned action is worse than a delayed one.
Enforcement is never auto-retried and capture is buffered, so the two paths behave differently under load and outage. The Python SDK page documents the exact delivery semantics.

Where to go next

Python SDK reference

Every client method, the witness session, the enforcement outcomes, and the exception model.

Middlewares

Add governance to an existing OpenAI, Anthropic, Gemini, Bedrock, or LangGraph agent with one line.

MCP governance

Govern any agent that speaks the Model Context Protocol, as an MCP server or a transparent proxy.

Try it against the demo

Point base_url at https://demo.rotavision.com to run these examples against a live, synthetic-data instance.