Python
Route your Anthropic or OpenAI client through Sentisec, and install the sentisec CLI.
Sentisec speaks the Anthropic and OpenAI wire formats, so the Python integration is a base-URL change on the client you already use. No Sentisec import required.
You need: a Sentisec API key. Mint one in the dashboard under Settings → API keys, or follow the authentication guide.
Route your client through Sentisec
import os
import anthropic
client = anthropic.Anthropic(
base_url="https://api.sentisec.ch/ws/<your-workspace-id>",
api_key=os.environ["SENTISEC_API_KEY"],
)
resp = client.messages.create(
model="claude-sonnet-4",
max_tokens=256,
messages=[{"role": "user", "content": "hello"}],
)
print(resp.content[0].text)Note the /v1 on the OpenAI URL and not on the Anthropic one — the
Anthropic SDK appends its own. Keep the workspace id in the path; see
your base URL.
Every call from client now flows through Sentisec, is scored by the
integrity engine, and appears as a session in your dashboard. Your
upstream provider key stays in your workspace, so it never has to be
present in the process making the call.
The same change works for any library that lets you set a base URL on its underlying client — LangChain, LangGraph, PydanticAI, LlamaIndex, CrewAI. See integrations for the per-framework form.
Handling a blocked tool call
Sentisec does not raise an HTTP error when it stops a tool call. The
request returns 200. By default the call is withheld: it is removed
from the response, and a text block in its place explains why, streamed
or not.
for block in resp.content:
if block.type == "text" and block.text.startswith("[Sentisec blocked"):
... # a call was stopped; the text says why. Do not retry it.If you use an agent framework, you need to write nothing: with no call
left to run, the loop ends and the explanation is its answer. To let the
model re-plan instead, a workspace admin can opt in to rename; the call
then comes back as sentisec_tool_call_blocked. Full detail in
what happens when a tool call is blocked.
Install the CLI
sentisec-sdk on PyPI also ships the sentisec command, which pairs
this machine with your workspace and drives
subscription mode.
pipx install sentisec-sdk
sentisec --versionpipx isolates the package in its own virtual environment and puts
sentisec on your PATH. Full walkthrough in the
CLI quickstart.
To use the package as a library instead, install it into a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install sentisec-sdkThe venv keeps its dependencies isolated and sidesteps the PEP 668
externally-managed-environment error on macOS, Debian, Ubuntu, and
Fedora. Python 3.11 through 3.14 are supported.
Verify it worked
Open the dashboard at your workspace → Sessions. The session row is there; the Live view shows sessions as they arrive.
Verdicts attach to tool actions — the moments an agent reaches out and touches something. A plain completion like the one above makes no tool call, so it lands as a completed session with nothing to adjudicate. Once your agent starts calling tools, each action is scored:
NOMINAL call proceeded normally. ELEVATED flagged for review; call still proceeded. SUSPICIOUS escalated; may have been sanitized. HIJACK blocked; forensic evidence saved.
Click any row for per-step detail.