Skip to Content
AgentShield
Architecture

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 ig​nore still match. Every pattern uses bounded repetition, so matching time stays linear on crafted input.

RuleApplies toSeverityLooks for
PI001resulthighIgnore, disregard, or override your instructions
PI002resulthighText dressed as a system or developer message
PI003resultmediumA new identity or unrestricted mode
PI004resulthighSend data, credentials, or money somewhere
PI005resultmediumCall a tool or run a command now, without asking
PI006resulthighMarkdown images or links that leak data in their URL
PI007resultmediumRequests for a password, key, or one-time code
PI008resulthighText hidden in Unicode tag characters
PI009resultlowZero-width or direction-changing characters
PI010resulthighAn injection hidden in base64
EX001argumentshighA private key
EX002argumentshighCloud and platform tokens (AWS, GitHub, Slack, OpenAI, Anthropic, Google, Stripe)
EX003argumentsmediumA 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

RouteAuthPurpose
GET /health/livenoneLiveness
GET /health/readynone200 once the ruleset is loaded
POST /v1/analyzeBearer token when configuredAnalyze items
GET /v1/rulesBearer token when configuredThe rules this build applies
POST /v1/analyze
{
  "items": [
    { "source": "result", "path": "$.json.body", "text": "…page content…" },
    { "source": "arguments", "path": "$.body.note", "text": "…" }
  ]
}
Response
{
  "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

SettingBehavior
INTELLIGENCE_URLEnables analysis. Without it, nothing changes on the request path
INTELLIGENCE_TIMEOUTDefault 500 ms, maximum 5 s. On timeout the report is unavailable
INTELLIGENCE_TOKENSent as a bearer token. Required in production, at least 32 characters, compared in constant time
TransportIgnores 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.statusMeaningSide effects
cleanNo rule matchedNone
flaggedOne or more rules matchedOne anomaly_alerts row per rule and a content.flagged event, in the completion transaction
unavailableThe analyzer did not answer in time or answered badlyNone

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.

Was this page helpful?

On this page