Pre-execution policy evaluation SDK for Sector8 AI agents and tools
Project description
Sector8 SDK
Python SDK for evaluating proposed AI-agent and tool actions with Sector8 before execution.
Sector8 is an execution-boundary security platform for AI systems. The production Guard Module is live at https://sdkapi.sector8.ai.
What this package is for
Use sector8-sdk when you want to:
- evaluate an action before your application executes it
- verify a new customer runtime key and decision contract
- retain canonical ALLOW or DENY decision artifacts for audit
- optionally use legacy telemetry, alert, and MCP guard helpers
The default installation is intentionally slim and contains the evaluate and onboarding path. The paid wedge is the live Gate and decision service, not a large client-side framework.
Installation
pip install sector8-sdk
Use the exact PyPI package name sector8-sdk, not sector8 or sdk.
Install the optional legacy telemetry and observability dependencies only when needed:
pip install sector8-sdk[full]
pip install sector8-sdk[openai]
pip install sector8-sdk[anthropic]
pip install sector8-sdk[google]
pip install sector8-sdk[all]
Verify a new customer connection
Run sector8-verify --help before using a customer key. For reproducible
customer onboarding, pin the approved SDK version in your own requirements.
pip install sector8-sdk
$env:SECTOR8_API_KEY = "<one-time-reveal-runtime-key>"
$env:SECTOR8_CLIENT_ID = "<client-id>"
$env:SECTOR8_ENDPOINT = "https://stgsdkapi.sector8.ai" # omit for production
$env:SECTOR8_UNSAFE_ENDPOINT = "true" # staging only
sector8-verify
The staging endpoint requires explicit unsafe-endpoint opt-in because the SDK allows only the production host by default. Remove both endpoint variables for production.
Quick start
Set your credentials:
export SECTOR8_API_KEY="your-api-key"
export SECTOR8_CLIENT_ID="your-client-id"
Send telemetry:
import sector8
client = sector8.setup(
api_key="your-api-key",
client_id="your-client-id",
)
client.log_llm_call(
provider="openai",
model="gpt-4o",
tokens=150,
cost=0.003,
latency_ms=800,
prompt="Summarize this contract.",
completion="Here is the summary...",
)
Protect an action before execution:
decision = await client.evaluate(
"bash",
{"command": "git status"},
caller_id="developer-1",
role="developer",
session_id="customer-onboarding-1",
)
if decision.allowed:
run_the_action()
else:
audit_log(decision.reason_code, decision.decision_trace_id)
A policy DENY is returned as a normal decision artifact. Authentication,
scope, validation, transport, and malformed-response failures raise SDK errors.
Never execute an action unless decision.allowed is True.
You can also call the async methods directly:
import asyncio
import sector8
async def main() -> None:
client = sector8.setup(api_key="your-api-key", client_id="your-client-id")
await client.save_telemetry(
provider="openai",
model="gpt-4o",
prompt="Classify this email",
completion="Likely phishing",
tokens_used=240,
latency_ms=620,
cost=0.0048,
success=True,
metadata={"route": "inbound-mail"},
)
await client.close()
asyncio.run(main())
Threat alerts and incidents
import sector8
client = sector8.setup(api_key="your-api-key", client_id="your-client-id")
client.alert_threat("prompt_injection", severity="High", description="Jailbreak attempt detected")
client.log_incident("Sensitive file request denied", severity="high", classification="policy_deny")
MCP guard helper
This package also ships a small CLI for installing the Sector8 guard MCP entry into a project:
sector8-guard install
sector8-guard version
The installer writes .claude/settings.json entries that point at the repo-local MCP stdio server and pass through:
SECTOR8_API_KEYSECTOR8_CLIENT_ID
Runtime endpoints used by this SDK
- Production API:
https://sdkapi.sector8.ai - Telemetry ingest:
POST /api/v1/telemetry - Threat alerts:
POST /api/v1/threat-alerts - Incident logs:
POST /api/v1/incident-logs
Secure host configuration
The SDK uses https://sdkapi.sector8.ai by default and treats endpoint as
the preferred configuration field. The legacy base_url alias is still
accepted for compatibility.
- plain HTTP is rejected by default
- arbitrary remote hosts other than
sdkapi.sector8.aiare rejected by default - endpoint values with
/api/...paths, query strings, or fragments are rejected by default - local or mock testing requires explicit opt-in
client = sector8.setup(
api_key="your-api-key",
endpoint="http://localhost:9876",
unsafe_endpoint=True,
)
Use unsafe_endpoint=True only for deliberate local or test use. The older
allow_unsafe_base_url=True option remains available as a compatibility alias.
Links
- Homepage:
https://sector8.ai - Production API:
https://sdkapi.sector8.ai - Dashboard:
https://app.sector8.ai - Repository:
https://github.com/sector8-ai/sector8-sdk-python
Development notes
This package targets Python 3.8+ and is published as sector8-sdk on PyPI.
The verifier submits safe simulated actions only. It confirms one ALLOW, one
DENY, and the canonical decision artifact fields without printing credentials
or request payloads.
Never use production credentials with staging, local, or other unsafe
endpoints. Never share a one-time reveal key. A successful run prints one ALLOW
trace, one DENY trace, and Staging onboarding smoke passed.
| Exit | Meaning |
|---|---|
0 |
Verification passed |
2 |
Missing or invalid configuration |
3 |
Endpoint/network unavailable |
4 |
Malformed or unexpected decision contract |
5 |
Authentication failed or key lacks scope |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sector8_sdk-1.0.3.tar.gz.
File metadata
- Download URL: sector8_sdk-1.0.3.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b00cc263117c65b486e7c6bab5995bf4a850cac11dd8fceb620ac4b12970db
|
|
| MD5 |
326a42847c07db4bd144a2cb5d6ae2d0
|
|
| BLAKE2b-256 |
e8e420076dd6460b3a531090440192e15dfa94a55310e8a6ff534bff24b926ec
|
Provenance
The following attestation bundles were made for sector8_sdk-1.0.3.tar.gz:
Publisher:
release-pypi.yml on sector8-ai/sector8-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sector8_sdk-1.0.3.tar.gz -
Subject digest:
93b00cc263117c65b486e7c6bab5995bf4a850cac11dd8fceb620ac4b12970db - Sigstore transparency entry: 1750551328
- Sigstore integration time:
-
Permalink:
sector8-ai/sector8-sdk-python@fa4ce4eed6808853d9b93b373efd05f007d042a9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sector8-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fa4ce4eed6808853d9b93b373efd05f007d042a9 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sector8_sdk-1.0.3-py3-none-any.whl.
File metadata
- Download URL: sector8_sdk-1.0.3-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22d6c9db5e7d7e3ef97e12adfed37592b0f188968d8e33522050adbacaf2f579
|
|
| MD5 |
87b1560b6986f4b5e9c845b790669ee5
|
|
| BLAKE2b-256 |
6ca558c6651add2280b97b230702ef82bbffee62b779c535b9ca1a657bec2fd5
|
Provenance
The following attestation bundles were made for sector8_sdk-1.0.3-py3-none-any.whl:
Publisher:
release-pypi.yml on sector8-ai/sector8-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sector8_sdk-1.0.3-py3-none-any.whl -
Subject digest:
22d6c9db5e7d7e3ef97e12adfed37592b0f188968d8e33522050adbacaf2f579 - Sigstore transparency entry: 1750551335
- Sigstore integration time:
-
Permalink:
sector8-ai/sector8-sdk-python@fa4ce4eed6808853d9b93b373efd05f007d042a9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sector8-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@fa4ce4eed6808853d9b93b373efd05f007d042a9 -
Trigger Event:
workflow_dispatch
-
Statement type: