Skip to content

Per-category timeouts

By default every external classifier (AWS Bedrock, Azure Content Safety, custom webhooks) shares a flat 1500ms timeout. That’s pessimistic for fast checks like PII (typically <150ms) and bites p99 when a slow check ties up the budget.

Per-category timeouts let you set per-class budgets so fast checks fail fast and slow checks get the time they need.

Opt-in. Without configuration, the flat global timeout (DEEPINTSHIELD_GUARD_ADAPTER_TIMEOUT_MS, default 1500ms) applies to every adapter call.

Map check categories to millisecond budgets. Categories are matched case-insensitively against the policy’s metadata category field (falls back to check_class).

Terminal window
# Via plugin config:
{
"embedded_timeouts_by_category": {
"pii": 150,
"toxicity": 600,
"jailbreak": 1200,
"hallucination": 800,
"prompt_injection": 400
}
}
# Or via env (JSON-encoded):
DEEPINTSHIELD_GUARD_TIMEOUTS_BY_CATEGORY='{"pii":150,"toxicity":600,"jailbreak":1200}'

For each individual adapter call, the budget is picked in this order:

  1. policy.TimeoutMs — an explicit override set on the policy itself.
  2. Per-category timeout — matched from the map above.
  3. Global adapter timeout — the flat 1500ms (or your override).

If an adapter call times out:

  • The error becomes a chain-trace entry (visible in the audit log).
  • No finding is emitted for the timed-out check.
  • Other checks running in parallel still complete normally.
  • The request continues with the verdicts from checks that succeeded.
CategoryTypical p95Recommended budget
PII patterns<50ms150ms
Prompt injection100–300ms400ms
Toxicity200–500ms600ms
Hallucination300–700ms800ms
Jailbreak (LLM)500–1000ms1200ms

Pulling p99 down by ~30–50% is realistic once you replace the flat 1500ms ceiling with these.