# POST /api/v1/telemetry
Source: https://docs.sector8.ai/api-reference/analyze
Ingest a completed LLM interaction for telemetry, compliance processing, and post-execution analysis.
`POST /api/v1/telemetry` is the post-execution ingest path for detective telemetry and analysis. It records what happened after an interaction completes. It does not block tool calls or replace pre-execution control.
Use [`POST /api/v1/evaluate`](/api-reference/evaluate) before dispatch when you need an `ALLOW` or `DENY` decision.
## Request
```http theme={null}
POST /api/v1/telemetry HTTP/1.1
Host: sdkapi.sector8.ai
x-api-key: YOUR_API_KEY
x-client-id: YOUR_CLIENT_ID
Content-Type: application/json
```
```json theme={null}
{
"provider": "openai",
"model": "gpt-4",
"prompt": "List all patient records for clinic ID 42.",
"completion": "Here are the records: ...",
"tokens_used": 150,
"cost": 0.003,
"latency_ms": 1200,
"status": "success",
"success": true,
"metadata": {
"session_id": "session-abc123",
"environment": "production"
}
}
```
Public examples use the production host. Use the endpoint and credentials issued to your environment. Do not commit real keys to source control.
## Request fields
| Field | Required | Description |
| ---------------------- | -------- | ---------------------------------------------------------- |
| `provider` | yes | LLM provider name such as `openai` or `anthropic`. |
| `model` | yes | Model identifier used for the interaction. |
| `prompt` | yes | Input prompt text. |
| `completion` | yes | Model output text. |
| `tokens_used` | yes | Total tokens consumed by the interaction. |
| `cost` | yes | Cost of the interaction in USD. |
| `latency_ms` | yes | End-to-end latency in milliseconds. |
| `status` | no | Client-reported interaction status. Defaults to `success`. |
| `success` | no | Legacy compatibility field. Defaults to `true`. |
| `guard_analysis` | no | Precomputed client-side guard analysis JSON string. |
| `metadata` | no | Additional custom metadata to store with the event. |
| `system_prompt` | no | Optional system prompt content. |
| `context_data` | no | Optional RAG context strings. |
| `context_segments` | no | Optional structured RAG segments. |
| `tool_output_data` | no | Optional tool output snippets. |
| `file_upload_data` | no | Optional uploaded file content for scanning. |
| `conversation_history` | no | Optional conversation excerpts. |
## Response
```json theme={null}
{
"status": "success",
"message": "Telemetry data ingested successfully",
"timestamp": "2026-03-22T14:04:22.691038+00:00",
"guard_analysis": {
"blocked": false,
"threat_type": null,
"evidence_hash": null,
"policy_version": "v7.0-phase2",
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c"
}
}
```
## Response fields
| Field | Description |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status` | API processing result. Successful ingestion returns `success`. |
| `message` | Human-readable ingest confirmation. |
| `timestamp` | UTC timestamp for the ingest result. |
| `guard_analysis` | Optional server-side analysis for the interaction. Contents vary by event and may include threat type, severity, evidence fingerprint, and policy metadata. |
## What the endpoint does
For authenticated telemetry requests, the backend can:
* validate `x-api-key` and `x-client-id`
* apply compliance redaction to prompt and completion data when configured
* run post-execution guard analysis on the sanitized interaction
* store telemetry, compliance metadata, and analysis records
* create incidents and alerts for detected threats when those integrations are configured
`/api/v1/evaluate` is the pre-execution enforcement path. `/api/v1/telemetry` is detective only: observability and post-execution analysis. Telemetry ingest does not block unsafe tool dispatch.
See [API Overview](/api-reference/overview), [Evaluate](/api-reference/evaluate), and [Onboarding](/guides/onboard).
# POST /api/v1/evaluate
Source: https://docs.sector8.ai/api-reference/evaluate
Evaluate a proposed tool or agent action before dispatch. Returns ALLOW or DENY with an evidence record.
Call `/api/v1/evaluate` before your runtime dispatches the proposed action. Honor the returned decision before any side effect starts.
Use the endpoint and credentials issued for your environment. Public examples use the production host.
## Request
```http theme={null}
POST /api/v1/evaluate HTTP/1.1
Host: sdkapi.sector8.ai
x-api-key: YOUR_API_KEY
x-client-id: YOUR_CLIENT_ID
Content-Type: application/json
```
```json theme={null}
{
"tool_name": "bash",
"arguments": {
"command": "cat .env"
},
"caller_id": "engineer-42",
"role": "developer",
"session_id": "session-abc123",
"owned_objects": ["repo-frontend"],
"object_id": "repo-frontend",
"operation": "read"
}
```
## Request fields
| Field | Required | Description |
| --------------- | -------- | ---------------------------------------------------------------------- |
| `tool_name` | yes | Tool or action being proposed |
| `arguments` | yes | Tool arguments as a JSON object |
| `caller_id` | no | Engineer or agent identifier recorded with the decision |
| `role` | no | Authorization role used in policy evaluation |
| `session_id` | no | Stable session identifier used for correlation and multi-turn analysis |
| `owned_objects` | no | Object IDs the caller owns, used for ownership checks |
| `object_id` | no | Target object for this call |
| `operation` | no | Requested operation used in policy evaluation |
| `capability` | no | Explicit capability override; defaults to `tool_name` when omitted |
## Response - ALLOW
```json theme={null}
{
"decision": "ALLOW",
"reason_code": "ALLOW_PASS",
"evidence_hash": "4cb7f786d1f3b57e6f98f3e60d2eb6b81c402d6d3efeb6c9551049f7c14df2f0",
"has_forensic_payload": false,
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
Your runtime may dispatch the proposed action.
## Response - DENY
```json theme={null}
{
"decision": "DENY",
"reason_code": "SENSITIVE_PATH_BLOCKED",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"decision_trace_id": "32819155-d21a-49c8-9509-79338d980fa9",
"policy_version_id": "5d61927dcac73a97e9e3c7ee0dbca364d66447469637bafa2282e635124fcb99"
}
```
Your runtime must not execute the proposed action.
Branch on `decision`. The same proposed action may return different `reason_code` values depending on which policy layer blocks it (for example `PRE_FILTER_BLOCK` vs a more specific path or injection code).
## Human hold
`POST /api/v1/evaluate` is strictly synchronous and returns `ALLOW` or `DENY`. If a proposed action would require waiting for a human on this path, evaluate fails closed and returns `DENY` with `REVIEW_REQUIRED_FAIL_CLOSED`.
A human hold is available on the MCP connector path. The connector pauses until a reviewer approves or denies, then returns `ALLOW` or `DENY`. Unresolved holds fail closed.
`reason_code` and `policy_version_id` are opaque support/evidence identifiers. Values depend on your active policy, environment, and evaluation path. Do not build exhaustive dispatch logic on them. The contract is that the runtime receives a `decision` before the proposed action executes.
## Response fields
| Field | Type | Description |
| ---------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `decision` | string | `"ALLOW"` or `"DENY"` |
| `reason_code` | string\|null | Opaque machine-readable reason for support/display. Illustrative values: [reason codes](/api-reference/overview#reason-codes). Branch on `decision`, not on a specific code. |
| `evidence_hash` | string | Fingerprint of the decision evidence for correlation and integrity checks |
| `has_forensic_payload` | boolean | Indicates whether additional forensic detail is attached to the record |
| `decision_trace_id` | string | Unique audit identifier for this evaluated action |
| `policy_version_id` | string\|null | Non-empty policy identifier applied to the decision. May be a binding hash or a runtime version label depending on evaluation path; do not assume one format across all verdicts. |
## Runtime semantics
Honor the decision before dispatch:
| `decision` | Runtime behavior |
| ----------------- | ------------------------------- |
| `ALLOW` | May execute the proposed action |
| `DENY` | Must block the proposed action |
| Missing / unknown | Fail closed; do not execute |
Fail closed if the evaluate call fails, times out, or returns an unknown decision. Do not execute the proposed action by default.
## Client timeout
Set an evaluate HTTP client timeout of **at least 10 seconds**. `10s` is the recommended default.
Observed evaluate latency on the public production host is commonly about 1–4 seconds. Slower environments and cold paths can take longer. If you set a 1–2s timeout, fail-closed will block legitimate `ALLOW` traffic.
## Telemetry
Every evaluate call is recorded with the returned decision artifact. Denied actions can feed alert and incident workflows when those integrations are configured for your tenant.
See [Guardrails](/guides/guardrails#forensic-telemetry) for broader telemetry context and the [Quickstart](/guides/quickstart) for the first evaluate-before-dispatch proof.
# GET /api/health
Source: https://docs.sector8.ai/api-reference/health
Returns the current health and capability state of the Sector8 gate.
## Request
```http theme={null}
GET /api/health HTTP/1.1
Host: sdkapi.sector8.ai
```
No request body or authentication headers are required.
Public examples use the production host. Use the endpoint issued to your environment.
Use `/api/health` for external checks and load balancer probes. The service also exposes
`/health`, but `/api/health` is the stable public path used in deployment verification.
Health proves the gate endpoint is reachable and configured. It does not prove a customer app is protected. Enforcement is proven only by a routed `evaluate` call that the application honors before dispatch.
## Response
```json theme={null}
{
"status": "healthy",
"service": "running",
"database": "healthy",
"timestamp": "2026-03-22T15:35:30.652651+00:00",
"policy_version_id": "v7.0-phase2",
"invariants_active": 7,
"phase": "2",
"capabilities": {
"admission_controller": true,
"multi_turn_analyzer": true,
"semantic_engine": true,
"pre_filter": true,
"output_compliance": true,
"file_scanner": true,
"rag_integrity": true,
"memory_integrity": true,
"guard_mcp_server": true
}
}
```
## Response fields
| Field | Type | Description |
| ------------------- | ------ | ------------------------------------------------------------------------------ |
| `status` | string | Service health status. Healthy deployments return `"healthy"`. |
| `service` | string | Runtime state, typically `"running"`. |
| `database` | string | Database connectivity state, typically `"healthy"` or `"unhealthy"`. |
| `timestamp` | string | UTC timestamp for the health response. |
| `policy_version_id` | string | Active policy version or runtime policy identifier loaded by the gate. |
| `invariants_active` | number | Number of active invariants. Healthy production deployments should report `7`. |
| `phase` | string | Active rollout phase for the service. |
| `capabilities` | object | Boolean flags for major gate capabilities. |
If health fails, or `invariants_active` is less than `7`, treat the deployment as degraded and do not route live actions until the gate is healthy again.
See [Evaluate](/api-reference/evaluate) for the enforcement contract and [Quickstart](/guides/quickstart) for the first routed evaluate-before-dispatch proof.
# API Overview
Source: https://docs.sector8.ai/api-reference/overview
REST API mental model for Sector8 evaluate-before-dispatch decisions and supporting telemetry.
## Base URL
```
https://sdkapi.sector8.ai
```
Public examples use the production host. Use the endpoint and credentials issued to your environment.
## Authentication
All requests require two headers:
```http theme={null}
x-api-key: YOUR_API_KEY
x-client-id: YOUR_CLIENT_ID
```
Use the runtime credentials issued to your environment. Do not commit real keys to source control.
## Decision contract
`POST /api/v1/evaluate` is the primary enforcement API. Call it before your runtime dispatches a proposed tool or agent action, then honor the returned decision.
| `decision` | Runtime behavior |
| ----------------------------------- | -------------------------------- |
| `ALLOW` | May dispatch the proposed action |
| `DENY` | Must block the proposed action |
| Missing / unknown / error / timeout | Fail closed; do not dispatch |
**Human hold.** On the MCP connector path, a borderline action can be held for a human before dispatch. Unresolved holds fail closed. `POST /api/v1/evaluate` is strictly synchronous and always returns `ALLOW` or `DENY`; if that path would need to wait, it returns `DENY` with `REVIEW_REQUIRED_FAIL_CLOSED`.
Sector8 returns the verdict. Your application owns enforcing it at the dispatch boundary for actions routed through evaluate.
Coverage applies to proposed actions your runtime routes through this API. Unconnected tools and bypassed dispatch paths are not automatically covered.
## Policy model
Sector8 uses **versioned policy sets, bound per tenant**. The active tenant binding determines which policy version evaluate applies for routed actions in that environment. Baseline safety checks remain active alongside tenant-bound policy.
Agent-scoped policy can add narrower controls for a specific agent or action. Operators can bind, suspend, resume, and review policy state through the control plane; evaluate is the runtime path that returns the enforceable decision.
Decision artifacts commonly include:
| Field | Description |
| ---------------------- | ------------------------------------------------------------------------- |
| `decision` | `ALLOW` or `DENY` |
| `reason_code` | Opaque machine-readable reason for support/display — branch on `decision` |
| `evidence_hash` | Fingerprint of the decision evidence for correlation and integrity checks |
| `has_forensic_payload` | Indicates whether additional forensic detail is attached |
| `decision_trace_id` | Unique audit identifier for this evaluated action |
| `policy_version_id` | Non-empty policy identifier (binding hash or runtime version label) |
See [Evaluate](/api-reference/evaluate) for request and response examples.
## Endpoints
| Method | Endpoint | Description |
| ------ | --------------------------------------------- | ----------------------------------------------- |
| `GET` | [`/api/health`](/api-reference/health) | Gate health and capability state |
| `POST` | [`/api/v1/evaluate`](/api-reference/evaluate) | Evaluate a proposed action before dispatch |
| `POST` | [`/api/v1/telemetry`](/api-reference/analyze) | Ingest a completed LLM interaction for analysis |
Telemetry records what happened. It is not a substitute for evaluate-before-dispatch.
## Reason codes
`reason_code` is an opaque support/evidence field. **Honor `decision` for dispatch.** Do not write exhaustive `if reason_code == ...` handling — the set is not a closed public enum and the same unsafe action may be blocked by different layers.
Illustrative values you may see:
| Code | Trigger |
| ----------------------------------- | -------------------------------------------------------------------------------------- |
| `ALLOW_PASS` | Proposed action passed policy and admission checks |
| `PRE_FILTER_BLOCK` | Blocked by an early pre-filter (common for known-unsafe shell/path patterns) |
| `REVIEW_REQUIRED_FAIL_CLOSED` | REST evaluate would have needed to wait; it denied instead |
| `MCP_SHELL_INJECTION_BLOCKED` | Shell injection detected in command |
| `SENSITIVE_PATH_BLOCKED` | Access to a sensitive file path |
| `MCP_OBFUSCATED_*_BLOCKED` | Obfuscated payload decoded and blocked (e.g. `MCP_OBFUSCATED_SHELL_INJECTION_BLOCKED`) |
| `PARAM_INJECTION_DETECTED` | Prompt or parameter injection in arguments |
| `SEMANTIC_THREAT_DETECTED` | Semantic similarity to known attack pattern |
| `PRIVATE_IP_BLOCKED` | SSRF - target resolves to private IP space |
| `EXTERNAL_DOMAIN_BLOCKED` | Domain not on the allowed list |
| `BOLA_VIOLATION` | Caller does not own the target object |
| `BFLA_VIOLATION` | Caller role is not authorized for this tool |
| `GDPR_DATA_MINIMISATION_VIOLATION` | PII detected - data minimisation policy |
| `HIPAA_MINIMUM_NECESSARY_VIOLATION` | PHI detected - minimum necessary standard |
| `RATE_LIMIT_EXCEEDED` | Call rate exceeded for this session |
| `TOOL_NOT_REGISTERED` | Tool has not been registered with the gate |
| `LOCKDOWN_RESTRICTED` | Tool is disabled by lockdown capability gate |
| `CAPABILITY_MISSING` | Required capability is not available |
| `GUARD_INTERNAL_ERROR` | Evaluation failed; treat as fail-closed on the routed path |
Exact `reason_code` and `policy_version_id` values depend on your active policy, environment, and evaluation path.
## Client timeout
For `POST /api/v1/evaluate`, set an HTTP client timeout of **at least 10 seconds** (`10s` recommended default). Fail closed on timeout. Aggressive 1–2s timeouts will block legitimate `ALLOW` traffic.
## Rate limits
The shipped app and MCP server enforce per-session, per-tool rate limiting via an in-memory sliding window. The current injected runtime limit is **8 requests per 10 seconds** per session and tool combination. The limiter implementation's class default is 25 requests per 10 seconds. Requests over the limit return `RATE_LIMIT_EXCEEDED`.
Contact support to adjust limits for your deployment.
# Compliance Overview
Source: https://docs.sector8.ai/guides/compliance
How Sector8 provides pre-execution controls and decision evidence that support compliance workflows at the tool boundary.
Sector8 provides pre-execution controls and decision evidence at the tool-call boundary. These controls can support GDPR, HIPAA, EU AI Act, PCI-DSS, ISO 27001, and SOC 2 workflows when your runtime routes proposed actions through evaluate and honors the decision.
Sector8 does not certify your organization as compliant and does not replace legal review, DPIAs, BAAs, or full compliance automation.
Use Sector8 as an execution-boundary control and evidence source inside a broader compliance program.
## The pre-execution advantage
Traditional compliance tooling often operates after the fact. When your runtime routes proposed actions through Sector8, evaluation happens before local dispatch so policy can block risky data movement before the side effect starts.
| Framework | Controls supported at the tool boundary |
| ------------------------------ | ------------------------------------------------------------------------------ |
| [GDPR](/guides/gdpr) | PII detection, data minimisation, Art. 5/17-oriented audit evidence |
| [HIPAA](/guides/hipaa) | PHI pattern checks, minimum-necessary style blocking, audit evidence |
| [EU AI Act](/guides/eu-ai-act) | Risk controls, logging evidence, human oversight on review-enabled guard paths |
| PCI-DSS v4 | PAN/CVV detection, CDE path blocking support |
| ISO 27001 | Access, logging, and change-control support at the execution boundary |
| SOC 2 Type II | Logical access, monitoring, and change-evidence support |
Exact enforcement depends on your active policy, compliance pack configuration, and which tool paths are routed through Sector8.
## Decision evidence
Blocked and reviewed actions produce a decision artifact your operators can audit and correlate:
```json theme={null}
{
"decision": "DENY",
"reason_code": "GDPR_DATA_MINIMISATION_VIOLATION",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7",
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c"
}
```
| Field | Description |
| ---------------------- | ------------------------------------------------------------------------- |
| `evidence_hash` | Fingerprint of the decision evidence for correlation and integrity checks |
| `has_forensic_payload` | Indicates whether additional forensic detail is attached |
| `policy_version_id` | Policy version or runtime policy identifier applied to the decision |
| `decision_trace_id` | Unique audit identifier linking this decision to the evaluation path |
Honor `ALLOW` and `DENY` before dispatch. Missing, unknown, or failed evaluate results should fail closed on the routed path. On review-enabled guard paths, unresolved human review also fails closed.
See [Guardrails](/guides/guardrails#forensic-telemetry), [Evaluate](/api-reference/evaluate), and the framework pages below.
## Framework guides
* [GDPR](/guides/gdpr)
* [HIPAA](/guides/hipaa)
* [EU AI Act](/guides/eu-ai-act)
# EU AI Act
Source: https://docs.sector8.ai/guides/eu-ai-act
How Sector8 can support EU AI Act-oriented controls and evidence at the AI tool execution boundary.
When your runtime routes proposed actions through Sector8, the gate can support EU AI Act-oriented obligations at the execution boundary -- before a proposed tool call is dispatched locally.
Sector8 does not make your organization EU AI Act-compliant by itself. Use these controls and evidence records inside a broader AI governance program with legal review.
## Article support
| Article | Requirement | How Sector8 can support it |
| ----------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **Art. 9** | Risk management system | Fail-closed evaluate path with invariants on routed integrations. Evaluation failures should not fail open. |
| **Art. 10** | Data governance | ComplianceGate (AC-6) can scan routed tool calls for PII/PHI before dispatch when configured. |
| **Art. 12** | Logging and record-keeping | Evaluated decisions produce evidence fields such as `evidence_hash`, `policy_version_id`, and `decision_trace_id`. |
| **Art. 13** | Transparency | Policy version metadata can accumulate in telemetry so operators can see which policy applied. |
| **Art. 14** | Human oversight | Review-enabled guard paths can pause risky actions for human approval before execution; unanswered review items can auto-deny (fail-closed). |
Art. 13 dashboard coverage may depend on policy-version metadata accumulating in telemetry over time. A fresh deployment can show it as not yet covered until enough rows exist -- this is expected, not automatic certification.
## Readiness score
Where enabled, an EU AI Act readiness score may be available on the compliance dashboard and via API for your environment. Treat scores as operational readiness signals for configured controls, not legal certification.
```bash theme={null}
curl -s "https://sdkapi.sector8.ai/api/v1/compliance/summary" \
-H "x-client-id: $SECTOR8_CLIENT_ID" \
-H "x-api-key: $SECTOR8_API_KEY" | python -m json.tool
```
Use the credentials issued to your environment. Public examples use the production host.
```json theme={null}
{
"eu_ai_act_score": 80,
"eu_ai_act_articles": {
"ART_9": { "covered": true, "label": "Risk management" },
"ART_10": { "covered": true, "label": "Data governance" },
"ART_12": { "covered": true, "label": "Logging" },
"ART_13": { "covered": false, "label": "Transparency" },
"ART_14": { "covered": true, "label": "Human oversight" }
}
}
```
`covered: false` on Art. 13 often means not enough historical telemetry rows yet -- not an automatic legal finding.
## What this means in practice
* **Art. 9** support means the routed evaluate path can fail closed with invariant-backed risk controls -- not that a checkbox was ticked.
* **Art. 12** support means evaluated decisions can produce evidence fields for audit -- when the action was routed through Sector8.
* **Art. 14** support means review-enabled guard paths can pause risky actions for human approval before dispatch.
Honor `ALLOW` and `DENY` at the dispatch boundary. Missing, unknown, or failed evaluate results should fail closed on the routed path. On review-enabled guard paths, unresolved reviews fail closed.
See [Compliance overview](/guides/compliance), [Guardrails](/guides/guardrails), and [Evaluate](/api-reference/evaluate).
# GDPR
Source: https://docs.sector8.ai/guides/gdpr
How Sector8 supports GDPR-oriented controls with pre-execution evaluation and telemetry redaction evidence.
Sector8 can support GDPR workflows at two points in the flow when your runtime routes proposed actions through it:
* before execution, by blocking risky tool calls at the admission boundary
* after execution, by redacting sensitive telemetry before it is stored
Sector8 does not make your organization GDPR-compliant by itself. Use these controls as part of a broader privacy program with legal review.
## Where GDPR controls apply
| Stage | What Sector8 can do |
| -------------- | ------------------------------------------------------------------------------------------------------------ |
| Pre-execution | Block tool calls that violate configured data-minimisation policy before local dispatch |
| Post-execution | Apply compliance redaction so prompts and completions can be sanitized before storage |
| Audit trail | Denied requests carry evidence linkage such as `evidence_hash`, `decision_trace_id`, and `policy_version_id` |
Coverage applies to tool calls and telemetry your runtime routes through Sector8. Unconnected paths are not automatically covered.
## GDPR controls mapped to shipped behavior
| GDPR requirement | How Sector8 can support it |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Art. 5 - Data minimisation | Blocks PII-bearing tool calls and unnecessary bulk access before execution with `GDPR_DATA_MINIMISATION_VIOLATION` when that policy is active |
| Art. 25 - Privacy by design | Applies policy before the tool runs on the routed path, so protected data is not accessed first and reviewed later |
| Art. 32 - Security of processing | Uses policy version identifiers, evidence hashes, and fail-closed denial guidance on guard exceptions for the routed path |
| Art. 33 - Breach response readiness | Blocked telemetry can create incidents and alert events with traceable evidence linkage when those integrations are configured |
## What gets detected
The GDPR pack is pattern-based. It is designed to catch common high-risk identifiers in tool
arguments and telemetry, not to make broad semantic legal judgments.
Examples include:
* email addresses
* phone numbers
* dates of birth
* national identifiers
* financial account patterns
Sector8's GDPR scoring and enforcement are operational controls, not a certified legal assessment.
Use them as guardrails inside a broader privacy program.
## What a GDPR denial looks like
When a routed tool call is denied for data minimisation, the public response shape includes:
```json theme={null}
{
"decision": "DENY",
"reason_code": "GDPR_DATA_MINIMISATION_VIOLATION",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"decision_trace_id": "32819155-d21a-49c8-9509-79338d980fa9",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
Your runtime must honor the decision: execute only on `ALLOW`, block on `DENY`, and fail closed on missing, unknown, or failed evaluate results.
## How to verify GDPR controls
1. Send a known PII-bearing tool call through [`POST /api/v1/evaluate`](/api-reference/evaluate).
2. Confirm the response returns `DENY` with `GDPR_DATA_MINIMISATION_VIOLATION` and that your runtime does not dispatch.
3. Optionally send a completed interaction through [`POST /api/v1/telemetry`](/api-reference/analyze).
4. Confirm stored telemetry is redacted when that path is enabled and evidence linkage is present.
You are done when a risky routed tool call is blocked before execution, your runtime honors the `DENY`, and corresponding evidence fields are present for audit.
# Guardrails
Source: https://docs.sector8.ai/guides/guardrails
How Sector8 evaluates proposed AI actions before execution and returns ALLOW or DENY.
## How it works
When your runtime routes proposed actions through Sector8, each action is evaluated before side effects start. Honor the returned decision before dispatch.
```text theme={null}
Proposed AI action
(tool call, API call, model call, or handoff)
|
v
Spotlighting
|
v
Pre-filter classifier
|
v
Rate limiter
|
v
Admission and policy
|
+-- DENY -> runtime blocks the action
| decision artifact recorded
|
+-- ALLOW -> runtime may execute the action
decision artifact recorded
```
On the MCP connector path only, a borderline action can be held for a human before that `ALLOW` or `DENY` is returned. If nobody answers, it is denied. `POST /api/v1/evaluate` does not wait; it fails closed to `DENY`.
Enforcement holds where the runtime routes proposed actions through Sector8 and fails closed on gate unavailability or unknown decisions. See the [Quickstart](/guides/quickstart) and [Evaluate API](/api-reference/evaluate).
If evaluation fails unexpectedly while the action is routed through Sector8, treat the outcome as fail-closed: your runtime should not execute the proposed action. The gate may surface a context-bound `GUARD_INTERNAL_ERROR` deny with a decision artifact.
## The seven invariants
### INV-1 - Single execution gate
No authorized routed path from model output to tool execution that skips evaluation. The admission path is the dispatch control point.
### INV-2 - Dual gate requirement
Policy decides intent. Authorization decides capability. Execution requires both.
### INV-3 - Per-step enforcement
Evaluation runs per tool call, per agent step, after planning and before execution.
### INV-4 - Untrusted executor model
The LLM produces candidates. The control plane decides outcomes. LLM confidence is not a security property.
### INV-5 - Spotlighting before policy
Content is trust-tagged before policy evaluation. Untrusted content cannot promote its own trust level.
### INV-6 - Explicit execution condition
Execute only on an explicit `ALLOW` that your runtime honors. `DENY`, missing, or unknown decisions must not execute. On the MCP connector path, an unresolved human hold must not execute; TTL expiry is a deny.
### INV-7 - Decision evidence on deny
Deny responses surfaced to the caller include `evidence_hash`, `has_forensic_payload`, `policy_version_id`, and `decision_trace_id` so operators can correlate what was blocked and why.
## Admission Controller checks
Each tool call passes sequential checks. Failure at any check returns `DENY` immediately.
| Check | What it evaluates | Reason codes on failure |
| ---------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0. Rate limiter | Call rate per session before expensive evaluation | `RATE_LIMIT_EXCEEDED` |
| 1. Tool registration | Tool must be registered | `TOOL_NOT_REGISTERED` |
| 2. Lockdown and capability | Capability gate for the requested action | `LOCKDOWN_RESTRICTED`, `CAPABILITY_MISSING` |
| 3. Object ownership (BOLA) | Caller must own the target object | `BOLA_VIOLATION` |
| 4. Role authorization (BFLA) | Caller role must satisfy tool `required_role` | `BFLA_VIOLATION` |
| 5. Semantic and request risk | Semantic threats, shell injection, SSRF, segmented-input safety, obfuscated payloads | `SEMANTIC_THREAT_DETECTED`, `MCP_SHELL_INJECTION_BLOCKED`, `SENSITIVE_PATH_BLOCKED`, `EXTERNAL_DOMAIN_BLOCKED`, `PRIVATE_IP_BLOCKED`, `OBFUSCATED_SHELL_INJECTION`, `PARAM_INJECTION_DETECTED` |
| 6. Compliance gate (AC-6) | Pre-execution PII/PHI scan — block dispatch on the routed path when a pattern matches | `GDPR_DATA_MINIMISATION_VIOLATION`, `HIPAA_MINIMUM_NECESSARY_VIOLATION` |
Check 5 (security threats) runs before check 6 (compliance) so that the reason code identifies the primary threat. A `web_fetch` to a private IP with PII in the body returns `PRIVATE_IP_BLOCKED`, not a compliance code.
## Human hold on the MCP connector
On the MCP connector path, a borderline action can be held for a human before the connector returns `ALLOW` or `DENY`. A reviewer approves or denies via the API. If no action is taken within the TTL window, the request is denied (fail-closed).
`POST /api/v1/evaluate` is strictly synchronous. If that path would need to wait, it returns `DENY` with `REVIEW_REQUIRED_FAIL_CLOSED`.
```
MCP connector hold
|
v
Human queue (TTL window)
|
+-- approved -> connector may return ALLOW and execute
+-- denied -> DENY, reviewer recorded with the decision
+-- TTL expires -> DENY
```
Every approval is a one-time authorization. A second identical request is evaluated again — approval does not persist as a session-level exemption.
## Pre-filter
Before the full Admission Controller runs, a fast-path classifier routes requests. These labels are internal routing, not public `decision` values:
| Internal label | Meaning | What happens |
| -------------- | ------------------------- | ------------------------------------------------------------ |
| `BLOCK` | High-confidence malicious | deny immediately, AC skipped |
| `PASS` | High-confidence benign | continue on the fast path |
| `REVIEW` | Ambiguous | continue to full AC evaluation, or hold on the MCP connector |
The pre-filter also decodes and reclassifies obfuscated inputs. Covered forms include
zero-width insertion, character arrays, hex escapes, base64 blobs, and rot13.
## Spotlighting
All content entering policy evaluation is tagged with a trust source before evaluation.
| Source tag | Applied to |
| ------------------------------------------------------------------------- | -------------------------------- |
| `[UNTRUSTED_CONTEXT source="rag_retrieval"]` | retrieved document chunks |
| `[TOOL_OUTPUT: UNTRUSTED]` and `[UNTRUSTED_CONTEXT source="tool_output"]` | results from previous tool calls |
| `[FILE_UPLOAD: UNTRUSTED]` and `[UNTRUSTED_CONTEXT source="file_upload"]` | uploaded file content |
Untrusted content cannot promote its own trust level.
## What gets blocked
Prompt injection, shell injection, SSRF, obfuscated payloads, PII and PHI exfiltration,
data exfiltration, BOLA violations, BFLA violations, and rate-flood or reasoning-DoS
patterns.
## Forensic telemetry
Blocked actions produce a decision artifact your operators can audit and correlate.
```json theme={null}
{
"decision": "DENY",
"reason_code": "MCP_SHELL_INJECTION_BLOCKED",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7",
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c"
}
```
| Field | Description |
| ---------------------- | ------------------------------------------------------------------------- |
| `evidence_hash` | Fingerprint of the decision evidence for correlation and integrity checks |
| `has_forensic_payload` | Indicates whether additional forensic detail is attached to the record |
| `policy_version_id` | Policy version or runtime policy identifier applied to the decision |
| `decision_trace_id` | Unique audit identifier linking this decision to the evaluation path |
Exact `reason_code` and `policy_version_id` values depend on your active policy and environment. See [Evaluate](/api-reference/evaluate) for the runtime contract.
## Compliance coverage
Pre-execution compliance is preventive, not detective. On the routed path, policy can block
risky data movement before local dispatch.
| Framework | Controls supported at the tool boundary |
| ------------- | ------------------------------------------------------------- |
| GDPR | PII detection, data minimization, Art. 5 and 17 audit trail |
| HIPAA | PHI patterns, minimum-necessary access, logging controls |
| PCI-DSS v4 | PAN and CVV detection, CDE path blocking, Req. 10.2 and 6.3.2 |
| ISO 27001 | A.8.2, A.9.4, A.12.4, A.14.2 |
| SOC 2 Type II | CC6.1, CC6.6, CC7.2, CC9.2 |
# HIPAA
Source: https://docs.sector8.ai/guides/hipaa
How Sector8 supports HIPAA-oriented PHI controls at the AI tool execution boundary.
When your runtime routes proposed actions through Sector8 and HIPAA compliance packs are active, Sector8 can enforce PHI-oriented controls before local dispatch.
Sector8 does not make your organization HIPAA-compliant by itself and does not replace BAAs, privacy programs, or legal review.
Set `COMPLIANCE_LEVEL=HIPAA` to activate PHI pattern matching at admission check 6 (ComplianceGate) for routed evaluate calls.
## Controls supported at the tool boundary
| HIPAA requirement | How Sector8 can support it |
| ---------------------------------- | ---------------------------------------------------------------------------------------------- |
| 164.312(a) - Access control | Tool allowlist and role checks on the routed admission path |
| 164.312(b) - Audit controls | Decision evidence on evaluated calls, including allow, deny, and review-enabled guard outcomes |
| 164.312(c) - Integrity | Policy version identifiers and evidence fingerprints for decision correlation |
| 164.312(e) - Transmission security | Blocks data transmission to unlisted external domains on governed paths |
| Minimum necessary standard | ComplianceGate (AC-6) can block tool calls whose payload contains configured PHI patterns |
Coverage applies to tool calls routed through evaluate or a Sector8 connector. Unconnected paths are not automatically covered.
## PHI detection
ComplianceGate (AC-6) uses regex-based pattern matching to detect PHI. The shipped HIPAA pack detects:
| Pattern | What it matches |
| -------------- | -------------------------------------------------------------- |
| `mrn` | Medical record numbers - `MRN:` prefix followed by 7-10 digits |
| `npi` | National Provider Identifiers - `NPI:` followed by 10 digits |
| `icd10` | ICD-10 diagnosis codes - standard code format |
| `insurance_id` | Member ID, insurance ID, or policy ID fields |
| `dea_number` | DEA registration numbers - two letters followed by 7 digits |
Detection is pattern-based, not semantic. Clinical notes or narrative text that do not contain these structured identifiers are not matched by the HIPAA pack. The GDPR PII patterns (email, phone, SSN, and others) also apply when `COMPLIANCE_LEVEL=HIPAA`.
## Decision evidence
A PHI-related denial on the routed path produces a decision artifact such as:
```json theme={null}
{
"decision": "DENY",
"reason_code": "HIPAA_MINIMUM_NECESSARY_VIOLATION",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7",
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c"
}
```
Your runtime must honor the decision: execute only on `ALLOW`, block on `DENY`, and fail closed on missing, unknown, or failed evaluate results.
See [Compliance overview](/guides/compliance) and [Evaluate](/api-reference/evaluate).
# Welcome to Sector8
Source: https://docs.sector8.ai/guides/introduction
Pre-execution control for AI agents. Every proposed action returns ALLOW or DENY before it executes.
# Pre-execution control for AI agents
AI agents propose actions. Sector8 decides whether those actions can proceed before the proposed action executes.
Sector8 gives your business an independent control point between an agent and a real-world side effect: refund creation, customer data export, shell execution, inventory reorder, deployment, file access, API call, or model handoff.
Every evaluated action returns an `ALLOW` or `DENY` decision with an audit-grade evidence record: `reason_code`, `decision_trace_id`, `evidence_hash`, and `policy_version_id`.
**The agent does not approve itself.** Proposed actions pass through an independent decision gate. Enforcement holds where the runtime routes proposed actions through Sector8 and fails closed on gate unavailability.
***
## What each buyer should understand
Sector8 moves control to the execution boundary. You can block prompt injection, unsafe tool use, PII exposure, and policy breaches before the action runs.
Sector8 is model-agnostic. Integrate at the tool or action boundary through SDKs, REST evaluate, or MCP-connected runtimes.
Each decision creates evidence with a reason code, trace ID, evidence hash, and policy version so reviewers can see what happened and why.
Versioned policy sets can be bound per tenant to control what agents are allowed to do, such as refund limits, inventory reorder limits, customer data export, and human review for high-risk actions.
***
## What you can do with Sector8
Stop prompt injection, shell abuse, PII exfiltration, and business-policy breaches before the proposed action executes.
Intercept proposed actions from SDKs, REST evaluate, or MCP-connected runtimes, including Claude Code tool calls, before operating systems or business systems act.
Return an audit-grade decision record with decision, reason code, evidence hash, policy version, and decision trace ID.
Keep your model and application architecture. Add Sector8 at the point where the app would otherwise dispatch a tool call, API call, or agent action.
***
## How it works
The agent or model proposes an action. Sector8 evaluates the proposed action against baseline safety checks and the active policy set bound to your tenant. Your runtime then honors the returned decision.
```text theme={null}
Proposed AI action
(tool call, API call, model call, or handoff)
|
v
Sector8 evaluate
|
+-- Pre-filter
| Fast path for obvious unsafe patterns
|
+-- Admission and policy
Baseline safety plus tenant-bound and agent-scoped policy
|
+-- ALLOW -> runtime may execute the action
+-- DENY -> runtime blocks the action
```
Unlike output filters, SIEM, or audit logs alone, Sector8 owns the execution decision before the side effect starts. When correctly integrated, there is no authorized path around the gate.
Sector8 does not replace content security, SIEM, DLP, or customer governance. It owns the pre-execution decision for routed actions and emits evidence that downstream systems can use.
## Policy model
Sector8 policy is modeled as **versioned policy sets, bound per tenant**. A tenant binding selects the policy version used by evaluate for that environment. Agent-scoped policy can add narrower controls for a specific agent or action.
Operators bind, suspend, resume, and review versioned policy sets through the control plane. The runtime gate enforces the active binding for routed actions and still applies baseline safety checks.
***
## Why pre-execution matters
| Enforcement point | Timing | Data / system exposure |
| ----------------------------- | ----------------------------------- | ------------------------------------------------------------- |
| **Sector8 gate** | Before the proposed action executes | None from that action because the side effect has not started |
| Output filters / model safety | After the model generates content | The model may already have seen sensitive input |
| SIEM / DLP | After network or tool activity | Data or action may already have moved |
| Audit logs alone | After execution | Detective only |
***
## Canonical decision artifact
Every evaluate path should converge on the same fields:
| Field | Meaning |
| ------------------- | ------------------------------------------------------------------------- |
| `decision` | `ALLOW` or `DENY` |
| `reason_code` | The machine-readable reason for the decision |
| `decision_trace_id` | Unique audit identifier for the evaluated action |
| `evidence_hash` | Fingerprint of the decision evidence for correlation and integrity checks |
| `policy_version_id` | The policy version or runtime policy identifier applied |
These fields are what you show in Decision Feed and Evidence. They are not a model-written explanation.
***
## Get started
Choose MCP, SDK, or REST and get your first decision.
Call evaluate from your application runtime.
Govern Claude Code tool calls routed through the Sector8 MCP connector.
***
## Check the gate
Use the endpoint issued for your environment.
```bash theme={null}
curl -s https://sdkapi.sector8.ai/api/health
```
Expect a healthy status with active invariants and gate capabilities before sending routed actions through the gate.
# The Seven Invariants
Source: https://docs.sector8.ai/guides/invariants
Foundational contracts for Sector8 evaluate-before-dispatch on routed integrations.
The seven invariants are the foundational contracts of the Sector8 gate. When your runtime routes proposed actions through Sector8, these properties define how evaluation and dispatch control should behave.
Violation on a routed path is a critical defect. Coverage still depends on the integration: unconnected tools and bypassed dispatch paths are not automatically covered.
The full invariants reference with implementation details is covered in the [Guardrails guide](/guides/guardrails#the-seven-invariants).
| # | Name | Contract |
| ----- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| INV-1 | Single Execution Gate | No authorized routed path from model output to tool execution that skips evaluation. The admission path is the dispatch control point. |
| INV-2 | Dual Gate Requirement | Policy decides intent. Authorization decides capability. Execution requires both. |
| INV-3 | Per-Step Enforcement | Evaluation runs per tool call, per agent step, after planning and before execution. |
| INV-4 | Untrusted Executor | The LLM produces candidates. The control plane decides outcomes. |
| INV-5 | Spotlighting Before Policy | Content is trust-tagged before evaluation. Untrusted content cannot self-promote. |
| INV-6 | Explicit Execution Condition | Execute only on an explicit `ALLOW` that your runtime honors. `DENY`, missing, or unknown decisions must not execute. On the MCP connector path, an unresolved human hold must not execute. |
| INV-7 | Trust Inversion Forbidden | No component consuming untrusted outputs may be the final authority to permit execution. |
## Runtime semantics
Honor the decision before dispatch on the routed path:
| Result | Runtime behavior |
| ------------------------- | ------------------------------- |
| `ALLOW` | May execute the proposed action |
| `DENY` | Must block the proposed action |
| Missing / unknown / error | Fail closed; do not execute |
On the MCP connector path, a borderline action can be held for a human before `ALLOW` or `DENY` is returned. Do not execute while that hold is unresolved. TTL expiry is a deny. REST evaluate does not wait.
Fail-closed applies when the action is routed through Sector8 and evaluation is unavailable or invalid. It does not stop actions on bypassed or unconfigured tool paths.
Sector8 returns the verdict. Your application owns enforcing it at the dispatch boundary.
See [Evaluate](/api-reference/evaluate), [Guardrails](/guides/guardrails), and [API Overview](/api-reference/overview).
# Guard MCP Server
Source: https://docs.sector8.ai/guides/mcp-server
Govern Claude Code tool calls routed through the sector8-guard MCP server with evaluate-before-dispatch decisions and fail-closed connector behavior.
## What it does
Sector8 governs Claude Code tool calls that are routed through the `sector8-guard` MCP server. Other MCP-compatible clients can use the same connector when they route tools the same way.
When a tool call is routed through `sector8-guard`, the caller-visible decision is `ALLOW` or `DENY`. On this connector path a borderline action can be held for a human before that decision is returned; if nobody answers, it is denied.
Coverage applies to tool calls routed through the connected Sector8 MCP server. Unconnected tools, direct shell access, and other agent paths are not automatically covered.
This is not a separate policy engine. The MCP server uses the same policy, reason-code, and evidence model as REST evaluate. The difference is that the connector can wait on a human before returning `ALLOW` or `DENY`. `POST /api/v1/evaluate` does not wait; it fails closed to `DENY`.
## Installation
Primary path after installing the SDK:
```bash theme={null}
pip install sector8-sdk
```
Then run:
```bash theme={null}
sector8-guard install
```
This writes `.claude/settings.json` for the current project and preserves existing
settings keys.
The installer writes a relative command entry that targets the checked-in MCP server
launcher from the repo root. On Windows it prefers the `.cmd` wrapper when present.
Manual fallback:
```json theme={null}
{
"mcpServers": {
"sector8-guard": {
"command": "python",
"args": ["sector8-backend/scripts/mcp_stdio_server.py"],
"env": {
"SECTOR8_API_KEY": "${SECTOR8_API_KEY}",
"SECTOR8_CLIENT_ID": "${SECTOR8_CLIENT_ID}"
}
}
}
}
```
On Windows, replace the args path with the `.cmd` wrapper if present:
```json theme={null}
{
"mcpServers": {
"sector8-guard": {
"command": "scripts/run_sector8_guard_mcp.cmd",
"args": []
}
}
}
```
## How it works
```text theme={null}
Claude Code tool call
(routed through sector8-guard)
|
v
Guard MCP Server
|
v
Sector8 evaluate
|- pre-filter
|- rate and multi-turn checks
|- tool registration and capability checks
|- BOLA and BFLA checks
|- semantic and segmented-input checks
|- request-risk checks
|
+----+----+
| |
v v
DENY ALLOW
| |
| +-- tool may execute
+-- tool does not execute
```
On this connector path, a borderline action can be held for a human before `ALLOW` or `DENY` is returned. If nobody answers, the connector denies. That hold is connector behaviour, not a third public `decision` value. REST evaluate does not wait.
Honor the returned decision before any side effect starts. Policy, telemetry, and decision evidence are unified with Sector8's runtime evidence model.
## Runtime semantics
| `decision` | Runtime behavior |
| ----------------- | ---------------------------------------------------- |
| `ALLOW` | The MCP connector may execute the proposed tool call |
| `DENY` | The MCP connector must block the proposed tool call |
| Missing / unknown | Fail closed on the connector path; do not execute |
Do not execute while a human hold is unresolved. TTL expiry is a deny.
### Fail-closed on evaluation failure
If the routed evaluate path is unavailable or returns an invalid decision while the tool call is going through `sector8-guard`, the connector should fail closed and not execute that call. Fail-closed applies to the connected MCP path; it does not stop actions on bypassed or unconfigured tool paths.
Returned denial may include:
* `reason_code: GUARD_INTERNAL_ERROR`
* non-empty `evidence_hash`
* `has_forensic_payload: true`
* `decision_trace_id`
* `policy_version_id`
### Decision evidence on deny
Denied MCP responses include the standard decision artifact:
* `decision`
* `reason_code`
* `evidence_hash`
* `has_forensic_payload`
* `decision_trace_id`
* `policy_version_id`
Exact `reason_code` and `policy_version_id` values depend on your active policy and environment.
### What is enforced on the MCP path
For tool calls routed through Sector8, admission checks include:
* tool registration
* capability checks
* object-level authorization (BOLA)
* function-level authorization (BFLA)
* semantic threat scoring
* segmented-input safety
* request-risk checks such as SSRF and sensitive path access
* admission rate limiting
## Governed tools
| Tool | What gets checked |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| `bash` | shell injection, destructive commands, obfuscated command payloads, rate limiting |
| `read_file` | sensitive paths, object ownership, authorization |
| `write_file` | content safety, authorization, object scoping |
| `web_fetch` | SSRF, private IP ranges, localhost, DNS resolution to private targets, unsupported schemes, URL credentials, external domain policy |
These tools are governed when the client routes them through `sector8-guard`. Connecting the MCP server does not automatically cover tools the agent can still call outside that path.
## `web_fetch` protections
`web_fetch` is not guarded by a simple hostname allowlist.
The current request-risk path blocks:
* raw private IP targets
* loopback and localhost
* link-local targets such as `169.254.169.254`
* DNS results that resolve to private IP space
* unsupported URL schemes
* URL credentials
* non-allowlisted external domains
This is designed to stop common SSRF paths, including cloud metadata access, on the governed MCP path.
## Example - blocked call
```json theme={null}
{
"decision": "DENY",
"tool_name": "bash",
"reason_code": "MCP_SHELL_INJECTION_BLOCKED",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"decision_trace_id": "32819155-d21a-49c8-9509-79338d980fa9",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
## Example - allowed call
```json theme={null}
{
"decision": "ALLOW",
"tool_name": "bash",
"reason_code": "ALLOW_PASS",
"evidence_hash": "4cb7f786d1f3b57e6f98f3e60d2eb6b81c402d6d3efeb6c9551049f7c14df2f0",
"has_forensic_payload": false,
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7",
"result": {
"stdout": "hello",
"stderr": "",
"exit_code": 0
}
}
```
## Verify the connection
Inside Claude Code:
```text theme={null}
/mcp
```
You should see `sector8-guard` as a connected server.
Then test one allow and one deny through the Sector8 MCP server:
```text theme={null}
Use the sector8-guard MCP server to run bash: echo hello
Use the sector8-guard MCP server to run bash: rm -rf /
```
Expected when those calls are routed through `sector8-guard`:
* `echo hello` -> `ALLOW`
* `rm -rf /` -> `DENY`
* unknown, missing, or unavailable evaluate results -> connector fails closed and does not execute that call
## Fleet deployment
Distribute `.claude/settings.json` through the repo or developer environment management so engineers connect `sector8-guard` consistently.
Coverage still depends on the client routing governed tool calls through that MCP server. Connecting the server does not cover unconnected tools or alternate execution paths.
## Non-MCP agents
MCP-compatible clients can use this connector. Non-MCP tool callers, including containerized Codex CLI integrations, should use the SDK adapter and `POST /api/v1/evaluate`.
See the [non-MCP integration guide](/guides/non-mcp-integration) for the container
pattern, required environment variables, and enforcement examples.
For the shared decision contract, see [Evaluate](/api-reference/evaluate) and [Guardrails](/guides/guardrails).
# Non-MCP integration
Source: https://docs.sector8.ai/guides/non-mcp-integration
Wire custom or containerized tool runtimes through POST /api/v1/evaluate and honor ALLOW or DENY before dispatch.
Non-MCP tool callers -- including containerized Codex CLI deployments -- use
`POST /api/v1/evaluate` as their enforcement gate. Place evaluate before local
tool dispatch for tools routed through this wrapper or container integration.
Sector8 returns the verdict. Your application owns honoring that decision at
dispatch time before any side effect starts.
This path uses the same admission and policy contract as the MCP connector. Coverage
applies only to tool calls your runtime routes through evaluate or the Sector8 adapter.
Unconnected tools, direct OS dispatch, and chat or completion content that never becomes a governed tool call are not automatically covered.
The container pattern can keep the base image unchanged and add Sector8 in your approved image layer. Your runtime still needs an evaluate-before-dispatch hook that enforces the decision.
## Prerequisites
* A Sector8 API key and client ID
* A container build or runtime path that you control
* A place in the tool caller where you can block dispatch on non-`ALLOW` decisions
* `pip` available in the container if you use the Python adapter
```bash theme={null}
export SECTOR8_API_URL="https://sdkapi.sector8.ai"
export SECTOR8_API_KEY="YOUR_API_KEY"
export SECTOR8_CLIENT_ID="YOUR_CLIENT_ID"
```
***
## Step 1 -- Add Sector8 to the container image
Install the SDK once in your approved base image:
```dockerfile theme={null}
FROM your-registry/codex-cli-base:latest
RUN pip install sector8-sdk
COPY sector8_policy.yaml /etc/sector8/policy.yaml
ENV SECTOR8_API_URL=https://sdkapi.sector8.ai
```
Do not bake credentials into the image. Inject them at runtime via the environment.
## Step 2 -- Set required environment variables
| Variable | Required | Purpose |
| ------------------- | -------- | ----------------------------------------------- |
| `SECTOR8_API_URL` | yes | Sector8 API base URL |
| `SECTOR8_API_KEY` | yes | tenant API key for `POST /api/v1/evaluate` |
| `SECTOR8_CLIENT_ID` | yes | tenant or client identifier |
| `CODEX_USER_ID` | yes | developer identity recorded with the decision |
| `CODEX_ROLE` | yes | authorization role, for example `developer` |
| `CODEX_SESSION_ID` | yes | per-session correlation and rate-limit identity |
## Step 3 -- Place evaluate before dispatch
For tools routed through this integration, replace direct tool dispatch with an
evaluate-before-dispatch hook. Sector8 decides; your runtime enforces.
Honor the decision exactly like this:
```python theme={null}
import os
import httpx
try:
response = httpx.post(
f"{os.environ['SECTOR8_API_URL']}/api/v1/evaluate",
headers={
"x-api-key": os.environ["SECTOR8_API_KEY"],
"x-client-id": os.environ["SECTOR8_CLIENT_ID"],
},
json={
"tool_name": "bash",
"arguments": {"command": cmd},
"caller_id": os.environ["CODEX_USER_ID"],
"role": os.environ.get("CODEX_ROLE", "developer"),
"session_id": os.environ["CODEX_SESSION_ID"],
"operation": "read",
},
timeout=10,
)
response.raise_for_status()
decision = response.json()
except Exception as exc:
print(f"Gate unavailable or invalid response; failing closed: {exc}")
raise SystemExit(1)
decision_value = decision.get("decision")
if decision_value == "ALLOW":
# Dispatch the tool call here.
pass
elif decision_value == "DENY":
print(f"Blocked before execution: {decision.get('reason_code')}")
else:
print(f"Unknown decision contract; failing closed: {decision}")
raise SystemExit(1)
```
| Result | Runtime must |
| ----------------------------------- | ------------------------------- |
| `ALLOW` | Dispatch only after this branch |
| `DENY` | Block; do not dispatch |
| Missing, unknown, or evaluate error | Fail closed; do not dispatch |
Optional adapter helper for the same routed path:
```python theme={null}
from sdk.adapters.openai_tools_adapter import OpenAIToolsAdapter, ToolBlockedError
import os
adapter = OpenAIToolsAdapter(
api_url=os.environ["SECTOR8_API_URL"],
api_key=os.environ["SECTOR8_API_KEY"],
client_id=os.environ["SECTOR8_CLIENT_ID"],
caller_id=os.environ["CODEX_USER_ID"],
role=os.environ.get("CODEX_ROLE", "developer"),
session_id=os.environ["CODEX_SESSION_ID"],
)
try:
result = adapter.execute(tool_name="bash", arguments={"command": cmd})
# Local dispatch happens only after ALLOW.
except ToolBlockedError as e:
print(f"Blocked before execution: {e.reason_code}")
print(f"Evidence hash: {e.evidence_hash}")
print(f"Trace ID: {e.decision_trace_id}")
```
If you use the adapter, still ensure missing, unknown, and evaluate failures do not dispatch. Sector8 returns the verdict; your application owns enforcement at the dispatch boundary.
Fail closed if evaluate fails, times out, or returns an unknown decision. Do not execute the proposed action by default. Fail-closed applies to tools routed through this integration; it does not stop actions on bypassed or unconfigured tool paths.
## Runtime semantics
| `decision` | Runtime behavior |
| ----------------- | ------------------------------------------------ |
| `ALLOW` | Your runtime may dispatch the proposed tool call |
| `DENY` | Your runtime must block the proposed tool call |
| Missing / unknown | Fail closed; do not execute |
## Success state
When correctly wired:
* Your runtime calls `/api/v1/evaluate` before local dispatch for tools routed through this integration
* Your application honors the decision at the dispatch boundary
* `ALLOW` actions may execute
* `DENY` actions are blocked before execution
* Unknown, missing, or failed evaluate results fail closed and do not execute
* Decision artifacts include `reason_code`, `decision_trace_id`, `evidence_hash`, and `policy_version_id`
## Evaluation response schema
```json theme={null}
{
"decision": "ALLOW|DENY",
"reason_code": "ALLOW_PASS",
"evidence_hash": "",
"has_forensic_payload": false,
"decision_trace_id": "uuid",
"policy_version_id": "string"
}
```
Exact `reason_code` and `policy_version_id` values depend on your active policy and environment. See [Evaluate](/api-reference/evaluate) for the full contract.
## Example -- blocked call
```json theme={null}
{
"decision": "DENY",
"reason_code": "PRIVATE_IP_BLOCKED",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"decision_trace_id": "32819155-d21a-49c8-9509-79338d980fa9",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
## Example -- allowed call
```json theme={null}
{
"decision": "ALLOW",
"reason_code": "ALLOW_PASS",
"evidence_hash": "4cb7f786d1f3b57e6f98f3e60d2eb6b81c402d6d3efeb6c9551049f7c14df2f0",
"has_forensic_payload": false,
"decision_trace_id": "74dc8812-2cd7-4c0d-bfcb-98438a57fcb3",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
## Gotchas
* **`session_id` is required for rate limiting.** A missing or static `session_id` will cause all requests to share a rate limit bucket.
* **`owned_objects` must list what the caller actually owns.** BOLA checks compare `object_id` against this list -- an empty list means every object-level request is denied.
* **Do not cache `ALLOW` decisions.** Evaluate every call independently. A cached `ALLOW` is not a security property.
* **Do not treat adapter install as full coverage.** Only tool calls that go through evaluate or the adapter are governed.
## Honest scope
This path governs tool calls that route through evaluate or the adapter. It does not govern:
* inline completions or chat content that never becomes a governed tool call
* tools the runtime can still dispatch without calling evaluate
* bypassed or unconfigured execution paths
For MCP-connected Claude Code tooling, see the [Guard MCP Server](/guides/mcp-server). For the shared decision contract, see [Evaluate](/api-reference/evaluate) and [Guardrails](/guides/guardrails).
# Observe then enforce
Source: https://docs.sector8.ai/guides/observe-then-enforce
Pilot path from evaluation-only observation to fail-closed enforcement, using verified SDK helpers.
# Observe then enforce
Complete the linear path in [Onboarding](/guides/onboard) first. This page explains mode concepts; the refund walkthrough in onboarding step 6 is the concrete proof.
Pilots usually start by **observing** evaluate decisions without changing dispatch, then move to **enforce** where only `ALLOW` may run. This guide documents both modes against verified SDK helpers.
Existing customer protections outside Sector8 remain in force during observe. Sector8 does not claim a one-click “enforcement off” switch or an automated gap-report SKU.
## Modes
| Mode | Behavior | Proves |
| ------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------- |
| **Evaluation-only** | Call evaluate, record the artifact, **never** dispatch | Evaluation + artifact recording |
| **Observe (live)** | Call evaluate; **continue the normal business workflow** on DENY, timeout, or evaluate failure | Observation does not break the partner path |
| **Enforce** | Dispatch **only** on a valid `ALLOW`; zero dispatch otherwise | Prevention |
An evaluation-only example that never dispatches does **not** prove a live observe integration. Readiness needs a verified observation test where the business path still completes when evaluate returns DENY, times out, or fails.
## Verified helpers
These helpers are covered by unit proofs in the SDKs:
| SDK | Helpers | Proofs |
| ---------- | --------------------------------------------------------------------- | --------------------- |
| TypeScript | `shouldDispatch`, `honorEnforceDecision`, `honorObserveDecision` | `tests/pilot.test.ts` |
| Python | `should_dispatch`, `honor_enforce_decision`, `honor_observe_decision` | `tests/test_pilot.py` |
Examples:
* TypeScript: `examples/pilot-evaluation-only.ts`, `examples/pilot-enforce-stub.ts`, `examples/PILOT.md`
* Python: `examples/PILOT.md`
## Enforce: fail closed beyond DENY
In enforce mode, do **not** dispatch when evaluate returns or fails as:
* `DENY`
* Timeout
* Authentication failure (401/403)
* Malformed response
* Unknown / missing outcome
`ALLOW` with a complete decision artifact → exactly one dispatch (or your agreed stub behavior).
### TypeScript
```typescript theme={null}
import {
classifyEvaluateError,
honorEnforceDecision,
normalizeEvaluateResponse,
} from '@sector8/sdk';
let attempt;
try {
const raw = await client.evaluate({
tool_name: 'orders.refund',
arguments: { amount: 25 },
});
attempt = normalizeEvaluateResponse(raw);
} catch (error) {
attempt = { ok: false, kind: classifyEvaluateError(error) };
}
const { dispatched } = honorEnforceDecision(attempt, () => {
// Side effect runs only on ALLOW.
return runRefund();
});
```
### Python
```python theme={null}
from sector8 import (
classify_evaluate_error,
honor_enforce_decision,
normalize_evaluate_response,
)
try:
raw = await client.evaluate(tool_name="orders.refund", arguments={"amount": 25})
attempt = normalize_evaluate_response(raw)
except Exception as exc:
attempt = {"ok": False, "kind": classify_evaluate_error(exc)}
result = honor_enforce_decision(attempt, run_refund)
```
## Observe: continue on failure
Use observe when you need evaluate visibility without blocking the partner workflow yet.
```typescript theme={null}
import { honorObserveDecision, normalizeEvaluateResponse } from '@sector8/sdk';
const attempt = normalizeEvaluateResponse(await client.evaluate({ /* ... */ }));
honorObserveDecision(attempt, () => {
// Business path continues even if attempt is DENY or a classified failure.
return continueNormalWorkflow();
});
```
Observation failure behavior: if evaluate times out, returns 401, returns a malformed body, or the gate is unreachable, **observe mode still continues the workflow**. Record the failure for the pilot report. Do not treat “continued” as “allowed by Sector8.”
## Evidence after evaluate
Every decision should carry:
* `outcome` (`ALLOW` / `DENY`)
* `reason_code`
* `decision_trace_id`
* `evidence_hash`
* `policy_version_id`
After a fresh evaluate, look up the same `decision_trace_id` in the Decision Feed (tenant-scoped retrieve) to confirm the feed matches the response artifact. Missing or cross-tenant traces return the same not-found result.
## Move to enforce
1. Confirm observe does not break the partner path on DENY / timeout / error.
2. Flip the honor path to `honorEnforceDecision` / `honor_enforce_decision`.
3. Re-run ALLOW (dispatches once) and DENY / failure classes (zero dispatch).
4. Keep recording `decision_trace_id` values for the pilot report.
## Related
* [Quickstart](/guides/quickstart)
* [Python SDK](/guides/python-sdk)
* [TypeScript SDK](/guides/typescript-sdk)
* [Evaluate API](/api-reference/evaluate)
# Onboarding
Source: https://docs.sector8.ai/guides/onboard
One guided journey from published packages to ALLOW, DENY, evidence lookup, and observe/enforce proofs.
This is the **only Start-here linear path**. Complete every step below with published packages and credentials issued to you. Do not treat health checks, telemetry, or a single `ALLOW` as onboarding success.
**You will:**
1. Install and authenticate
2. Produce expected `ALLOW` and `DENY`
3. Retrieve matching decision evidence
4. Verify observation continues on `DENY` / evaluation failure
5. Verify enforcement dispatches only on `ALLOW`
Latency budgets and concurrency limits are **out of scope** for this journey. Completing onboarding does not certify pilot kickoff performance.
## What you need
* Runtime credentials issued by Sector8 Operator / support (`SECTOR8_API_KEY`, `SECTOR8_CLIENT_ID`) — **shell environment only**. Never paste keys into chat, tickets, or source control.
* Separately provisioned **dashboard** access (browser session) for Decision Feed. The runtime key is **not** authority for dashboard APIs.
* Python 3.10+ **or** Node.js 18+
* The public example bundle below. No GitHub account or repository access is needed.
No credentials yet? Contact [support@sector8.ai](mailto:support@sector8.ai) or [book a demo](https://sector8.ai/contact). Do not borrow another tenant’s key.
## Public example bundles
Choose one language. Each versioned JSON download contains three scripts that use the published **1.0.4** SDK. Step 3 saves them into your new project directory without overwriting existing files.
* [TypeScript examples v1](/downloads/onboarding/v1/typescript.json)
* [Python examples v1](/downloads/onboarding/v1/python.json)
These examples simulate refund dispatch; they never move money. The refund cap is a narrow fixture that Sector8 must bind to your issued tenant before live verification.
## Environment variables
Both language paths accept `SECTOR8_ENDPOINT` or `SECTOR8_BASE_URL`; set only one. Use the endpoint issued with your credentials. The default is `https://sdkapi.sector8.ai`. A separately issued non-default endpoint requires an explicit opt-in before credential use:
| Variable | Required when |
| ---------------------------------------- | -------------------------------------------------------------------- |
| `SECTOR8_API_KEY` | Always for live runs |
| `SECTOR8_CLIENT_ID` | Always for live runs |
| `SECTOR8_ENDPOINT` or `SECTOR8_BASE_URL` | Only for an issued non-default endpoint |
| `SECTOR8_UNSAFE_ENDPOINT=true` | Any non-default host (including staging) for **both** language paths |
```bash theme={null}
# bash
export SECTOR8_API_KEY="YOUR_API_KEY"
export SECTOR8_CLIENT_ID="YOUR_CLIENT_ID"
export SECTOR8_ENDPOINT="https://sdkapi.sector8.ai"
# Only for an issued non-default endpoint: export SECTOR8_UNSAFE_ENDPOINT=true
```
```powershell theme={null}
# PowerShell
$env:SECTOR8_API_KEY = "YOUR_API_KEY"
$env:SECTOR8_CLIENT_ID = "YOUR_CLIENT_ID"
$env:SECTOR8_ENDPOINT = "https://sdkapi.sector8.ai"
# Only for an issued non-default endpoint: $env:SECTOR8_UNSAFE_ENDPOINT = "true"
```
Local `.env` files are fine if gitignored. Neither walkthrough auto-loads dotenv — export vars in the shell (or `Get-Content .env` patterns you already use) before running.
## Journey
Inject issued credentials through your shell (bash or PowerShell above). Never paste keys into chat.
Choose one language and start in a new directory.
**Python (bash)**
```bash theme={null}
mkdir s8-onboard
cd s8-onboard
python -m venv .venv
source .venv/bin/activate
python -m pip install sector8-sdk==1.0.4
```
**Python (PowerShell)**
```powershell theme={null}
mkdir s8-onboard
cd s8-onboard
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install sector8-sdk==1.0.4
```
**TypeScript**
```bash theme={null}
mkdir s8-onboard
cd s8-onboard
npm init -y
npm install @sector8/sdk@1.0.4
```
Run the commands for your language and shell in the directory from step 2. Downloads require no credentials. The extraction command refuses to overwrite existing example files; use a fresh directory for a retest.
**Typescript (bash)**
```bash theme={null}
curl -fsSL -o typescript.json https://sector8.mintlify.app/downloads/onboarding/v1/typescript.json
node -e "const fs=require('node:fs'); const b=JSON.parse(fs.readFileSync('typescript.json','utf8')); for(const n of ['onboarding-verify.js','refund-pilot-core.js','refund-pilot-walkthrough.js']) fs.writeFileSync(n,b.files[n],{flag:'wx'});"
```
**Typescript (powershell)**
```powershell theme={null}
Invoke-WebRequest -UseBasicParsing -OutFile typescript.json https://sector8.mintlify.app/downloads/onboarding/v1/typescript.json
node -e "const fs=require('node:fs'); const b=JSON.parse(fs.readFileSync('typescript.json','utf8')); for(const n of ['onboarding-verify.js','refund-pilot-core.js','refund-pilot-walkthrough.js']) fs.writeFileSync(n,b.files[n],{flag:'wx'});"
```
**Python (bash)**
```bash theme={null}
curl -fsSL -o python.json https://sector8.mintlify.app/downloads/onboarding/v1/python.json
python -c "import json,pathlib; b=json.loads(pathlib.Path('python.json').read_text(encoding='utf-8')); names=('onboarding_verify.py','refund_pilot_core.py','refund_pilot_walkthrough.py'); [pathlib.Path(n).open('x',encoding='utf-8').write(b['files'][n]) for n in names]"
```
**Python (powershell)**
```powershell theme={null}
Invoke-WebRequest -UseBasicParsing -OutFile python.json https://sector8.mintlify.app/downloads/onboarding/v1/python.json
python -c "import json,pathlib; b=json.loads(pathlib.Path('python.json').read_text(encoding='utf-8')); names=('onboarding_verify.py','refund_pilot_core.py','refund_pilot_walkthrough.py'); [pathlib.Path(n).open('x',encoding='utf-8').write(b['files'][n]) for n in names]"
```
```bash theme={null}
curl -fsS https://sdkapi.sector8.ai/api/health
```
For an issued non-default endpoint, use that endpoint with `/api/health`. In PowerShell, use `curl.exe`. If health fails, stop. Do not route live actions.
Use the downloaded verifiers — they print `outcome`, `reason_code`, `decision_trace_id`, `evidence_hash`, and `policy_version_id` for Decision Feed comparison.
**Python**
```bash theme={null}
python onboarding_verify.py
```
**TypeScript**
```bash theme={null}
node onboarding-verify.js
```
These scripts import the **published** packages only (`sector8-sdk` / `@sector8/sdk`). They do not require a repository `dist/` or `src/` tree.
The package CLI `sector8-verify` still prints traces only. Prefer `onboarding_verify.py` / `onboarding-verify.js` for full-field proof.
Evaluate timeouts that are too aggressive can fail-close safe traffic. Prefer the SDK defaults unless your Operator gives a specific timeout for your path. This page does **not** define a product latency budget.
1. Open your issued dashboard and go to **Decisions**.
2. Use **Verify** / lookup with each `decision_trace_id` from step 5.
3. Confirm matching `outcome`, `reason_code`, `policy_version_id`, and `evidence_hash` against the JSON printed by the verifier.
Dashboard login is a **session cookie**. Do not send the runtime API key to dashboard APIs.
Offline (no credentials) — proves helper dispatch effects only. Simulated trace IDs have **no** Decision Feed row — do not look them up.
```bash theme={null}
# Python
python refund_pilot_walkthrough.py --offline
# TypeScript
node refund-pilot-walkthrough.js --offline
```
Live verification (Operator-issued key + Refund Agent fixture bound for your tenant):
```bash theme={null}
# Python
python refund_pilot_walkthrough.py
# TypeScript
node refund-pilot-walkthrough.js
```
Fixture defaults (confirm with Operator): cap **100 GBP**, under **25**, over **250**, agent `Refund Agent`, expect over-cap `DENY` / `AMOUNT_LIMIT_EXCEEDED`.
| Mode | What must be true |
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
| **Enforce** | Valid `ALLOW` → exactly one **fake** refund dispatch; `DENY` / timeout / auth / malformed → **zero** dispatches |
| **Observe** | Workflow **continues** once even on `DENY` or evaluation failure; report `decision` separately from `dispatched` |
Live mode **fails closed** when expected outcomes are missing (network failure, wrong verdict, or wrong reason). Fake refunds never move money. Wrong fixture binding is a **mismatch**, not success. Copy **LIVE** `decision_trace_id` values back into Decision Feed Verify.
* [ ] Published `1.0.4` packages installed in a clean environment
* [ ] Public v1 example bundle downloaded and extracted (no local edits)
* [ ] Credentials only via shell environment
* [ ] Verifier produced `ALLOW` + `DENY` with full artifact fields
* [ ] Both traces retrieved in Decision Feed and fields matched
* [ ] Observe proof: continuation on DENY / failure
* [ ] Enforce proof: dispatch only on ALLOW
* [ ] No founder undocumented steps required
You are onboarded when this checklist is complete for your language path.
## Reference only (not alternate start pages)
* [Quickstart](/guides/quickstart) — short install snippets
* [Observe then enforce](/guides/observe-then-enforce) — mode concepts behind step 7
* [Python SDK](/guides/python-sdk) / [TypeScript SDK](/guides/typescript-sdk) — API detail
* [Evaluate API](/api-reference/evaluate)
* Assistant setup companion: [guides/onboard-assistant](/guides/onboard-assistant)
## Common mistakes
* Omitting `SECTOR8_UNSAFE_ENDPOINT=true` for staging on TypeScript or Python examples
* Pasting runtime keys into chat or committing them
* Using the runtime key against dashboard APIs
* Treating `--offline` helper proofs as live gate evidence
* Looking up simulated trace IDs in Decision Feed
* Using a repository checkout instead of the public v1 bundle
* Claiming observation “had zero impact” on a real production workflow
* Branching only on `reason_code` instead of `outcome` / `decision` for enforce
# Onboarding assistant companion
Source: https://docs.sector8.ai/guides/onboard-assistant
Setup-assistant instructions that follow the same onboarding journey and success criteria as guides/onboard.
This page is for **assistants helping a customer set up Sector8**. It is not an instruction set for agents reviewing Sector8 pull requests, and it must not invent credentials, bypass Operator issuance, or edit the customer’s production systems without explicit permission.
Follow [Onboarding](/guides/onboard) in order. Same success criteria. Do not skip evidence lookup or observe/enforce proofs.
## Permission boundaries
**Allowed**
* Read published Mintlify docs and the versioned public example bundles linked from Onboarding
* Help create a local venv / npm project
* Help set **names** of environment variables (never ask the user to paste secret values into chat)
* Run non-secret commands the user approves (`sector8-verify --help`, health curl, `--offline` walkthrough)
* Compare redacted trace IDs the user pastes from their own terminal
**Forbidden**
* Requesting or storing `SECTOR8_API_KEY` values in chat logs
* Using founder private notes, monorepo checkouts, or unpublished packages
* Calling dashboard APIs with the runtime key
* Changing production policy, rate limits, or another tenant’s fixtures
* Declaring onboarding complete without Decision Feed verification
## Safe file handling
* Prefer new directories (`s8-onboard/`, fresh venv).
* If editing an existing app, ask before modifying files; keep secrets out of diffs.
* Do not commit `.env` files.
## Deterministic completion checklist
Mark complete only when the user confirms each item:
1. `sector8-sdk==1.0.4` or `@sector8/sdk@1.0.4` installed cleanly
2. Public v1 example bundle downloaded and extracted from [Onboarding](/guides/onboard), without a repository checkout
3. Health endpoint reachable for their issued environment
4. `onboarding_verify.py` / `onboarding-verify.js` printed ALLOW + DENY with full artifact fields
5. Both traces verified in Decision Feed (dashboard session)
6. Refund walkthrough offline proofs and live fixture proofs passed without mismatch
7. Enforce: zero dispatch on non-ALLOW; Observe: continued on DENY/failure
If any step needs undocumented founder help, record it as an onboarding failure and fix the published guide/example — then retry from a clean environment.
# Python SDK
Source: https://docs.sector8.ai/guides/python-sdk
Use the Python SDK to evaluate proposed actions before dispatch, then optionally send telemetry.
Use this path when your Python application should ask Sector8 whether a proposed action may execute, then honor the returned decision before local dispatch.
Telemetry helpers are available on the same client. Telemetry alone is not enforcement.
Enforcement requires your runtime to call `evaluate` before dispatch and honor the result. Unconnected tool paths are not automatically covered.
## Prerequisites
* Python 3.10 or later
* `SECTOR8_API_KEY`
* `SECTOR8_CLIENT_ID`
* A runtime path where you can block dispatch and fail closed on errors
## Install the SDK
```bash theme={null}
pip install sector8-sdk
```
Source repository: `https://github.com/sector8-ai/sector8-sdk-python`
## Set your credentials
```bash theme={null}
export SECTOR8_API_KEY=your_api_key
export SECTOR8_CLIENT_ID=your_client_id
```
Public examples use the production host. Use the endpoint and credentials issued for your environment.
## Evaluate before dispatch
```python theme={null}
import asyncio
import os
import sector8
async def main():
client = sector8.setup(
api_key=os.environ["SECTOR8_API_KEY"],
client_id=os.environ["SECTOR8_CLIENT_ID"],
)
try:
decision = await client.evaluate(
"bash",
{"command": "cat .env"},
caller_id="python-sdk-agent",
role="developer",
session_id="python-sdk-session",
operation="read",
)
if decision.outcome == "ALLOW":
# Dispatch the tool call here.
print("ALLOW", decision.reason_code, decision.decision_trace_id)
elif decision.outcome == "DENY":
print("Blocked before execution:", decision.reason_code)
print("Evidence hash:", decision.evidence_hash)
print("Trace ID:", decision.decision_trace_id)
else:
print("Unknown decision contract; failing closed:", decision)
# Do not dispatch.
except Exception as exc:
print(f"Gate unavailable or invalid response; failing closed: {exc}")
# Do not dispatch.
finally:
await client.close()
asyncio.run(main())
```
Sector8 returns the verdict. Your application owns honoring that decision at dispatch time.
REST `/api/v1/evaluate` responses use the field `decision`. This SDK exposes the same value as `outcome`. Check for `ALLOW` the same way either way.
| Result | Runtime must |
| --------------------------------------- | ---------------------------- |
| `ALLOW` (`decision.outcome == "ALLOW"`) | May dispatch |
| `DENY` | Block; do not dispatch |
| Missing, unknown, error, or timeout | Fail closed; do not dispatch |
Never execute an action unless `decision.outcome == "ALLOW"`. Fail closed on evaluate errors. Fail-closed applies to tools routed through this SDK path; it does not stop bypassed or unconfigured tool paths.
See [Evaluate](/api-reference/evaluate) for the shared `ALLOW | DENY` contract and [Non-MCP integration](/guides/non-mcp-integration) for custom runtime wiring.
## Optional: send telemetry
Telemetry records what happened. It does not replace evaluate-before-dispatch.
```python theme={null}
import asyncio
import os
import sector8
async def main():
client = sector8.setup(
api_key=os.environ["SECTOR8_API_KEY"],
client_id=os.environ["SECTOR8_CLIENT_ID"],
debug=True,
)
result = await client.save_telemetry(
provider="openai",
model="gpt-4",
prompt="Sector8 Python SDK telemetry test",
completion="Telemetry sent successfully",
tokens_used=24,
latency_ms=120,
cost=0.001,
success=True,
metadata={"source": "python-sdk-onboard"},
)
print(result["status"])
await client.close()
asyncio.run(main())
```
Short helper:
```python theme={null}
import sector8
client = sector8.setup(
api_key="your_api_key",
client_id="your_client_id",
)
client.log_llm_call("openai", "gpt-4", tokens=150, cost=0.003)
```
The Python SDK defaults to `https://sdkapi.sector8.ai`. Override `base_url` only when targeting a non-default environment you intentionally control.
## Verify the integration
1. Check health:
```bash theme={null}
curl https://sdkapi.sector8.ai/api/health
```
2. Confirm an `evaluate` call returns a decision artifact
3. Confirm your runtime dispatches only on `ALLOW` and fails closed on unknown/error
4. Optionally confirm telemetry appears in Sector8 if you send it
You are done when your Python runtime evaluates before dispatch, blocks on `DENY`, and fails closed on missing/unknown/error responses.
## Common mistakes
* Logging telemetry without calling `evaluate` before tool dispatch
* Dispatching on any non-error response instead of checking `decision.outcome == "ALLOW"`
* Missing `SECTOR8_CLIENT_ID`
* Overriding `base_url` to an older host by accident
## Next steps
* [Quickstart](/guides/quickstart)
* [Non-MCP integration](/guides/non-mcp-integration)
* [Guard MCP Server](/guides/mcp-server)
* [Evaluate API](/api-reference/evaluate)
# Quickstart
Source: https://docs.sector8.ai/guides/quickstart
Route your first proposed AI action through Sector8 and honor the returned decision.
# Quickstart
For the full unassisted journey (install → ALLOW/DENY → evidence → observe/enforce), start at [Onboarding](/guides/onboard). This page is a short reference.
This guide gets you to the first important proof point: your application asks Sector8 whether a proposed AI action may execute, then your runtime honors the returned decision.
Use the endpoint and credentials issued for your environment.
## Prerequisites
* A Sector8 `x-api-key`
* A Sector8 `x-client-id`
* The base URL for your environment
* A runtime path where you can block execution when Sector8 returns `DENY`
```bash theme={null}
export SECTOR8_BASE_URL="https://sdkapi.sector8.ai"
export SECTOR8_API_KEY="YOUR_API_KEY"
export SECTOR8_CLIENT_ID="YOUR_CLIENT_ID"
```
Replace `SECTOR8_BASE_URL` with the endpoint issued to your environment when it differs from the public production example.
***
## Step 1: Check the gate
Confirm the endpoint is healthy before routing actions through it.
```bash theme={null}
curl -s "$SECTOR8_BASE_URL/api/health"
```
Expect a healthy response with active invariants and gate capabilities. If this check fails, do not route live actions until the endpoint is reachable.
***
## Step 2: Prove DENY and ALLOW
Send the action you are about to execute to Sector8 first. Use one known-blocked action and one safe action so your runtime proves both sides of the contract.
### DENY proof
```bash theme={null}
curl -s "$SECTOR8_BASE_URL/api/v1/evaluate" \
-H "x-api-key: $SECTOR8_API_KEY" \
-H "x-client-id: $SECTOR8_CLIENT_ID" \
-H "content-type: application/json" \
-d '{
"tool_name": "bash",
"arguments": {
"command": "cat .env"
},
"caller_id": "quickstart-agent",
"role": "developer",
"session_id": "quickstart-session-deny",
"operation": "read"
}'
```
You should receive a decision artifact like:
```json theme={null}
{
"decision": "DENY",
"reason_code": "SENSITIVE_PATH_BLOCKED",
"evidence_hash": "bdbde1558fb883573b0f6e8630ccba1edaf6bed8cb035fa6a48912809149f287",
"has_forensic_payload": true,
"decision_trace_id": "32819155-d21a-49c8-9509-79338d980fa9",
"policy_version_id": "5d61927dcac73a97e9e3c7ee0dbca364d66447469637bafa2282e635124fcb99"
}
```
Your runtime must not dispatch this action.
Branch on `decision`, not on a specific `reason_code`. The same unsafe command may return different reason codes depending on which policy layer blocks it.
### ALLOW proof
```bash theme={null}
curl -s "$SECTOR8_BASE_URL/api/v1/evaluate" \
-H "x-api-key: $SECTOR8_API_KEY" \
-H "x-client-id: $SECTOR8_CLIENT_ID" \
-H "content-type: application/json" \
-d '{
"tool_name": "bash",
"arguments": {
"command": "echo hello"
},
"caller_id": "quickstart-agent",
"role": "developer",
"session_id": "quickstart-session-allow",
"operation": "read"
}'
```
You should receive a decision artifact like:
```json theme={null}
{
"decision": "ALLOW",
"reason_code": "ALLOW_PASS",
"evidence_hash": "4cb7f786d1f3b57e6f98f3e60d2eb6b81c402d6d3efeb6c9551049f7c14df2f0",
"has_forensic_payload": false,
"decision_trace_id": "17e797c0-eb5c-4f97-b4a1-2d3e4f5a6b7c",
"policy_version_id": "0dbca364d66447469637bafa2282e635124fcb99eecd6383038e3b652577ebc7"
}
```
Your runtime may dispatch only after this `ALLOW`.
`reason_code` and `policy_version_id` are opaque support/evidence identifiers. Do not build exhaustive dispatch logic on them. Treat `policy_version_id` as a non-empty policy identifier — it may be a binding hash or a runtime version label depending on the evaluation path. REST responses use the field `decision`. Some SDKs expose the same value as `outcome` — check for `ALLOW` the same way either way.
***
## Step 3: Honor the decision
Your application must only dispatch the proposed action when Sector8 allows it.
```python theme={null}
import os
import httpx
try:
response = httpx.post(
f"{os.environ['SECTOR8_BASE_URL']}/api/v1/evaluate",
headers={
"x-api-key": os.environ["SECTOR8_API_KEY"],
"x-client-id": os.environ["SECTOR8_CLIENT_ID"],
},
json={
"tool_name": "bash",
"arguments": {"command": "cat .env"},
"caller_id": "quickstart-agent",
"role": "developer",
"session_id": "quickstart-session",
"operation": "read",
},
timeout=10.0, # recommended default; fail-closed on timeout
)
response.raise_for_status()
decision = response.json()
except Exception as exc:
print(f"Gate unavailable or invalid response; failing closed: {exc}")
raise SystemExit(1)
# REST uses `decision`. Some SDKs expose the same value as `outcome`.
decision_value = decision.get("decision") or decision.get("outcome")
if decision_value == "ALLOW":
# Dispatch the tool call here.
pass
elif decision_value == "DENY":
print(f"Blocked before execution: {decision.get('reason_code')}")
print(f"Evidence hash: {decision.get('evidence_hash')}")
else:
print(f"Unknown decision contract; failing closed: {decision}")
raise SystemExit(1)
```
Fail closed if the evaluate call fails, times out, or returns an unknown decision. Do not execute the proposed action by default.
Set an evaluate client timeout of **at least 10 seconds** (10s is a safe default for most apps). Observed evaluate latency is commonly about 1–4 seconds on the public production host, but slower environments and cold paths can take longer. An aggressive 1–2s timeout will fail closed on legitimate `ALLOW` traffic and block your own safe actions.
REST field: `decision`. SDK field: often `outcome`. Both carry `ALLOW` or `DENY` for synchronous evaluate. Dispatch only on `ALLOW`.
***
## Choose your integration path
Govern Claude Code and MCP-connected tool calls with a runtime connector.
Add Sector8 to Python applications and services.
Add Sector8 to Node.js and TypeScript applications.
If your runtime dispatches tools directly, use the [REST evaluate API](/api-reference/evaluate) or the [non-MCP integration guide](/guides/non-mcp-integration).
***
## What success looks like
You are done when:
* The health endpoint is reachable for your environment
* Your runtime calls `/api/v1/evaluate` before dispatching the action
* `ALLOW` actions may execute
* `DENY` actions are blocked before execution
* Unknown or missing decisions fail closed and do not execute
* Decision artifacts include `reason_code`, `decision_trace_id`, `evidence_hash`, and `policy_version_id`
The key integration rule is simple: the agent proposes, Sector8 decides, and your runtime honors the decision before side effects start.
# Red teaming
Source: https://docs.sector8.ai/guides/red-teaming
Test the live Sector8 contract: routed action, expected decision, evidence fields, and fail-closed behavior.
Sector8 red teams the execution boundary itself: whether a routed agent action receives the expected `ALLOW` or `DENY` decision before side effects start, plus review behavior on review-enabled guard paths.
Every AI security tool tests what your model says. Sector8 tests what your agents can do on paths routed through the gate.
## The challenge
A prompt-only assessment does not tell you what happens when an agent can read files, call tools, hit APIs, or operate across business systems.
Once an agent has tool access, the real risk is data access, cross-scope reads, shell misuse, SSRF, and policy bypass on ungoverned paths.
They test prompts and responses. They do not test the evaluate-before-dispatch contract where business risk actually happens.
## Sector8's approach
Red team the real integration contract:
1. Route a proposed action through Sector8
2. Expect a specific decision (`ALLOW` or `DENY`) or a review pause on review-enabled guard paths
3. Confirm evidence fields are present
4. Confirm the runtime honors the decision and fails closed on unknown/error
What that means in practice:
* test real tool, SDK, REST evaluate, and MCP-connected paths
* test authorization and ownership failures
* test whether a routed agent can exfiltrate data, cross tenant boundaries, hit private infrastructure, or violate policy before execution
* confirm unconnected paths are treated as out of coverage, not assumed protected
The goal is not only to prove that a model can say something risky. The goal is to prove whether a routed agent action is decided and honored correctly before execution.
## How red teaming works
Test tool use, file access, web access, shell actions, MCP servers, and cross-system agent behavior on the paths you actually route through Sector8.
Probe the decision point that determines whether the agent may act, not only what the model says.
For each case, record:
| Check | Pass condition |
| ----------------- | ------------------------------------------------------------------------------------------------ |
| Routed action | Proposed action went through evaluate or the Sector8 connector |
| Expected decision | `ALLOW` or `DENY` matched the case design; review-enabled paths paused when expected |
| Evidence fields | `reason_code`, `decision_trace_id`, `evidence_hash`, and `policy_version_id` present as expected |
| Runtime honor | App dispatched only on `ALLOW`; blocked on `DENY`; review-enabled paths paused when expected |
| Fail-closed | Missing, unknown, error, or timeout did not execute |
Turn findings into deny reasons, review policies, alert signatures, traces, and enforcement improvements.
## What Sector8 tests
| Area | What gets tested |
| ----------------------- | ---------------------------------------------------------------------------------------------------------- |
| Tool execution | whether the agent can invoke the wrong tool or invoke the right tool in the wrong context on a routed path |
| Ownership and scope | cross-tenant reads, BOLA, BFLA, and unauthorized object access |
| Request risk | SSRF, private IP access, external-domain misuse, shell injection, obfuscated payloads |
| Sensitive data movement | PII, PHI, and policy-protected data before execution |
| MCP and agent workflows | whether real multi-step agent paths create unsafe action sequences |
| Fail-closed behavior | whether evaluate unavailability or unknown decisions prevent dispatch |
## Why this is different
Test prompts and outputs, then report what the model said or might have said.
Tests whether the routed execution boundary returns the expected decision and whether the runtime honors it before side effects start.
## Stronger together
Sector8 red teaming is not a separate reporting surface. It validates the live gate contract.
* red teaming validates whether dangerous routed actions are denied or sent to review before execution
* runtime protection improves as findings become deny paths, review rules, and policy updates
* telemetry and framework mappings stay grounded in what was actually exploitable on governed paths
See related guides:
* [Guardrails](/guides/guardrails)
* [Evaluate](/api-reference/evaluate)
* [Compliance overview](/guides/compliance)
* [EU AI Act](/guides/eu-ai-act)
Red teaming is complete when you can show a routed action, the expected decision, the evidence fields, runtime honor behavior, and fail-closed handling -- not only that a prompt looked risky.
# TypeScript SDK
Source: https://docs.sector8.ai/guides/typescript-sdk
Use the TypeScript SDK to evaluate proposed actions before dispatch, then optionally send telemetry.
Use this path when your Node.js or TypeScript application should ask Sector8 whether a proposed action may execute, then honor the returned decision before local dispatch.
Telemetry helpers are available on the same client. Telemetry alone is not enforcement.
Enforcement requires your runtime to call `evaluate` before dispatch and honor the result. Unconnected tool paths are not automatically covered.
## Prerequisites
* Node.js 18 or later
* `SECTOR8_API_KEY`
* `SECTOR8_CLIENT_ID`
* A runtime path where you can block dispatch and fail closed on errors
## Install the SDK
```bash theme={null}
npm install @sector8/sdk
```
Source repository: `https://github.com/sector8-ai/sector8-sdk-typescript`
## Set your credentials
```bash theme={null}
export SECTOR8_API_KEY=your_api_key
export SECTOR8_CLIENT_ID=your_client_id
```
Public examples use the production host. Use the endpoint and credentials issued for your environment.
## Evaluate before dispatch
```typescript theme={null}
import sector8 from '@sector8/sdk';
async function main() {
const client = sector8.setup({
apiKey: process.env.SECTOR8_API_KEY!,
clientId: process.env.SECTOR8_CLIENT_ID!,
});
try {
const decision = await client.evaluate({
tool_name: 'bash',
arguments: { command: 'cat .env' },
caller_id: 'typescript-sdk-agent',
role: 'developer',
session_id: 'typescript-sdk-session',
});
if (decision.outcome === 'ALLOW') {
// Dispatch the tool call here.
console.log('ALLOW', decision.reason_code, decision.decision_trace_id);
} else if (decision.outcome === 'DENY') {
console.log('Blocked before execution:', decision.reason_code);
console.log('Evidence hash:', decision.evidence_hash);
console.log('Trace ID:', decision.decision_trace_id);
} else {
console.error('Unknown decision contract; failing closed:', decision);
// Do not dispatch.
}
} catch (error) {
console.error('Gate unavailable or invalid response; failing closed:', error);
// Do not dispatch.
} finally {
await client.close();
}
}
main().catch(console.error);
```
Sector8 returns the verdict. Your application owns honoring that decision at dispatch time.
REST `/api/v1/evaluate` responses use the field `decision`. This SDK exposes the same value as `outcome`. Check for `ALLOW` the same way either way.
| Result | Runtime must |
| ---------------------------------------- | ---------------------------- |
| `ALLOW` (`decision.outcome === 'ALLOW'`) | May dispatch |
| `DENY` | Block; do not dispatch |
| Missing, unknown, error, or timeout | Fail closed; do not dispatch |
Never execute an action unless `decision.outcome === 'ALLOW'`. Fail closed on evaluate errors. Fail-closed applies to tools routed through this SDK path; it does not stop bypassed or unconfigured tool paths.
See [Evaluate](/api-reference/evaluate) for the shared `ALLOW | DENY` contract and [Non-MCP integration](/guides/non-mcp-integration) for custom runtime wiring.
## Optional: send telemetry
Telemetry records what happened. It does not replace evaluate-before-dispatch.
```typescript theme={null}
import sector8 from '@sector8/sdk';
async function main() {
const client = sector8.setup({
apiKey: process.env.SECTOR8_API_KEY!,
clientId: process.env.SECTOR8_CLIENT_ID ?? '1',
enableAutoInstrumentation: false,
debug: true,
});
const connected = await client.testConnection();
console.log('Connected:', connected);
await client.logLLMCall({
provider: 'openai',
model: 'gpt-4',
tokens: 24,
cost: 0.001,
latency_ms: 120,
success: true,
prompt: 'Sector8 TypeScript SDK telemetry test',
completion: 'Telemetry sent successfully',
});
await client.close();
}
main().catch(console.error);
```
Minimal telemetry helper:
```typescript theme={null}
import sector8 from '@sector8/sdk';
const client = sector8.setup({
apiKey: process.env.SECTOR8_API_KEY!,
clientId: process.env.SECTOR8_CLIENT_ID ?? '1',
});
await client.logLLMCall({
provider: 'openai',
model: 'gpt-4',
tokens: 150,
cost: 0.003,
});
```
The TypeScript SDK defaults to `https://sdkapi.sector8.ai`. You only need `baseUrl` / `endpoint` when targeting a non-default environment you intentionally control.
## Verify the integration
1. Check health:
```bash theme={null}
curl https://sdkapi.sector8.ai/api/health
```
2. Confirm an `evaluate` call returns a decision artifact
3. Confirm your runtime dispatches only on `ALLOW` and fails closed on unknown/error
4. Optionally confirm telemetry appears in Sector8 if you send it
You are done when your TypeScript runtime evaluates before dispatch, blocks on `DENY`, and fails closed on missing/unknown/error responses.
## Common mistakes
* Logging telemetry without calling `evaluate` before tool dispatch
* Treating `testConnection()` as proof of enforcement
* Dispatching on any non-error response instead of checking `decision.outcome === 'ALLOW'`
* Missing `SECTOR8_CLIENT_ID`
* Using the wrong host instead of `https://sdkapi.sector8.ai`
## Next steps
* [Quickstart](/guides/quickstart)
* [Non-MCP integration](/guides/non-mcp-integration)
* [Guard MCP Server](/guides/mcp-server)
* [Evaluate API](/api-reference/evaluate)