InjectionJudgeConfig), which is off by default.
Enable injection defense
injection_defense=True enables it with the defaults (action="log_only", threshold=0.95):
InjectionDefenseConfig model
Domain scoping
Injection defense is opt-in per domain. Unlike PII or toxicity scanning — where an empty domain list means all egress is scanned — injection scanning runs only on the destination hosts you list indomains. If domains is empty or unset, no injection scanning happens at all.
Set domains to the endpoints whose request and response bodies you actually want inspected — typically your agent’s model/LLM endpoint(s):
domains can be:
Scoping injection to your model endpoint keeps scanning focused where prompts and tool results actually flow, and avoids inspecting unrelated traffic (package registries, object storage, telemetry). Remember the opt-in rule: if you enable injection defense but leave
domains empty, nothing is scanned.InjectionAction enum
How detection works
Without the Guardrails Service, the proxy uses a pattern library to detect known injection attempts:threshold, the configured action is applied.
How injection is caught
Enforcement happens at the agent’s outbound boundary — Declaw gates what the agent sends, it does not block or rewrite inbound responses: Direct injection — the agent’s own outbound request body is scanned; if it scores overthreshold, the configured action is applied.
Indirect injection — untrusted inbound content (web pages, API responses, tool outputs) is passed through to the agent unchanged, not blocked on the way in. If that content is carried verbatim into an outbound request, the classifier catches it. Catching a benign-looking action redirected by earlier poisoned context requires the optional LLM judge (InjectionJudgeConfig, off by default).
Sensitivity thresholds
Example: agent protected from indirect injection
Combining with transformation rules
UseTransformationRule for deterministic pattern removal alongside probabilistic injection defense:
For production deployments handling sensitive agent workloads, deploy the Guardrails Service to use the ML classifier plus an LLM judge. The built-in pattern library covers known attack signatures but cannot detect novel injection techniques that the model can.