Prevent AI Agents from Leaking Sensitive Data with Fiddler Guardrails and LiteLLM

Key Takeaways

  • Sensitive data can enter and leave agent workflows through user input, tool results, retrieved context, and model responses.
  • Fiddler Guardrails evaluate requests and responses inline, enabling sensitive information to be redacted or blocked before it crosses an organizational boundary.
  • LiteLLM provides a centralized enforcement point for model traffic, allowing Fiddler Guardrails policies to be applied consistently across agents, frameworks, models, and providers.
  • A similar approach can be taken with other leading gateways, including Kong and AgentGateway, extending consistent guardrail enforcement beyond LiteLLM.
How to Prevent AI Agents from Leaking Sensitive Data with Fiddler Guardrails and LiteLLM

AI agents can expose sensitive data through prompts, retrieved context, tool results, and model responses. A production API key or patient record can leave the organization before conventional monitoring detects it.

Fiddler Guardrails integrates with LiteLLM to evaluate model traffic inline and redact or block sensitive information before it reaches its next destination.

Powered by purpose built Centor Models, these evaluations meet latency requirements without relying on external LLM API calls. The same approach can also be applied with gateways such as Kong and AgentGateway.

Sensitive Data Leakage Risk in Agent Workflows

AI agents do more than exchange messages with a large language model (LLM). They retrieve documents, query databases, call application programming interfaces (APIs), read files, and pass results to other agents. Each step can add PII/PHI, credentials, secrets or harmful data to the agent's context. Without inline enforcement, sensitive information can cross the organizational boundary before conventional monitoring detects the exposure.

Imagine an agent retrieving a production database API key from a tool result and then including it in a prompt sent to an external model provider. Or consider a healthcare assistant placing sensitive patient information from a retrieved record into a response that reaches a third party. In either case, the exposure occurs as part of the agent's normal workflow and may be discovered only after the data has already left the organization's control.

Sensitive

Sensitive data exposure can occur in both the request and response path:

  • On the request path: Prompts, retrieved context, memory, or tool results can send sensitive information to the model provider.
  • On the response path: Model outputs can disclose sensitive information to a user, another agent, a tool, or a persistent data store.

Fiddler Guardrails Enforce Policy Inline

Fiddler Guardrails is the enforcement layer of the Fiddler AI Control Plane. Where evaluation and monitoring tell you how agents are behaving, Guardrails enforces what they are allowed to send and receive. Every request and response is evaluated inline before they reach their next destination. It includes four categories of risks:

Guardrails What it evaluates Example coverage
Safety Harmful content and adversarial prompts Jailbreaking, harassment, harmful, hateful, illegal, racist, sexist, sexual, unethical, and violent content
PII and PHI Personally identifiable and protected health information Names, contact details, payment data, government identifiers, medical information, etc.
Secret Detection Credentials, keys, tokens, and high-entropy strings LLM provider keys, cloud credentials, source-control tokens, private keys, connection strings, and other possible unknown secrets
Faithfulness Whether a response is supported by the supplied context Hallucination and groundedness checks for retrieval-augmented generation (RAG) responses

These guardrails run on Fiddler Centor, Fiddler's evaluation engine, which uses purpose-built Centor Models to score prompts and responses in the customer's environment. When deployed in the customer's cloud or VPC, policy evaluation remains within the organization's environment rather than sending sensitive content to an external foundation model for evaluation.

One of the following actions can be taken based on the results of guardrail evaluation:

Verdict Behavior
Allow Pass the content unchanged
Redact Redact only the sensitive information and continue
Block Reject the complete request or response

Redaction is useful when sensitive information can be removed without changing the intent of the request. For example, a guardrail can remove a patient identifier while allowing the model to summarize the remaining clinical text. Blocking is more appropriate when the sensitive value is essential to the requested action, or when the surrounding content still creates risk after that value is removed. This distinction allows organizations to protect sensitive data without rejecting every request that contains it.

Alongside inline enforcement, the Fiddler AI Control Plane helps teams track agent activity, quality, performance, and cost, investigate failures, and retain enforcement decisions for audits.

Enforcing Guardrails Through LiteLLM

LiteLLM is an LLM gateway that gives agents a common interface to model providers, which makes it a natural place to enforce policy. Every request and response passes through it, so Fiddler Guardrails can evaluate traffic there once and apply the same rules across agents, frameworks, models, and providers.

LiteLLM supports custom guardrails in its proxy configuration. The example configuration below shows an integration pattern for running Fiddler Guardrails before model requests and after model responses proxied through LiteLLM.

