HaltState Sentinel SDK
Compliance & policy checks for AI agents. Perform pre-action checks, approvals, and post-action reporting with minimal code.
Canonical public base URL: https://haltstate.ai
Canonical governance namespace: /api/haltstate/sentinel/*
Current SDKs default to https://haltstate.ai and target /api/haltstate/sentinel/* first. They still fall back to legacy /api/sentinel/* aliases when needed.
Installation
pip install haltstate-sdk
Quickstart (sync)
from haltstate import HaltStateClient
client = HaltStateClient(
tenant_id="your_tenant_id",
api_key="hs_xyz",
base_url="https://haltstate.ai",
fail_open=False,
)
decision = client.check(
action="payment.process",
params={"amount": 5000, "currency": "USD"},
agent_id="payment-bot-01",
)
if decision.allowed:
process_payment(...)
client.report(decision, status="success", result={"transaction_id": "tx_123"}, action="payment.process", agent_id="payment-bot-01")
elif decision.requires_approval:
print(f"Approval required: {decision.reason}")
else:
print(f"Action denied: {decision.reason}")
Backward Compatibility
Existing code using janus imports continues to work:
from janus import JanusClient # Still works!
Guard Pattern
For actions requiring human approval, use the idempotent guard pattern:
from haltstate import AsyncHaltStateClient, ApprovalPending, ActionDenied
async def process_high_value_payment(invoice_id: str, amount: float):
client = AsyncHaltStateClient(
tenant_id="acme",
api_key="hs_xxx",
base_url="https://haltstate.ai",
)
try:
async with client.guard(
action="payment.process",
agent_id="payment-bot",
params={"invoice_id": invoice_id, "amount": amount},
idempotency_key=f"payment-{invoice_id}", # Retry-safe
timeout_seconds=300
) as permit:
# Only executes after human approval
result = await execute_payment(amount)
print(f"Approved by {permit.approver} at {permit.approved_at}")
return result
except ApprovalPending:
print("Awaiting human approval...")
return {"status": "pending"}
except ActionDenied as e:
print(f"Rejected by {e.rejected_by}: {e.reason}")
raise
Key features:
- Idempotency keys: Same key = same approval request, safe for retries
- Process restart safety: Approved actions can be executed after restart
- Audit trail: Full record of who approved and when
Decorators
from haltstate import HaltStateClient, haltstate_guard
client = HaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai")
@haltstate_guard(client, action="email.send", agent_id="email-bot")
def send_email(to, subject, body):
return mailer.send(to, subject, body)
Async
from haltstate import AsyncHaltStateClient
async def main():
async with AsyncHaltStateClient(tenant_id="acme", api_key="hs_xxx", base_url="https://haltstate.ai") as client:
res = await client.check("database.drop", params={"table": "users"})
if res.allowed:
await client.report(res, status="success", action="database.drop", agent_id="ops-bot")
Exceptions
from haltstate import (
HaltStateError, # Base error
HaltStateAuthError, # Invalid API key
HaltStateConnectionError, # Network/timeout
ApprovalPending, # Awaiting approval (guard pattern)
ActionDenied, # Human rejected (guard pattern)
ActionExpired, # Approval expired (guard pattern)
)
Docs
Full documentation at haltstate.ai/docs:
- Quickstart - 5-minute setup
- Guard Pattern - HITL approval flow
- API Reference - All methods
- Error Handling - Exception handling
- SB-53 Compliance - Regulatory mapping
Legacy Sentinel-prefixed routes remain supported as compatibility aliases, but new integrations should target the HaltState-branded public contract.
Migration from janus-sdk
If upgrading from janus-sdk:
# Old (still works)
from janus import JanusClient, janus_guard
# New
from haltstate import HaltStateClient, haltstate_guard
Both import styles work - no code changes required for existing users.
License
MIT
Release files for haltstate-sdk 0.7.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 | |
|---|---|---|---|
| haltstate_sdk-0.7.0.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| haltstate_sdk-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.9 kB
Release files / haltstate_sdk-0.7.0.tar.gz
| Download URL | haltstate_sdk-0.7.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05bce9e39a4d431cda71edada65e11dd8308e9ef47944332e280f20c0d0d0fde
|
|
BLAKE2b-256 checksum How to use checksums |
469b4d78b879070ffceaadaa4fcfdf861087d511979a676567699dba01bd0a0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / haltstate_sdk-0.7.0-py3-none-any.whl
| Download URL | haltstate_sdk-0.7.0-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6821e3f95c8c787e710c158eb153a2b6efdd9577bc46bb7c5d2ccaeb48affdd9
|
|
BLAKE2b-256 checksum How to use checksums |
19a4484f0946a7b7a9f219e7a12c3f68b7ab2cd361d7f86bdcfbe7e633bb93c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|