Skip to main content
A witnessed decision is the unit of governance. Each record captures the model that decided, the steps it took, the tools it called, and the action it produced, and each record is hashed onto a chain with the one before it. Anyone can recompute the chain and prove nothing was altered after the fact. This guide witnesses one decision and then verifies it independently. It assumes a registered agent and an initialized client.
1

Open a witness session

witness returns a session used as a context manager. Pass the model identity, any context, and a client reference you can trace back to your own system. Identifiers in context are tokenized at ingest, so raw PII never reaches the chain.
The applicant_aadhaar value above is tokenized before storage or hashing. Sakshi governs the decision, it never becomes the system of record for the identifier. See PII tokenization.
2

Record the reasoning as it happens

Inside the block, record the steps in order. Each method appends to the same decision. Capture is fail-open: a recording problem is logged and dropped, it never breaks the host agent.
An exception raised inside the block is captured as the outcome and re-raised. Failures are evidence too.
3

Let the block close

The record is assembled and written to the chain when the with block exits, not on each call. In the default fail-open mode the write is buffered on a background worker; pass fail_open=False to SakshiClient for synchronous, raising capture where losing evidence is worse than stopping.
If you drive your LLM through a middleware, each model call auto-attaches an llm_call step and fills in the model identity from the provider response. You get the same chain without hand-instrumenting every call.
4

Verify the chain

Recompute the chain and confirm no record was tampered with. This needs no trust in Rotavision: anyone with read access can run it.
Alter a single field in any record and valid becomes false, with first_invalid_seq pointing at exactly where the recomputation diverged.

Next steps

The decision chain

How records are hashed together and why recomputation is the proof.

Bound autonomy

Decide whether an action may run before it does, not just record it after.

Add it with one line

Wrap an OpenAI, Anthropic, Gemini, Bedrock, or LangGraph agent.

Python SDK

The witness session and every method it exposes.