token-sentinel-adapter
Host-agnostic adapter kernel for TokenSentinel.
Coding-agent hosts (Claude Code, Codex, and similar) convert vendor-specific events into AdapterEvent, call EngineHandle, and map Decision back to the host.
Rules live only in token-sentinel. This package does not reimplement them.
Install
pip install token-sentinel-adapter
Requires token-sentinel>=1.0.3,<2.
For local development against a source checkout of the engine:
pip install -e /path/to/tokensentinel-sdk-python -e .
Quick start
from token_sentinel_adapter import AdapterEvent, EngineHandle
engine = EngineHandle(project="my-app", preset="observe") # observe | alert | strict
result = engine.handle(
AdapterEvent(
host="claude-code",
host_event="PostToolUse",
host_session_id="sess-123",
agent_id="main", # use host-provided id for subagents
tool_name="Read",
tool_input={"path": "app.py"},
)
)
print(result.decision.action, result.decision.reason)
print(result.decision.to_wire())
Behavior
| Concern | Behavior |
|---|---|
| Multi-agent | Rule windows are per (host_session_id, agent_id) — sibling agents do not pool |
| Health | RuntimeStatus: healthy, degraded, or down |
| Strict mode | May deny tools only when status is healthy |
| Engine | All detection via token-sentinel |
Presets
| Preset | Sentinel mode | Denies tools? |
|---|---|---|
observe |
log | No |
alert |
alert | No |
strict |
block | Yes (when healthy) |
Default coding rules: tool_loop, retry_storm, retrieval_thrash, context_bloat, zombie.
Status
0.1.0 — library kernel for host plugins. Optional long-lived HTTP sidecar can be added by host packages as needed.
License
Apache-2.0
Metadata
Release files for token-sentinel-adapter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| token_sentinel_adapter-0.1.0.tar.gz | 18.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| token_sentinel_adapter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.7 kB
Release files / token_sentinel_adapter-0.1.0.tar.gz
| Download URL | token_sentinel_adapter-0.1.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a2fc2b863489a0e73b125d92c7557ea0a888a22eb490d2111c9d894b1c9e4e0
|
|
BLAKE2b-256 checksum How to use checksums |
dea3abf0161c8d24daac3ca8aea466d89f7e68b91a5b8eba1631a43a15923b5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / token_sentinel_adapter-0.1.0-py3-none-any.whl
| Download URL | token_sentinel_adapter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b43d85f70df43eaca2cd6d0898a25bdb9e5c23ea1dcc7cd99d11ac75679cc14
|
|
BLAKE2b-256 checksum How to use checksums |
e280859ba0314da5c378873c81285f1eabed7fc4343748dbfb4f5c5f35b9fa7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for token-sentinel-adapter 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.