← Back to Blog
Header image for blog post: How to isolate AI agents that have access to company data
Deborah Emeni
Published 12th August 2026

How to isolate AI agents that have access to company data

An AI agent can turn a document containing hidden malicious instructions, excessive permissions, or a stolen credential into a cross-system incident. Its security boundary includes the model, identity, retrieval path, tools, runtime, memory, network, and credentials.

This guide explains AI agent isolation, its architecture, how to select and verify boundaries, and how Northflank supports managed or customer-controlled deployment.

TL;DR: How to isolate AI agents that have access to company data

Isolate an AI agent by giving it a distinct identity and a narrowly authorized path to data, then contain its execution, memory, network access, credentials, and retained evidence independently.

  • Authorize each request against both the permissions of whoever started the run and the agent's narrower permissions.
  • Put a deterministic policy and retrieval layer between the model and company systems.
  • Use short-lived, task-scoped credentials instead of shared keys or developer sessions.
  • Isolate code execution, memory, files, and network paths according to the data and action risk.
  • Test cross-boundary failures and maintain a separate way to stop runs and revoke access.

AI agents that query internal databases, process private files, or execute code need an isolated runtime and controlled paths to company data. Northflank provides microVM-backed sandboxes, secret injection, RBAC, and audit logs for running these agents alongside the APIs, databases, jobs, and other services they use. Run on Northflank Cloud or use self-serve BYOC to place the agent runtime and workload data plane inside your cloud account.

If your AI agents access company data, Northflank gives you infrastructure controls for isolated execution, workload identity, secrets, private networking, and audit evidence. Your application retains control of which users, tenants, records, and tools each agent is authorized to access.

Get started with Northflank self-serve, or book a demo to discuss architecture, security, compliance, data residency, or migration requirements.

What does it mean to isolate an AI agent from company data?

Isolation constrains every path by which an agent can read, retain, transform, or disclose company data. Private model hosting alone does not achieve it.

A container can separate processes while the application retains an unrestricted database credential. A private model can still receive the wrong tenant's records.

Agents can turn data into actions. Indirect prompt injection inside an email, document, or repository can influence retrieval or tool use, so infrastructure must limit what a manipulated agent can reach and change. The guide to deploying agents securely in enterprises covers the broader controls.

BoundaryWhat to isolateFailure it contains
IdentityUser, agent, service, and sessionOne identity using another's permissions
Data accessRecords, fields, tenants, purposes, and environmentsRetrieval beyond the task's permitted scope
RuntimeCode, processes, files, mounts, and computeMalicious or generated code reaching the host or another workload
MemoryConversation state, vectors, caches, and checkpointsSensitive or poisoned context leaking into later work
NetworkInternal services and external destinationsLateral movement and data exfiltration
Credentials and toolsTokens, secrets, actions, and parametersA model converting broad credentials into broad action
Evidence and containmentTraces, decisions, revocation, and quarantineAn incident continuing without attribution or control

The aim is to make permitted paths explicit, narrow, observable, and revocable.

What architecture keeps agent data access contained?

A contained architecture makes authorization decisions outside the model and independently isolates identity, retrieval, runtime, memory, credentials, networking, and audit evidence.

1. Authenticate the user and agent separately

Give the agent its own named workload identity instead of a developer login or shared administrator token. Record both the agent's identity and who or what started the run, such as an employee, application, or scheduled job.

This lets policy evaluate access passed from a user or system to an agent. Scope the agent by task, environment, tenant, and maximum action, and make its access independently revocable. Apply the same principles used to manage access and security for AI-built applications.

On Northflank BYOC, workload identities let services and jobs authenticate to external cloud resources using short-lived tokens instead of stored long-lived credentials.

2. Put a policy broker in front of company data

Do not connect the model directly to a database or shared index. Put a policy service between the agent and each data source to check every retrieval or action before content enters the model context.

The agent's effective access should be limited to what both the requester and agent are permitted to do, with any additional restrictions for the task. Apply tenant, project, geography, data-classification, and environment filters at query time. Preserve source-system permissions where practical instead of rebuilding them as prompt instructions.

Separate read from write paths, use masked development data where possible, and minimize returned fields and records. Treat model output as a request; deterministic policy decides whether it may proceed.

3. Issue task-scoped credentials to tools

Give each connector a credential for its specific target service and operation. Prefer short-lived tokens, restricted scopes, and workload identity where supported.

For MCP integrations, follow the current MCP authorization specification: validate that tokens were issued for the MCP server as their intended resource, and do not pass a client's MCP access token through to downstream APIs. Obtain a separately scoped token for the downstream resource.

Keep credentials outside prompts, tool results, repositories, logs, and images. Inject them only for approved requests and rotate them independently.

Northflank workloads can use workload identities for short-lived access to external cloud resources, secret injection for credentials that must be stored, and API tokens whose permissions come from an associated RBAC role.

4. Run risky work in an isolated environment

Use a stronger execution boundary for generated code, shell commands, dependencies, user files, or untrusted repositories. The orchestrator should not share its host, filesystem, or privileged credentials. This principle also shapes enterprise AI remote coding environments.

Start with an ephemeral environment, lifetime and resource limits, controlled mounts, and no privileged host access. Add persistence only when required. A microVM reduces reliance on the shared host kernel.

Runtime isolation contains code execution but does not determine which records the agent may retrieve.