In the example below, the pii and secrets sections enable the two checks independently. For PII, threshold defines the minimum confidence required for a detection. Lower values increase sensitivity. redact redacts detected sensitive information and allows processing to continue, while block rejects the request or response. Structured tool call arguments are always blocked, when a detection is triggered, because they cannot be safely redacted.

 - guardrail_name: fiddler-llm
    litellm_params:
      guardrail: generic_guardrail_api
      mode: [pre_call, post_call]
      skip_system_message_in_guardrail: true
      api_base: os.environ/FIDDLER_GUARDRAIL_API_BASE
      headers:
        Authorization: os.environ/FIDDLER_AUTHORIZATION
[...]
      additional_provider_specific_params:
        failure_mode: closed
        timeout: 3
        pii:
          enabled: true
          config:
            threshold: 0.8
            mode: redact
        secrets:
          enabled: true
          config:
            mode: redact

The input guardrail runs in pre_call mode and evaluates content before LiteLLM forwards the request to the LLM model provider. The output guardrail runs in post_call mode and evaluates the response before LiteLLM returns it to the agent.

The diagram below shows LiteLLM invoking Fiddler Guardrails before model requests and after model responses. Sensitive information is redacted before a request crosses the organizational boundary or before a response reaches an agent.

Diagram of inline guardrail enforcement with LiteLLM, showing Fiddler Guardrails powered by Centor Models evaluating requests and responses between an agent and model provider, with PII redacted before crossing the organizational boundary.

This type of setup provides a centralized enforcement point for model traffic, giving teams consistent protection and a single way to manage and update Fiddler Guardrails policies across agents, frameworks, models, and providers.

Centor also makes evaluation at scale more cost effective, regardless of where enforcement occurs. Unlike external LLM judges, which add an API charge for every trace they evaluate, Centor Models run in your environment with no external API call. That removes the tradeoff between coverage and cost, so teams can evaluate more production traffic without watching their API bill grow with it.

The Fiddler dashboard below shows how Guardrails acts on traffic to an agent, including the number of requests inspected, blocked, or redacted and the classes of sensitive values withheld from leaving the organizational boundary.

Fiddler Dashboard shows how Fiddler Guardrails enforces policies, allowing, blocking or redacting inputs and outputs.
Fiddler Dashboard shows how Fiddler Guardrails enforces policies, allowing, blocking or redacting inputs and outputs.

Fiddler Guardrails Beyond LiteLLM

The LiteLLM configuration above is one way to put Fiddler Guardrails in the path of your model traffic, not the only one. The same pattern works with other gateways, including Kong and AgentGateway . Wherever your traffic already flows, Guardrails can evaluate requests and responses there and apply one set of policies across agents, frameworks, models, and providers, so you can pick the gateway that fits your architecture without giving up consistent enforcement.

Learn how Fiddler Guardrails enforces policies through LiteLLM — request a demo.

Frequently Asked Questions

How do AI agents leak sensitive data?

AI agents pull data from many places beyond the user's prompt. Retrieved documents, database queries, API responses, and tool results all enter the agent's context, and any of them can carry PII, PHI, credentials, or secrets. That data can then be sent to an external model provider in a request or returned to a user, tool, or another agent in a response.

What is the difference between redacting and blocking sensitive data in an AI guardrail?

Redacting removes only the sensitive value and lets the rest of the request or response continue, which works when the data is incidental to the task. Blocking rejects the entire request or response, which is the right call when the sensitive value is essential to the action or the surrounding content is still risky after removal. Fiddler Guardrails allows, blocks and redacts.

How does Fiddler Guardrails integrate with LiteLLM?

LiteLLM supports custom guardrails in its proxy configuration. Fiddler Guardrails run in pre_call mode to evaluate requests before LiteLLM forwards them to the model provider, and in post_call mode to evaluate responses before they return to the agent. PII, PHI, and secrets detection are configured independently with a detection threshold and a redact or block mode.

Why enforce guardrails at the LLM gateway instead of inside each agent?

The gateway is the one place every request and response already passes through. Enforcing there gives you a single set of policies that applies across agents, frameworks, models, and providers, with no per-agent integration and one place to update rules. The same approach works with LiteLLM, Kong, and AgentGateway.

What are Fiddler Centor Models?

Fiddler Centor Models are purpose-built evaluation models that power Fiddler Guardrails. They run in your environment with no external LLM API call, so policy evaluation meets latency requirements and sensitive content is not sent to an outside evaluator. Because there is no per-trace API charge, teams can evaluate more traffic without the cost tradeoff of external LLM judges.

What types of sensitive data can Fiddler Guardrails detect?

Fiddler Guardrails detect two categories of sensitive data. PII and PHI detection covers names, contact details, payment data, government identifiers, and medical information. Secret detection covers credentials, keys, tokens, and high-entropy strings, including LLM provider keys, cloud credentials, source-control tokens, private keys, and connection strings. Detected values can be redacted or the request blocked before the data leaves the organization.