Intelligence Engine
The Python content analysis service. What it checks, its HTTP contract, how the gateway calls it, and why its findings are advisory.
The intelligence engine examines the content of tool calls: results that may carry prompt injection, and arguments that may leak secrets. It is a small Python service built only on the standard library. It holds no database credentials, stores no content, and cannot affect a decision.
Position in the system
Analysis happens after a successful run and before the response. A failed run is not analyzed. The decision was made earlier and is never revisited.
What it checks
Text is NFKC-folded and stripped of zero-width, bidirectional, and Unicode tag characters before matching, so obfuscations like full-width letters or ignore still match. Every pattern uses bounded repetition, so matching time stays linear on crafted input.
| Rule | Applies to | Severity | Looks for |
|---|---|---|---|
| PI001 | result | high | Ignore, disregard, or override your instructions |
| PI002 | result | high | Text dressed as a system or developer message |
| PI003 | result | medium | A new identity or unrestricted mode |
| PI004 | result | high | Send data, credentials, or money somewhere |
| PI005 | result | medium | Call a tool or run a command now, without asking |
| PI006 | result | high | Markdown images or links that leak data in their URL |
| PI007 | result | medium | Requests for a password, key, or one-time code |
| PI008 | result | high | Text hidden in Unicode tag characters |
| PI009 | result | low | Zero-width or direction-changing characters |
| PI010 | result | high | An injection hidden in base64 |
| EX001 | arguments | high | A private key |
| EX002 | arguments | high | Cloud and platform tokens (AWS, GitHub, Slack, OpenAI, Anthropic, Google, Stripe) |
| EX003 | arguments | medium | A JSON Web Token |
The ruleset is versioned (currently 2026.11.1). Secret rules never quote what they matched; injection rules include a short excerpt.
HTTP contract
| Route | Auth | Purpose |
|---|---|---|
GET /health/live | none | Liveness |
GET /health/ready | none | 200 once the ruleset is loaded |
POST /v1/analyze | Bearer token when configured | Analyze items |
GET /v1/rules | Bearer token when configured | The rules this build applies |
{
"items": [
{ "source": "result", "path": "$.json.body", "text": "…page content…" },
{ "source": "arguments", "path": "$.body.note", "text": "…" }
]
}{
"ruleset": "2026.11.1",
"verdict": "high",
"findings": [
{
"rule_id": "PI001",
"severity": "high",
"source": "result",
"path": "$.json.body",
"summary": "…",
"excerpt": "…ignore your previous instructions…"
}
]
}Limits: 256 items, 64,000 characters per item (longer text is cut), 512,000 characters in total, and 1 MiB per request. A request larger than 1 MiB is refused before its body is read.
Gateway client
| Setting | Behavior |
|---|---|
INTELLIGENCE_URL | Enables analysis. Without it, nothing changes on the request path |
INTELLIGENCE_TIMEOUT | Default 500 ms, maximum 5 s. On timeout the report is unavailable |
INTELLIGENCE_TOKEN | Sent as a bearer token. Required in production, at least 32 characters, compared in constant time |
| Transport | Ignores proxy variables and does not follow redirects. Production requires HTTPS unless the analyzer is on loopback |
The gateway collects only strings of meaningful length from the arguments and result, bounded by depth, item count, and total size.
What the gateway does with a report
analysis.status | Meaning | Side effects |
|---|---|---|
clean | No rule matched | None |
flagged | One or more rules matched | One anomaly_alerts row per rule and a content.flagged event, in the completion transaction |
unavailable | The analyzer did not answer in time or answered badly | None |
The SDKs add a warning sentence to flagged results telling the model to treat the content as data. The relay stores an evidence bundle for every content.flagged event.
Why advisory
A regular expression is too blunt to be an authorization input, and blocking on a finding would let anyone who controls a web page deny service to every agent that reads it. A false positive costs an alert, not an outage. Because analysis can be unavailable, the absence of a finding is not proof that content is safe.
The /v1/analyze contract is the integration point for additional analyzers. A model-based classifier can be placed behind the same contract as a second opinion, with the same advisory status.
Implementation references
Was this page helpful?
Tool Execution Architecture
The adapter registry, the adapter interface, the built-in sample.echo and http.request adapters, and the tools configuration file.
Event Processing Architecture
The transactional outbox, the event relay, NATS JetStream delivery, evidence bundles in MinIO, and reliability metrics.