Northflank sandboxes provide ephemeral or persistent environments for AI agents and untrusted code. The sandbox documentation describes the microVM-backed isolation boundary used for these workloads.

5. Separate memory and retained artifacts

Treat agent memory as a data store. Histories, vector indexes, caches, files, checkpoints, and tool results can retain sensitive information after a task ends.

Partition stored state by tenant and sensitivity. Define ownership, encryption, retention, deletion, and a record of where the data came from. Validate untrusted content before storing it for future runs, as part of governing AI-built applications at scale.

Northflank sandboxes can remain ephemeral or attach persistent storage when a task requires retained state, but your application must still enforce memory partitioning, retention, and deletion rules.

6. Restrict every network path

Allow only required ingress, egress, destinations, and protocols. Use private paths internally and broker outward actions such as email, uploads, and webhooks.

Protect internal address ranges and cloud metadata services. Current MCP security guidance warns that OAuth-related URL fetching can introduce SSRF paths to internal resources and metadata endpoints. Network controls cannot fix prompt injection but can block unapproved destinations.

Keep development, staging, and production on separate network and identity paths. Enforce the boundary in infrastructure, not prompts.

Northflank private networking connects internal workloads without exposing them publicly. On BYOC clusters, network policies provide ingress and egress allow and deny rules between workloads and projects, including outbound rules for specified external destinations.

7. Correlate evidence and keep independent shutdown controls

Record enough evidence to reconstruct a run without collecting unnecessary sensitive content. Correlate identities, versions, source references, tool requests, policy decisions, approvals, affected resources, results, and state changes.

Log prompts and outputs only where policy permits. Correlate platform audit logs with agent traces.

Operators must independently terminate runs, revoke credentials, disable connectors, block network paths, quarantine memory, and preserve evidence.

Northflank audit logs record platform and configuration events, while API tokens can be revoked independently. Correlate these events with application-level agent traces, and keep run termination and memory quarantine in the agent system.

How should you choose the isolation boundary for an AI agent?

Choose an AI agent's isolation boundary based on the most sensitive data it can reach and the highest-impact action it can perform. A single pattern would under-protect production or burden low-risk retrieval.

WorkloadRecommended boundaryData pattern
Read-only knowledge agentSeparate identity, permission-filtered retrieval, tenant-partitioned memoryApproved documents returned under the user's existing access
Departmental workflow agentDedicated service identity, brokered tools, restricted network, scoped durable stateDepartment systems with explicit read and bounded-write operations
Coding or data agentEphemeral isolated runtime, controlled mounts, restricted egress, short-lived credentialsMasked data by default; narrowly approved production access only when required
High-impact production agentDedicated workload and data boundary, per-action policy, independent containment, complete evidenceMinimal records and operations required for a defined production task

A sandbox per run may suit untrusted code but not be necessary for a read-only assistant. Require human approval when an action exceeds the permissions already assigned to the agent.

Before production, verify that the boundary prevents cross-user and cross-tenant retrieval, limits credential reuse and egress, separates memory, and supports revocation. Repeat after changes.

How does Northflank support isolated agent infrastructure?

Northflank supports isolated agent infrastructure with sandboxes, identity and secret controls, private networking, audit logs, and customer-cloud deployment. Your application remains responsible for record-level authorization and tool policy.

With BYOC, runtime, databases, storage, private networking, and the application data path can remain in your cloud boundary, while Northflank's hosted control plane retains platform metadata. Review other data flows separately.

Your retrieval broker decides which records the agent may see; Northflank constrains infrastructure access. See Northflank for Enterprise for the wider governance model.

Get started with Northflank self-serve, or book a demo to discuss your architecture, security, compliance, networking, or data-residency requirements.

Frequently asked questions about isolating AI agents with company data

Does every AI agent need its own sandbox?

It depends on the workload. A read-only retrieval agent may not need its own runtime sandbox if identity, data authorization, tenant partitioning, and network controls provide adequate separation. An agent that executes generated code, dependencies, user files, or untrusted repositories needs a stronger runtime boundary. Northflank sandboxes provide microVM-backed environments for these higher-risk workloads on Northflank Cloud or suitable BYOC node pools.

Is a private model enough to protect company data?

No, a private model alone is not enough to protect company data. Private inference can support data-location requirements, but it does not control retrieval permissions, connector access, retained memory, network egress, or downstream actions. You must secure the complete path between the agent and company data.

Should an agent use the employee's permissions?

Generally, an agent should not directly reuse an employee's permissions. Use the employee's identity to establish maximum scope, then give the agent a narrower identity and task permissions. Northflank's RBAC, scoped API roles, and workload identity can separate platform, API, and cloud-resource access instead of reusing an employee credential.

When should an enterprise use BYOC for an AI agent?

Use BYOC for private connectivity, infrastructure ownership, regional placement, cloud IAM integration, or defined data-residency boundaries. Northflank BYOC places the agent runtime and application data path in your cloud account, while Northflank's hosted control plane retains platform metadata. Review each associated data flow separately.

What should you log for an AI agent with company data access?

Log who or what started the run, the agent and policy version, retrieved-source references, policy decisions, tool requests and results, approvals, affected resources, and state changes. Record prompts and outputs only where policy permits. Correlate application-level agent traces with Northflank audit logs for platform and configuration events.

Use these guides to extend the isolation model across deployment, infrastructure, development, and governance.

Share this article with your network
X