This release is a pre-release and may not be stable for production use.
sentisec-sdk
Public Python SDK for Sentisec.
sentisec-sdk is a thin client. You install it with pip, point it at
your workspace, and wrap your existing OpenAI / Anthropic client. Your
agent's tool calls then flow through Sentisec's hosted control plane,
where they are evaluated and either allowed, rewritten, or blocked
before they reach the world.
Install
pip install sentisec-sdk
Python 3.11+ is required.
Quick start
from sentisec_sdk import Monitor
monitor = Monitor() # picks up ~/.sentisec/credentials.toml after `sentisec login`
client = monitor.wrap_openai(...)
client = monitor.wrap_anthropic(...)
The sentisec CLI is shipped in the same wheel — see
The sentisec CLI below for the full surface.
sentisec login
sentisec status
sentisec demo run
sentisec logout
From
0.1.0a4onwardsSENTISEC_WORKSPACE_IDis OPTIONAL — the Sentisec proxy resolves the workspace from the API key prefix, so a one-env-var setup (SENTISEC_API_KEYonly) is sufficient for thewrap_anthropic/wrap_openaipath.Corrected 2026-08-18: this section used to warn that
Monitor()/Session()"raisesNotImplementedError" in the alpha. That has not been true since0.1.0a0— the wrapper path is fully implemented and tested. The note is removed rather than softened; it described a build state, not the shipped wheel.
Protecting a Claude Code / Codex subscription (sentisec edge)
The same wheel ships the edge daemon — the way to put Sentisec in front of an agent you drive on a Claude or ChatGPT subscription, with no API key and no provider token ever leaving your machine.
sentisec edge # guided setup: pair, install, start
sentisec edge status # what is wired and whether it is healthy
sentisec edge off # pause: calls pass through unchecked
sentisec edge on # resume (also restarts the local service)
sentisec edge logs # the local service log
sentisec edge uninstall # remove the service, hooks and provider entry
Setup is re-runnable and refuses before it writes: it looks for Claude
Code first, then verifies your workspace key with Sentisec, then shows
every file it is about to change and asks once. For a headless install,
pass --key (or set SENTISEC_WORKSPACE_KEY) with --yes:
sentisec edge setup --yes --key "$SENTISEC_WORKSPACE_KEY"
sentisec edge off is real: while it is paused the local service answers
every Claude Code hook with an explicit "not checked" allow, relays Codex
turns untouched, and uploads nothing.
Setup starts a small local service (launchd on macOS, a systemd user unit
on Linux) listening on 127.0.0.1:45711. It forwards Claude Code's
PreToolUse hooks to Sentisec's hosted control plane for a verdict and
uploads a token-scrubbed activity trail. When Codex is wired it also
listens on 45712 and relays each turn to chatgpt.com — your ChatGPT
credential goes there and nowhere else, and the copy Sentisec analyses is
redacted before it is sent.
No detection logic runs on your machine. The daemon forwards and enforces; the analysis happens server-side.
When Sentisec cannot be reached
The daemon has to answer a tool call it is holding, even when Sentisec's hosted plane is unreachable. What it answers is yours to choose:
SENTISEC_EDGE_FAIL_POSTURE |
Claude Code | Codex |
|---|---|---|
open |
the call is allowed | the turn is relayed |
ask |
Claude Code prompts you | relayed — Codex has no approval prompt |
closed |
the call is denied | the turn is refused (HTTP 403) |
| (unset — the default) | follows your workspace: monitoring-only workspaces allow, enforcing workspaces ask | as above, with ask relaying |
The same value can live in ~/.sentisec/edge.toml as fail_posture = "…";
the environment variable wins, so you can change posture during an
incident without editing a file the setup wizard also writes. Until the
daemon has completed one successful check it does not know which kind of
workspace it belongs to, and allows.
Whatever it decides, it records: every unchecked call leaves a
event=edge_fail_posture_applied line in the daemon's log naming the
cause, the posture and the decision, and the activity trail marks the
call as unchecked once connectivity returns.
The sentisec CLI
One command group, one exit-code contract, --json on everything that
has something to report.
| Command | What it does |
|---|---|
sentisec |
grouped help; names the two ways to get started |
sentisec login / logout |
pair (or unpair) this machine with a workspace |
sentisec status |
what this machine is connected to, and whether it works |
sentisec doctor |
fifteen local checks, each with the fix on the line |
sentisec demo run |
a scripted scenario against your workspace |
sentisec update / version |
what is installed, and what is available |
sentisec edge … |
cover a Claude Code / Codex subscription (above) |
Exit codes. Every command uses the same seven:
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | failure, or a configured thing is broken |
| 2 | usage |
| 3 | not configured / not authorised |
| 4 | network or endpoint |
| 5 | the verdict diverged from what the scenario expected |
| 130 | interrupted |
Machine-readable output. --json prints exactly one JSON document on
stdout and nothing else; every document carries schema_version and
exit_code. Available on status, doctor, demo run, update,
version, login, logout, edge status, edge setup --yes,
edge on, edge off and edge uninstall. A workspace key never appears
in any of them — only its last four characters.
Terminal behaviour. Colour is off under NO_COLOR, TERM=dumb,
--no-color, --plain, and whenever stdout is not a terminal. --plain
prints the same lines without panels, spinners or colour, with ASCII
status markers. -q prints nothing and lets the exit code carry the
answer.
Version check. status, doctor, version, update and the bare
help may check for a newer release: one request, a one-second budget,
cached for a day under ~/.sentisec/update-check.json, silent on
failure, and never before the command's own output. Set
SENTISEC_NO_UPDATE_CHECK=1 to switch it off. sentisec update only
prints the upgrade command for however you installed the CLI; it never
changes the installation itself.
Documentation
- Product overview: https://sentisec.ch
- Developer docs: https://docs.sentisec.ch
- Dashboard: https://app.sentisec.ch
- Support: mailto:support@sentisec.ch
Building the standalone CLI
For shipping channels that cannot rely on a working pip on the user's
box (curl installer, npm postinstall, GitHub Releases tarball), the
sentisec console-script entry is bundled as a single
shiv zipapp:
# one-time: install the build-only extra
uv pip install --system shiv # or: pipx install shiv
# build
./scripts/build-cli.sh # → dist/sentisec (executable)
# (optional) verify the build is reproducible
VERIFY_DETERMINISM=1 ./scripts/build-cli.sh
The build script:
- runs
shiv --console-script sentisec --output-file dist/sentisec --reproducible --compressed --python "/usr/bin/env python3" ., - smoke-tests
./dist/sentisec --versionand asserts the output equalssentisec <version-from-pyproject>, - when
VERIFY_DETERMINISM=1, rebuilds into a tempdir anddiffs the two artifacts byte-for-byte (shiv's--reproducibleflag pins all zip-entry timestamps to a fixed value).
Platform caveat. The resulting dist/sentisec shebangs to
/usr/bin/env python3, but its bundled wheels include the native
pydantic-core extension for the builder's (os, arch, python-minor) tuple. The artifact therefore runs on hosts matching
that tuple only. The release pipeline (P-INST-02) matrix-builds one
artifact per supported tuple and uploads each as a separate GitHub
Release asset.
License
Apache License 2.0. See LICENSE.
Metadata
Release files for sentisec-sdk 0.1.0a12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sentisec_sdk-0.1.0a12.tar.gz | 172.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sentisec_sdk-0.1.0a12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 370.5 kB
Release files / sentisec_sdk-0.1.0a12.tar.gz
| Download URL | sentisec_sdk-0.1.0a12.tar.gz |
|---|---|
| Size | 172.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6beb6ac7553581a61fa1ec26e6e44c30a13692ecb0fd4fb9d30adc118b9dd008
|
|
BLAKE2b-256 checksum How to use checksums |
e8236a66296ac7e6b8aa463eeb42723a9fba80f7dd0bbb8b094aa3cf7bf9053b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / sentisec_sdk-0.1.0a12-py3-none-any.whl
| Download URL | sentisec_sdk-0.1.0a12-py3-none-any.whl |
|---|---|
| Size | 198.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee155909819a7eb1e36b69221689616149d3378730a7a76c90351f9fa600cb2a
|
|
BLAKE2b-256 checksum How to use checksums |
c0bdc339b89d31474aa815128b00ca0d12fd0f1c53a38d1c1e1fcec305ba925b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency log