AI Security

How to Secure Enterprise AI Applications and Agents Against Data Leakage Across OpenAI, Anthropic and Self-Hosted Models

To secure enterprise AI applications and agents against data leakage, tokenize sensitive data before each model request and decide where copies and original values can go. One protection layer then covers hosted APIs and self-hosted models alike.

AK Abhilash Kumar Nov 28, 2026 19 min read
On this page

    Enigma Vault

    Secure your cards.
    Protect your data.
    Keep it out of your AI.

    Data tokenization that keeps your applications working, so a breach exposes nothing worth stealing.

    • Free Lite tier, no contract
    • PCI DSS Level 1, SOC 2 Type II
    • Billed through AWS Marketplace
    Request a demo

    To secure enterprise AI applications and agents against data leakage, tokenize sensitive data before each model request and decide where copies and original values can go. One protection layer then covers hosted APIs and self-hosted models alike.

    Few enterprises run a single model anymore, and every extra provider arrives with its own settings and logs but no shared policy. Each time a team adds or switches a model, customer data protection gets rebuilt from scratch and records slip through the gaps. One protection layer around the models you already run closes those gaps. It doesn't matter which AI agent you use, because Enigma AI Vault works as the underlying infrastructure that protects your data.

    Why Enterprise AI Applications and Agents Leak Data Across Model Providers

    AI agents leak data across model providers because customer records move through every stage of a task, and each provider adds another path out of your boundary. Copies then settle in logs and agent memory long after the task has ended.

    Agents behave differently from a chatbot answering one question. Within a single task, an agent may pull a customer record and build context around it, then call a payment service before updating the case. Every one of those moves carries customer data somewhere new, and the four stages below show where it can escape.

    StageWhat happensWhere customer data can escape
    RetrieveConnectors and APIs pull CRM records and payment historyTool responses carry the full record when the task needs one field
    AssembleRetrieved data is packed into prompts and RAG contextSystem prompts and context windows hold raw values
    ReasonThe request travels to a model and a response comes backRequests leave your network for provider infrastructure
    ActThe agent calls tools and saves facts to memoryTool arguments and stored memory keep what the model saw

    How One Customer Record Ends Up in Three Model Paths

    Take a billing dispute for a customer named Sofia Grant. Her personally identifiable information travels further than most teams expect:

    Model pathWhat it does with Sofia's recordRules it follows
    Support agent on AnthropicPulls her profile and card history from the CRM to resolve the disputeAnthropic account settings plus the agent's own logs
    Document assistant on OpenAIDrafts her refund letter from the same case notesA separate integration with its own OpenAI settings
    Internal model on company serversSummarizes the case for a monthly reporting dashboardWhatever the platform team configured

    No single team can say where every copy of Sofia's record now sits.

    Why More Providers Mean More Exposure

    Multi-model setups rarely grow by design. Teams pick the model that suits their use case, and protection follows whatever each team happened to build.

    • Separate integrations: each team wires its own SDK, and protection added to one integration rarely carries over to the next
    • Uneven logging defaults: one gateway records full request bodies while another records nothing at all
    • Model experiments: test traffic sent to a new release often skips the controls production traffic has
    • Agent handoffs: one agent passes context to another agent running on a different provider

    Where Copies Collect Outside the Model

    Model calls are one part of the exposure. Information spreads through the stack, and copies gather in places that rarely get a security review:

    • Application logs: request bodies written at debug level during an incident
    • Traces and observability: full prompts captured to help engineers troubleshoot
    • Agent memory: facts saved so the next conversation feels continuous
    • Vector stores: embeddings of documents that still contain customer details
    • Caches and retries: repeated requests holding the same payload
    • Connected vendors: third-party services the agent calls with customer fields

    How much of this happens depends on how each framework and connector is configured, along with your logging and retention settings. Few teams can answer that question for every model they run.

    OpenAI and Anthropic APIs Versus Self-Hosted Models: Where Data Leakage Happens

    With OpenAI and Anthropic APIs, data leaks as requests leave your boundary and fall under provider retention terms, whereas self-hosted models keep requests inside your network but leak through server logs and broad internal access.

    Neither option is safe by default. Hosted APIs move the risk outside your network, while self-hosted models move it onto infrastructure your own teams have to lock down.

    FactorHosted APIs such as OpenAI and AnthropicSelf-hosted models
    Where requests goProvider infrastructure outside your networkServers in your cloud account or data center
    Who sets retentionProvider terms combined with your account settingsYour own engineering and security teams
    Main leak pointsRaw values in prompts and tool results, plus copies in your own logsInference logs on shared GPU hosts that many engineers can open
    Common blind spotAssuming the provider contract covers your logs and memoryAssuming internal automatically means private
    Who fixes a leakYou handle everything outside the API callEvery layer falls to you

    What Provider Settings Can and Can't Do

    Provider settings matter, but they govern the provider's side of the connection. Here is how the responsibility splits:

    Covered by provider settingsLeft to your team
    How long the provider keeps requestsPrompts your app logged before sending
    Training use of your requestsTool results stored in agent memory
    Access controls on the provider's infrastructureCopies in traces and vector stores

    Those settings also vary between providers and account tiers. Teams that learn to keep PII out of OpenAI requests often see the same gap reopen when a second provider arrives with a different SDK and nobody carries the protection over.

    Why Self-Hosted Models Still Leak

    Self-hosted models feel private because nothing crosses the public internet, yet customer data still spreads inside your own environment. What changes is who can reach it.

    Internal leak pointWho ends up with access
    Inference server logs written for debuggingAnyone with access to the cluster
    Shared GPU hosts running several workloadsTeams that never needed customer data
    Fine-tuning sets built from customer recordsEvery user of the model, since records can resurface in outputs
    Prompt samples kept for quality reviewAnalysts checking model performance

    Running the model yourself changes who can see the data without changing whether it needs protection.

    Hybrid Setups Carry Both Risk Profiles

    Many enterprises run hosted and self-hosted models side by side, which means managing both sets of leak points at once. A typical split looks like this:

    • Internal servers: sensitive analytics and reporting that teams prefer to keep in-house
    • Hosted APIs: customer-facing agents that call OpenAI or Anthropic for reasoning and drafting

    The riskiest moment is the handoff between them. Context produced on an internal model often flows into a request bound for a hosted provider, and protection that exists on one side rarely follows it across. Sofia's case summary, written internally, could end up inside the next prompt a support agent sends to Anthropic.

    What a Data Protection Layer Needs to Cover on Every Model Provider

    A data protection layer for AI agents should sit outside the model and tokenize every part of a request, including tool calls. It also needs to fail closed and keep one audit log whose policy holds steady when you change providers.

    Protection that lives inside one SDK integration breaks the moment a team adds a model, because the next integration starts without it. A layer in the request path between your applications and every provider avoids that problem, since the model behind it can change while the rules stay put. Use these requirements as a checklist when you assess any approach:

    • Coverage of the whole request: user messages and system prompts carry customer data, and so do tool call arguments along with the results tools send back. Protection that scans the user message alone misses most of what an agent sends.
    • Deterministic tokens: the same value always maps to the same token, so the model can tell that two mentions refer to one customer. Tokenization keeps the meaning of a value while hiding the value itself.
    • Neutral labels: field names leak context too, so "Social security number" becomes "ID number" before the request leaves. The model still knows a value is an identifier without learning which kind.
    • Secret detection: API keys and database connection strings end up in prompts more often than teams expect. They need the same treatment as PII because a leaked credential opens far more than one record.
    • Fail-closed behavior: if a request can't be tokenized, it gets blocked before raw values reach the model. A protection layer that sends the original request on failure protects nothing during an outage.
    • Streaming support: agents stream responses as they generate, so restoration has to work chunk by chunk without breaking the user experience.
    • Controlled restoration: original values come back only for an authorized application that needs them, such as the system sending Sofia's refund confirmation.
    • One audit log: every provider writes to the same record of what was tokenized and when, which gives security teams one place to answer an auditor.
    • Stable policy across providers: switching models should leave your privacy controls exactly where they were.

    Why Redaction and Masking Fall Short Across Providers

    Redaction and masking are common first attempts. Both hide values, yet they break the agent or the business process in ways tokenization avoids.

    ApproachWhat the model receivesCan an authorized app recover the value?Effect on agent reasoning
    RedactionBlank spaces or [REDACTED] markersNo, the value is goneLoses track of who is who in a multi-customer case
    Static maskingPartial values such as ****1111Only the visible digits, never the full numberConfuses records that share masked digits
    Deterministic tokenizationConsistent tokens such as [NAME: Ry0Ixd1]Yes, through controlled restorationFollows each customer accurately across the conversation

    How to Secure Enterprise AI Applications and Agents With Scoped Access and Controlled Release

    Start by mapping one agent path and scoping what it can reach. Tokenize data before every model call, then release original values to approved destinations once outputs pass an evidence check against the sources the agent was allowed to use.

    These eight steps work for hosted and self-hosted models. Run them on one agent first, then repeat the pattern as more agents come online.

    Step 1: Map One Agent Path Before Changing Anything

    Pick one agent that handles real customer data, such as the support agent working on Sofia's dispute. Write down five things about it:

    1. Identities and permissions it acts under
    2. Data it touches, from CRM records to payment details
    3. Tools it can invoke during a task
    4. Destinations that need original values, such as a payment gateway
    5. Evidence that should back its answers

    Note which model provider each part of the path calls. Sofia's support agent might reason on Anthropic, while the letter it triggers gets drafted on OpenAI.

    This map shows where protection belongs. It also keeps the first rollout small enough to test properly.

    Step 2: Scope Access to What the Task Needs

    Access often exceeds the task. Broad connector credentials let an agent reach records and files that have nothing to do with the request in front of it.

    For Sofia's dispute, the refund policy and her submitted evidence are relevant. Records belonging to other customers stay out of scope, even if the CRM connector can return them.

    Decide which records and files each agent may read, and which tools or actions it may trigger. Align those decisions with your existing identity and application policy so agent access follows the same rules as the rest of your stack.

    Step 3: Tokenize Sensitive Fields Before Every Model Call

    Replace sensitive values with tokens before the request reaches any provider. The model still understands the case because the structure of the request stays intact.

    What your application sendsWhat the model receives
    Sofia Grant disputes a charge on credit card 4111 1111 1111 1111[NAME: Ry0Ixd1] disputes a charge on account number [ACCOUNT: k82Hq4P]
    Contact her at sofia.grant@example.comContact her at [EMAIL: p3Xw91L]

    The same rule applies to every provider in the path. Your OpenAI and Anthropic calls should receive tokens for Sofia's details, and so should your internal model.

    If tokenization fails for any reason, block the request. A blocked request costs one retry, while a leaked one can't be pulled back from a provider's logs.

    Step 4: Protect Tool Calls and Tool Results

    Agents leak through tools as often as through prompts. A lookup tool returns a full customer record, and that result flows into the next model call untouched unless something scans it.

    Cover tool call arguments going out and tool results coming back. That includes function calls on interfaces such as the OpenAI Responses API and Anthropic tool use, since agents on both providers use them to call tools.

    Streamed tool calls need care as well. Arguments should be held until the call completes so a value split across chunks can't slip past detection.

    Step 5: Limit Copies Across Logs and Agent Memory

    When values are tokenized in the request path, downstream systems record tokens. Logs and traces stay useful for debugging, and a breach of your observability stack exposes references with no values behind them.

    Some copies need their own controls:

    • Vector stores: embed documents after sensitive fields are tokenized
    • Agent memory: set retention limits so saved facts expire on schedule
    • Caches: keep retry payloads short-lived and out of long-term storage
    • Connected vendors: send third parties tokens unless they are an approved destination for the real value

    Step 6: Release Original Values Only to Approved Destinations

    Some systems need the real value. A payment gateway needs the card number, and a notification service needs the email address to send Sofia's refund confirmation.

    Keep originals inside a protected boundary until one of those approved destinations asks for them. Typical destinations include enterprise APIs and payment gateways, plus the approved caller that started the task.

    This design limits the damage if an agent is manipulated through prompt injection:

    • Separate the value: the agent handles a reference, so its context never holds the original
    • Authorize outside the model: release decisions follow application policy, so instructions inside a prompt can't unlock raw data
    • Limit exposure: an approved destination receives the value through a logged path

    For payments, the agent can hold a card token while the vault sends the real number to the processor. The agent completes the purchase without ever seeing the card.

    These controls reduce the consequences of a compromised agent. They don't remove every prompt injection or tool security risk, so keep your other agent defenses in place.

    Step 7: Check Outputs Against Approved Evidence

    Data leakage is one risk. Wrong answers are another, because agent outputs turn into customer responses and case updates that people act on.

    An answer can sound convincing while resting on missing evidence or an outdated policy. Check each claim in a response against the evidence the agent was allowed to use.

    Claim-level verification marks which claims hold up. Your policy then decides whether refused or conflicted content gets held for review or revised before release.

    Claim in Sofia's refund responseEvidence checkNext action
    Her charge falls inside the dispute windowSupported by the current refund policyRelease to Sofia
    She qualifies for an expedited refundConflicted by an older policy versionHold for agent review
    A goodwill credit was approvedRefused with no evidence on fileRemove before sending

    Step 8: Keep the Same Policy When You Add or Switch Models

    A model switch is where most gaps appear. Write the policy once and apply it to every provider, including internal models.

    The file below is a generic illustration of what such a policy captures. Field names and syntax will differ depending on the protection layer you use.

    policy: customer-data-v3
    providers:
      - openai
      - anthropic
      - internal-llm
    tokenize:
      - customer_name
      - email
      - card_number
      - account_id
    on_tokenize_failure: block
    release:
      card_number: payment_gateway
      email: notification_service
    logging: tokens_only

    Retest whenever a model changes, using the same sample records each time. Before a new model goes live, confirm these points:

    1. Requests to the new model contain tokens for every sensitive field
    2. Tool calls and tool results are covered on its interface
    3. Audit entries for the new provider land in the same log
    4. Release rules behave exactly as they did on the previous model

    Hosted or Self-Hosted Deployment: Choosing Where Your Data Protection Layer Runs

    A hosted protection proxy is quick to adopt and needs no infrastructure of your own, whereas a self-hosted deployment runs inside your environment and suits regulated data or strict residency rules. Many enterprises start hosted and move later.

    The protection layer handles sensitive values itself, so where it runs matters as much as what it does. Compare the two options on the factors your security and platform teams care about.

    FactorHosted proxySelf-hosted deployment
    Setup effortChange the base URL and register provider keysDeploy containers and plan for upgrades
    Data residencyDepends on the vendor's available regionsStays in the region you choose
    Regulated workloadsSuits teams whose auditors accept vendor attestationsFits teams that need the vault inside their boundary
    OperationsVendor handles scaling and uptimeYour platform team owns availability
    Self-hosted modelsInternal traffic may leave your network to reach the proxyProtection sits next to your internal models

    A hosted proxy is often the fastest way to prove the approach on one agent. Teams with strict residency rules or a heavy self-hosted footprint usually move the layer in-house once the pilot succeeds.

    Payment data often settles the question early. Teams that handle cards tend to keep card vault tokenization inside a certified boundary from day one.

    Protecting Self-Hosted Models in Practice

    Self-hosted models need the same request-path discipline as hosted APIs. The servers themselves add a few controls of their own:

    • Inference logging: turn off prompt logging in production, or write tokenized payloads to disk
    • Server access: limit who can open model hosts and GPU nodes
    • Retention: set expiry on prompt caches and stored conversations
    • Fine-tuning data: tokenize records before they enter training sets
    • Network egress: block model servers from calling external services they don't need

    How Enigma AI Vault Protects Sensitive Data and Verifies Outputs on Every Model Provider

    It doesn't matter which AI agent or model your teams use. Enigma AI Vault is the underlying infrastructure that secures and protects your data around the models and frameworks you already run, and it verifies outputs without rebuilding your agent stack.

    AI Vault is a data protection and output verification layer for the agents you already run, and it doesn't build or orchestrate agents. It combines The Vault and Triplets with NoPII at the points where information is retrieved and released.

    NoPII is the model-facing layer of AI Vault. One proxy fronts nine model providers, including OpenAI and Anthropic, and your privacy controls don't reset when your model choice changes.

    What you need across providersAI Vault componentHow it works
    Tokenization before model callsNoPII tokenizationTokenizes supported sensitive values before requests reach the model, including tool call arguments and results
    Protection that fails safelyNoPII fail-closed modeBlocks any protected request that can't be tokenized
    One record across providersNoPII provider accountsRegisters multiple providers under one account with a shared audit log
    Controlled release of originalsThe VaultHolds protected customer records and files, releasing values to approved destinations
    Payments without card numbers in the agentVault payment proxySends cards through an HMAC-signed proxy on supported gateways and purges CVV within 30 minutes
    Verified outputsTripletsChecks each claim against approved evidence and traces it to source and version
    Deployment inside your environmentSelf-hosted containersRuns NoPII and Data Vault in your environment, with purchase through AWS Marketplace or direct enterprise agreements

    On protected paths, an agent holds a reference without automatically gaining access to the value behind it. Requests to use protected information are checked outside the model and logged.

    Enigma Vault holds PCI DSS Level 1 and SOC 2 Type II, with sub-100ms vault operations. Coverage depends on the configured model and tool paths, which is why every evaluation starts with a single agent.

    Bring one agent path to our team and we'll show how AI Vault protects it across the models you run today.

    AK
    Abhilash Kumar Chief Growth Officer

    Abhilash Kumar is Chief Growth Officer at Enigma Vault, where he leads growth strategy, market positioning, and partnership development. He brings experience across B2B SaaS marketing, product marketing, brand building, and demand generation, with a career spanning technology companies and communications agencies.

    View full profile

    Frequently asked questions

    Are OpenAI and Anthropic data settings enough to prevent enterprise data leakage?
    No. Provider settings govern retention on the provider's side. They don't cover raw values sitting in your own logs and agent memory, so customer data needs protection before it ever leaves your systems.
    How do you protect data sent to self-hosted AI models?
    Tokenize sensitive fields before prompts reach the model and limit who can open inference servers or their logs. Running a model yourself keeps data inside your network, yet broad internal access can still expose it.
    Does tokenizing data before a model request affect answer quality?
    Deterministic tokens keep answers accurate because the same value always maps to the same token, so the model can follow one customer across a conversation. Masked values look alike and confuse the model more often.
    What happens to data protection when you switch AI model providers?
    If protection lives inside one SDK integration, switching providers resets it and opens gaps. A protection layer in the request path keeps the same policy and audit log, so the new model inherits your existing controls.
    Is an AI gateway enough to stop data leakage from AI agents?
    An AI gateway routes traffic and manages provider keys, but most gateways don't tokenize sensitive values inside prompts and tool results. Pair routing with a data protection layer so customer data stays covered end to end.