Skip to main content

HaltState Sentinel SDK

PyPI

Private reads and buffered replies

Use PrivateFlowClient or AsyncPrivateFlowClient on your application server. Call authorize_read before fetching a private record and authorize_reply with a distinct operation ID and the immutable bytes you will send. Proceed at each gate only on decision == "ALLOW" and may_proceed is True. Replayed receipts are evidence only. Follow the setup and integration guide.

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

Metadata

Release files for haltstate-sdk 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haltstate-sdk 0.7.1
File Size Uploaded Provenance Actions
haltstate_sdk-0.7.1.tar.gz 22.1 kB Without provenance Details for haltstate_sdk-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for haltstate-sdk 0.7.1
File Interpreter ABI Platform Actions
haltstate_sdk-0.7.1-py3-none-any.whl Python 3 none any Details for haltstate_sdk-0.7.1-py3-none-any.whl

Total release size: 44.8 kB

Release files / haltstate_sdk-0.7.1.tar.gz

Download URL haltstate_sdk-0.7.1.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2ab778749f4a5bf17b34925261b10ce79c02e9abff4ea1485decf6fc966e9434
BLAKE2b-256 checksum
How to use checksums
5bb6d9dcb978abc99df653404c122d0611f1b0663860615dbcf567048f449234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / haltstate_sdk-0.7.1-py3-none-any.whl

Download URL haltstate_sdk-0.7.1-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48b78067e9ddf8008b42a1e46db40afc263374fa69dc0f134dfb191b025a0a52
BLAKE2b-256 checksum
How to use checksums
915cc4ba3662f4566dd6bc0928d996e6affd1850a1a1717d8afd912ee03dba61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for haltstate-sdk 0.7.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page