Skip to main content
Every middleware package includes internal defaults that can be overridden via the constructor, so you can install the package and use the middleware immediately.
Publishing the config is useful when you want global defaults across your application.

Publish the config

This creates:

Configuration priority

Configuration is resolved in this order: That means constructor values always win. This gives you two levels of control:
  1. global application defaults in config/intercept.php
  2. per-agent overrides in middleware constructors

Configuration examples

Global config example

This sets defaults for every agent that uses these middleware classes.

Per-agent override example

You can override global config for a specific agent:
Even if your config says block or redact, these constructor values take priority for this agent.

Middleware configuration options

Injection Guard options

Supported actions:
  1. block
  2. log
  3. warn
  4. sanitize

PII Redactor options

Supported actions:
  1. redact
  2. mask
  3. log
  4. block
Supported entities:
  1. email
  2. phone
  3. credit_card
  4. ip_address
  5. api_key
  6. bearer_token
  7. mac_address
  8. url

Tool Approval Guard options

Supported actions:
  1. block
  2. log
Unlike the PII Redactor, entities defaults to only the high-risk set — credit_card, api_key and bearer_token. Contact data and locators are supported but opt-in, because in a proposed tool argument they are usually the tool’s own parameters rather than an exfiltration signal. scan_injection is off by default for the same reason. See the Tool Approval Guard guide. Note that block_entities stops the run whatever action is set to, so action: 'log' is only observe-only if you also set block_entities to []. This middleware acts on the response rather than the prompt, because the tool calls it guards are proposed by the model. It has no mutating action, since a proposed tool call belongs to the paused turn the provider recorded.

Tool approval resumes

When an agent pauses for tool approval and is resumed with Decisions, the prompt text is empty. The new content is whatever a human supplied while resolving the pending tool calls: edited tool arguments and rejection results. Intercept scans that content by default. Resumed prompts cannot be rewritten, so actions that modify the prompt degrade to logging on this path: Set scan_approval_decisions to false on either middleware to opt out. In my opinion, a good production default would be:
This blocks prompt injection attempts, redacts common structured PII, blocks high-risk secrets, and avoids logging prompt previews.

Config caching

After changing config in production, clear and rebuild your application cache as needed.
If your deployment process caches config, run:

Next step

Explore the available middleware collection to see which ones you need.

Middleware collection

Learn about the different middleware options available in Intercept.