Sentinel API
API reference and usage patterns for Teleon Sentinel
Sentinel is Teleon’s safety and compliance system for AI agents. It provides production-grade guardrails with content filtering, PII detection, prompt injection detection, compliance enforcement, tool call guardrails, and a declarative policy DSL.
Role
Sentinel validates inputs before agent execution and validates outputs after execution. It can also validate tool calls before execution.
When to use
- Add safety guardrails to any user-facing agent.
- Detect and redact PII (emails, phones, SSNs, credit cards, IBANs, EU VAT numbers, passports, addresses, names, and more).
- Detect prompt injection / jailbreak attempts.
- Enforce compliance standards (GDPR / HIPAA / PCI_DSS / SOC2 / CCPA).
- Restrict tool usage via allowlists/blocklists and policy rules.
- Choose what happens on violations (
block,flag,redact,escalate) and keep an audit trail.
Quick start
Basic usage
Standalone usage
Configuration reference
Simple enable
This enables Sentinel with default BLOCK action and audit logging. No detection features are turned on — you must explicitly enable the ones you need.
Full configuration
All configuration options
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | True | Enable/disable Sentinel entirely |
content_filtering | bool | False | Enable toxicity, hate speech, profanity, threat, and sexual content detection |
pii_detection | bool | False | Enable PII detection and redaction |
prompt_injection_detection | bool | False | Enable prompt injection and jailbreak detection |
compliance | list | [] | Compliance standards to enforce: "gdpr", "hipaa", "pci_dss", "soc2", "ccpa" |
moderation_threshold | float | 0.8 | Content moderation sensitivity (0.0 = flag everything, 1.0 = flag nothing) |
injection_threshold | float | 0.8 | Prompt injection detection sensitivity |
language | str | "en" | Primary language for detection: en, es, fr, de, pt, it |
additional_languages | list | None | Extra languages to detect alongside the primary language |
policy_file | str | None | Path to a YAML or JSON file containing policy definitions |
policy_definitions | list | None | Inline policy definitions (list of dicts) |
tool_guardrails | bool | False | Enable tool call validation before each tool invocation |
allowed_tools | list | None | Allowlist of permitted tool names (blocks everything else) |
blocked_tools | list | None | Blocklist of forbidden tool names |
action_on_violation | str | "block" | Default action: "block", "flag", "redact", or "escalate" |
log_violations | bool | True | Log all violations to structured logger |
audit_enabled | bool | True | Enable audit trail and platform persistence |
custom_policies | list | [] | Legacy custom policy names (use policy_file or policy_definitions instead) |
content_backend | str | None | Backend for content moderation: "heuristic" (default). "ml" reserved for future use |
pii_backend | str | None | Backend for PII detection: "heuristic" (default) |
injection_backend | str | None | Backend for injection detection: "heuristic" (default) |
Engine API
SentinelEngine
validate_input()
Returns: GuardrailResult
validate_output()
validate_tool_call()
GuardrailResult
Each violation dict contains:
Content moderation
Sentinel detects toxic content across multiple categories and languages using weighted pattern matching with safe-context allowlisting.
Supported languages
English (en), Spanish (es), French (fr), German (de), Portuguese (pt), Italian (it).
Detection categories
| Category | Description | Score Range |
|---|---|---|
| Toxicity | Violent, threatening, abusive content | 0.2 - 0.5 per match |
| Hate Speech | Discriminatory, supremacist content | 0.3 - 0.6 per match |
| Profanity | Explicit language | 0.15 - 0.3 per match |
| Threat | Direct threats of violence or harm | 0.3 - 0.5 per match |
| Sexual | Sexually explicit content | 0.2 - 0.4 per match |
Direct usage
Using the backend directly (advanced)
PII detection
Sentinel detects and redacts Personally Identifiable Information across multiple locales.
Supported PII types
| Type | Examples | Redaction Token |
|---|---|---|
user@example.com | [EMAIL_REDACTED] | |
| Phone (US) | 555-123-4567, (555) 123-4567 | [PHONE_REDACTED] |
| Phone (UK) | +44 20 7123 4567 | [PHONE_REDACTED] |
| Phone (EU) | +49 30 12345678, +33 1 23456789 | [PHONE_REDACTED] |
| SSN | 123-45-6789 | [SSN_REDACTED] |
| Credit Card | 4111-1111-1111-1111 (validated with Luhn) | [CREDIT_CARD_REDACTED] |
| IBAN | DE89 3704 0044 0532 0130 00 | [IBAN_REDACTED] |
| EU VAT | DE123456789, FR12345678901 | [VAT_REDACTED] |
| IP Address | 192.168.1.100 | [IP_REDACTED] |
| Passport | US: 123456789, EU: AB1234567 | [PASSPORT_REDACTED] |
| Date of Birth | 01/15/1990, 1990-01-15 | [DOB_REDACTED] |
| Address | 123 Main Street, Apt 4 | [ADDRESS_REDACTED] |
| Name | Mr. John Smith, Dr. Jane Doe | [NAME_REDACTED] |
Configuration
Direct usage
Note: PII field names in the
detect()return dict are singular:phone,ssn,credit_card,ip_address,iban,vat,passport,dob,address,name.
Credit card validation
Using the backend directly (advanced)
Prompt injection detection
Sentinel detects attempts to manipulate agent behavior through prompt injection, jailbreaking, and encoding evasion.
Detection categories
| Category | Examples | Weight |
|---|---|---|
| Override | "ignore previous instructions" | 0.8 - 0.9 |
| Role Hijacking | "you are now a" | 0.65 - 0.7 |
| System Prompt Manipulation | "system:" / "[system]" | 0.75 - 0.9 |
| Jailbreak | "DAN mode" | 0.9 - 0.95 |
| Encoding Evasion | Base64 decode attempts | 0.3 - 0.6 |
| Delimiter Injection | Unexpected markdown headers | 0.6 - 0.7 |
Configuration
Direct usage
Compliance standards
Sentinel enforces regulatory compliance with structured rule checks.
Supported standards
| Standard | Key | Description |
|---|---|---|
| GDPR | "gdpr" | General Data Protection Regulation |
| HIPAA | "hipaa" | Health Insurance Portability and Accountability Act |
| PCI DSS | "pci_dss" | Payment Card Industry Data Security Standard |
| SOC 2 | "soc2" | System and Organization Controls 2 |
| CCPA | "ccpa" | California Consumer Privacy Act |
Configuration
What each standard checks
GDPR
| Rule | Violation Type | Triggers When |
|---|---|---|
| Data Minimization | gdpr_data_minimization | More than 3 PII types detected in a single payload |
| Security | gdpr_security | Text contains "password" or "secret" without encryption metadata |
| PII Without Consent | gdpr_pii_consent | PII detected and no consent key in metadata |
HIPAA
| Rule | Violation Type | Triggers When |
|---|---|---|
| PHI Encryption | hipaa_phi_encryption | Medical terms detected without encryption metadata |
| PHI Access Control | hipaa_phi_access_control | Medical terms detected without access_control metadata |
PCI DSS
| Rule | Violation Type | Triggers When |
|---|---|---|
| Card Data Encryption | pci_dss_card_encryption | Credit card numbers detected in text |
SOC 2
| Rule | Violation Type | Triggers When |
|---|---|---|
| Plaintext Password | soc2_plaintext_password | Text contains "password" in a plaintext storage context |
CCPA
| Rule | Violation Type | Triggers When |
|---|---|---|
| PII Disclosure | ccpa_pii_disclosure | PII detected in output without opt_out_checked metadata |
Direct usage
Policy DSL
The Policy DSL lets you define declarative safety rules in YAML or JSON.
YAML policy file
Using a policy file
Inline policy definitions
Rule types
| Type | Description | Required Fields |
|---|---|---|
text_match | Match text using operators | operator, value or values |
regex | Match a regular expression | pattern |
length | Check text length | operator, value |
tool_allowlist | Only allow listed tools | allowed_tools |
tool_blocklist | Block listed tools | blocked_tools |
tool_argument | Validate a tool's arguments | tool, argument, operator, value or values |
rate_limit | Limit invocations in a time window | max_count, window_seconds |
Tool guardrails
Tool guardrails wrap your agent's tools with Sentinel validation.
Configuration
When a tool is blocked:
- BLOCK action: Raises
AgentValidationError, tool does not execute - FLAG action: Logs the violation, tool executes normally
- ESCALATE action: Marks for review, tool executes normally
Violation actions
| Action | Enum | Decorator String | Behavior |
|---|---|---|---|
| Block | GuardrailAction.BLOCK | "block" | Raises AgentValidationError, stops execution |
| Flag | GuardrailAction.FLAG | "flag" | Logs the violation, execution continues |
| Redact | GuardrailAction.REDACT | "redact" | Replaces sensitive content with redaction tokens |
| Escalate | GuardrailAction.ESCALATE | "escalate" | Marks for human review |
Audit logging & persistence
Local audit logger
Platform persistence
When audit_enabled is True and the agent is deployed on the Teleon platform, violations are automatically batched and sent to the platform API.
Webhooks
Webhooks send real-time HTTP notifications when violations occur.
Webhook payload
Security
Webhooks are signed with HMAC-SHA256 in the X-Sentinel-Signature header.
Dashboard
The Sentinel page in the Teleon Dashboard includes tabs for Violations, Statistics, Agents, Policies, Webhooks, and Settings.
Platform API reference
Platform API endpoints
Violations:
POST /api/v1/sentinel/violations/ingestGET /api/v1/sentinel/violationsGET /api/v1/sentinel/statsGET /api/v1/sentinel/violations/stream
Policies:
GET /api/v1/sentinel/policiesPOST /api/v1/sentinel/policiesGET /api/v1/sentinel/policies/{id}PUT /api/v1/sentinel/policies/{id}DELETE /api/v1/sentinel/policies/{id}
Webhooks:
GET /api/v1/sentinel/webhooksPOST /api/v1/sentinel/webhooksPUT /api/v1/sentinel/webhooks/{id}DELETE /api/v1/sentinel/webhooks/{id}POST /api/v1/sentinel/webhooks/{id}/test
Agents:
GET /api/v1/sentinel/agents
SDK exports
Examples
Healthcare agent with HIPAA compliance
Full protection stack with policy DSL
Best practices
- Start with
"flag", then switch to"block"after tuning thresholds. - Enable prompt injection detection for any user-facing agent.
- Use the Policy DSL instead of legacy custom policies.
- Prefer tool allowlists in production.
- Enable audit logging for compliance.
- Use multi-language detection if your agents serve international users.
- Configure webhooks for critical violations.
- Review violation statistics regularly.
Troubleshooting
Violations not being detected
- Check that Sentinel is enabled (
"enabled": true— this is the default) - Verify the specific feature is enabled (
"content_filtering","pii_detection","prompt_injection_detection") - Check the threshold — if set too high (close to 1.0), fewer things are flagged
- For multi-language content, ensure the correct languages are configured
Too many false positives
- Increase the threshold closer to
1.0 - Review safe-context allowlisting and custom patterns
- Use
"flag"action to monitor before switching to"block"
PII not being redacted
- Ensure
"action_on_violation"is set to"redact" - Verify
"pii_detection"isTrue - Check that the PII format matches a supported pattern
Tool guardrails not blocking tools
- Verify
"tool_guardrails"isTrue - Check that
"allowed_tools"or"blocked_tools"is set - Ensure the tool name matches the function's
__name__
Compliance checks not triggering
- Compliance rules check for specific conditions (for example, HIPAA requires missing encryption metadata)
- Pass metadata keys like
"encryption": Trueor"consent": Truein the data dict
Webhook not receiving events
- Check webhook
is_activestatus (webhooks can auto-disable after repeated failures) - Verify your endpoint returns a 2xx status code within 10 seconds
Audit logs not persisting to platform
- Check
TELEON_API_KEYandTELEON_API_URLenvironment variables - Verify network connectivity from the deployed agent to the platform API