Category guide · prompt injection detection · LLM firewall

How to deploy a self-hosted prompt-injection firewall

A useful firewall does not merely return a score. It applies a documented policy, exposes the reason for every allow or block, supports shadow evaluation, and can be calibrated on your traffic.

Install PrismGuard from PyPI Inspect source on GitHub Try the browser demo

Place controls at every untrusted boundary

Direct input

Scan user prompts before retrieval, tools, or an LLM can act on them.

Indirect input

Treat retrieved documents, web pages, email, and tool output as untrusted content.

Agent output

Optionally inspect assistant text and tool arguments before execution or delivery.

Decision evidence

Log policy, detector, threshold, resolution gate, decision source, and escalation path.

Install the audited firewall

pip install "prismguard[prism,guard-model]==0.1.9"

PrismGuard combines rules, a local ONNX detector, and an optional judge. The default path can run self-hosted, and each outcome exposes resolution_gate and decision_source. Its ChorusGraph handler can run before retrieval or generation.

Evaluation scorecard

MetricTest setOperational question
Attack recallHeld-out direct and indirect attacksHow many harmful attempts reach the protected system?
Benign allow rateReal normal trafficHow much legitimate work is blocked?
LatencyCold and warm p50/p95Can the guard run on every boundary?
Audit completenessEvery decision pathCan an operator explain and reproduce the outcome?

Evidence and limitations

The published comparison uses a configured law-domain pipeline and a cold held-out law set against LLM Guard PromptInjection. It is vendor-authored and domain-specific. It does not prove universal superiority. Start in shadow mode, create a held-out set from your own languages, tools, documents, and false-positive budget, then promote a fixed policy.

PrismGuard vs LLM Guard LLM security guardrails Inspect benchmark receipt Integration guide