What we do

Services
Ways to work with us

Industries

Industries
More industries

Company

Company
Case studies

Insights

Insights
Latest
Work with us

A container is only the start of an agent sandbox

The useful question is what the agent can still reach. Define the execution boundary, prove the denied paths and give its upkeep an owner.

By the dplyz team10 min read

What does an AI agent sandbox actually protect?

Kubernetes documents an uncomfortable detail about containers: their processes share a host kernel. Putting an AI agent in a container is useful isolation, but it leaves decisions about the surrounding environment unresolved. Kubernetes isolation guidance

An agent that processes business documents needs a place to work. It does not automatically need access to the rest of the machine, other departments’ records or every destination on the internet.

A Kubernetes default-deny egress documentation example over a circle of teal, violet and pink light on black

AI agent sandbox security means setting enforceable limits around execution: the files, identities, connections and resources a task can use. Those limits must hold even when the agent asks for something outside its assignment.

Here are six decisions that make that boundary concrete, with a document-processing example and an acceptance checklist. The aim is useful work inside a demonstrable limit, with someone responsible for keeping it that way.

Why isn’t a container enough by itself?

Consider a hypothetical distributor using an agent to read supplier documents and prepare structured summaries. The task needs a temporary workspace, an approved model service and a destination for reviewed results. Payroll files, production database administration and unrelated customer exports sit outside that job.

There are two different failure paths. A vulnerable runtime could allow a process to cross an isolation boundary. Separately, an agent could misuse an API it was deliberately allowed to call. The second can happen while the container works exactly as designed. Your acceptance review needs to cover both.

Four boundaries around one task
ExecutionWhich machine resources can the process reach?
Identity and filesWhich records and credentials are available?
NetworkWhich connections are permitted?
Business actionsWhat can the destination actually do?

Choose containment around the work and its consequences. A system executing unfamiliar code needs a different review from a fixed service that only classifies text. For a lean business, the right design is the smallest environment the team can operate reliably while meeting its access requirements.

The following Kubernetes examples are for companies already using that platform. They make the distinctions visible; they are not a reason to buy a cluster. A managed sandbox or a separately operated virtual machine should answer the same questions.

How should you assess an agent sandbox?

Here’s how to assess the execution boundary in six steps:

1. Choose the runtime for the code it will execute

Ask what the agent can launch, install and modify. A business description such as “document assistant” does not settle this. If the assistant can run arbitrary tools or generated programs, the runtime review must account for those capabilities rather than just the intended document task.

Kubernetes describes stronger sandboxing approaches using virtual machines or a userspace kernel. Kata Containers is one option that combines container workflows with VM isolation. Assess that approach when protecting the host from untrusted execution matters; do not treat the product name as proof that the complete environment is secure.

Require a clear account of what is shared with other workloads and who maintains the host, runtime and guest environment. Stronger separation adds operating work. The useful comparison includes compatibility, patching, recovery and support, alongside the isolation boundary.

For the distributor, the acceptance question is whether a document task can reach another workload’s files or host resources. Test with harmless fixtures in a disposable environment. Do not use live payroll data as a security test, and do not present one passing check as evidence that escape is impossible.

2. Give the task its own identity and workspace

A separate Kubernetes namespace organizes resources and provides a scope for policies. It does not establish complete isolation by itself. The multi-tenancy documentation requires additional access, networking and other controls. Review who can change those controls as carefully as who can run the workload.

Give the agent only the service-account permissions its task requires. If it has no reason to call the Kubernetes API, disable automatic service-account credential mounting. Kubernetes documents that option explicitly. Service-account guidance explains the credential behavior; your engineer should verify the actual workload receives the intended identity.

Our proposed document workflow starts with an isolated task directory and only the documents selected for that job. Avoid sharing a developer’s home directory or a production volume merely because it makes the demo convenient. Ask how temporary files, caches and later jobs remain separated.

Use an appropriate hardening policy too. Kubernetes’ Restricted Pod Security Standard provides a stricter starting point than privileged execution, subject to workload compatibility. Require a documented reason for exceptions. A task that can rewrite its own protection has not been given a dependable boundary.

Keep the work separate from its administration
Task workspaceSelected inputs and temporary working files
Workload identityOnly the access needed for this assignment
Platform operatorChanges protection through a separate authority

3. Verify the routes out of the sandbox

Outbound access deserves its own demonstration. Kubernetes NetworkPolicy documentation says pods start without egress isolation, and applicable allow rules combine. A policy declaration also needs an installed network plugin that enforces it. Merely finding the object in a dashboard proves little.

Begin the review with the destinations the job needs: document input, the selected model service, result storage and necessary infrastructure such as name resolution. Require evidence that those routes work and unintended routes fail. Evaluate the effective combined policy, rather than one reassuring rule in isolation.

For the distributor, a sensible demonstration would show a successful summary alongside rejected connections to unrelated internal services and an unapproved external destination. Include tools the agent can actually launch. A restriction that works only in the main application can leave another route unexamined.

Connection control has limits. Standard NetworkPolicy operates at the network transport layer; it does not decide which customer record an HTTP request may change. A permitted destination still needs application authorization. Keep those checks separate so “the network allowed it” never becomes the reason a sensitive action was approved.

4. Keep powerful operations behind a separate decision

A properly isolated worker can still send a destructive request through an allowed connection. In our example, the document service should receive a summary for review. It should not expose an unrestricted production database operation simply because the agent can reach that service.

OWASP recommends enforcing tool authorization outside the agent’s context and limiting permissions by operation and resource. Its agent-security guidance is a useful reference for that separation. The system receiving the request must verify whether this particular task is entitled to perform it.

A credential broker can be part of that design: perform a narrow authorized operation without handing the agent a reusable production key. Our guide to agents and .env files covers that credential boundary in detail. Here, the runtime decision is whether the agent can inspect, modify or bypass the service enforcing it.

A proposed document-processing boundary
Isolated taskWork on selected documents
Authorized serviceCheck the permitted operation
Review destinationSave a bounded result
Task cleanupRemove temporary access and files

This is an illustrative design, not a claim about a deployed customer system.

5. Separate machine limits from spending limits

Kubernetes resource quotas constrain aggregate resource consumption within a namespace, including defined compute resources and object counts. They help allocate shared capacity. They do not, by themselves, cap the bill for a model API reached over the network.

Specify separate limits for a task’s runtime, repeated attempts, concurrent work and paid upstream activity. Choose values around the job, then test what stops when each limit is reached. A notification that spending increased is different from a control that prevents another paid request.

Plan for interruption. The operator needs to know whether a stopped task left a partial result, whether it may resume, and whether resuming could repeat an external action. Keep the decision with the application and its owner; a terminated process cannot explain the state of every downstream system.

For finance, ask for cost attribution to the workflow and an accountable owner for changing its allowances. For operations, ask for a visible state when work stops. Together those requirements make a limit usable without quietly granting broader access whenever a job gets stuck.

6. Accept the environment on demonstrated behavior

Require a small set of repeatable checks before launch: permitted work completes, unrelated files remain unavailable, unwanted destinations are denied, and the task cannot alter its protection. Include a second task to check that the first task’s temporary workspace is not unintentionally reused.

Exercise the shutdown path while work is active. Verify what happens to in-flight operations, temporary storage and access. Retain the minimum evidence needed to diagnose the outcome, with sensitive document contents and credentials excluded. Cleanup and diagnostic retention need an explicit owner.

OWASP recommends structured testing before deployment and after material changes to tools, policies, models and other agent components. Preserve the tested versions and observed outcomes. An engineer should be able to explain which boundary was checked, what failed, and what residual risk remains.

What should the business see before approving launch?

Ask for an acceptance record an operations lead can read. It should identify the task, the environment, the protected systems and the person responsible for maintenance. Keep detailed test fixtures private; the business record should explain the evidence without exposing access details.

QuestionEvidence to request
Can the job finish?A representative task succeeds with the intended restrictions.
What stays out of reach?Demonstrated denials for unrelated files, identities and destinations.
What ends the run?Observed behavior when the task exceeds its deadline or allowance.
What survives afterward?An explicit result, cleanup outcome and limited diagnostic record.
Who keeps it working?Named owners for runtime updates, policy changes and incident response.

Measure usable completion as well as blocked activity. If legitimate jobs repeatedly fail because the required route is missing, repair the workflow through a reviewed change. Do not leave staff choosing between abandoned work and disabling the protection.

The release decision should be specific: this task can run with these permissions, these limits and this recovery path. Our platform and cloud work includes that operating responsibility. Bring us the workflow you want to run and the systems it must remain separate from.

FAQs

Does Kubernetes automatically isolate an AI agent?

No. A namespace supplies a management and policy scope, while the effective boundary depends on configured permissions, runtime, storage and enforced networking. Verify the installed controls and their behavior. Kubernetes is a platform on which to build the design, not evidence that the design is complete.

Does a microVM replace authorization?

No. Stronger execution isolation helps protect the surrounding host environment. The agent can still misuse an operation it is authorized to call. Keep the receiving application’s authorization checks and limits even when the worker runs behind a VM boundary.

Can a sandbox stop prompt injection?

A sandbox limits the effects an agent can cause through its tools; it does not guarantee that the model interprets every document correctly. Treat retrieved content as untrusted, restrict executable actions and inspect consequential results. A contained wrong answer can still need human review.

Do we need Kubernetes to run business agents?

No. Choose a runtime your team can maintain that demonstrates the required separation. An existing managed environment may be a better fit. Adding Kubernetes solely for an agent adds an operating responsibility without proving that it improves the particular workflow.

What should change when an agent gets more autonomy?

Reassess the actual tools, records and destinations it can reach, then repeat the relevant checks. Letting a document reviewer execute code or commit results changes the job. Keep that decision explicit instead of treating autonomy as a single on/off setting.

Written by the dplyz team

Senior engineers who work inside client companies to take AI from pilot to production: agentic workflows, AI integration and the platform work around them.

How we work

What’s slowing your team down?

Describe the bottleneck in a few lines. The people who would fix it reply with how they’d do it, what it connects to and how fast it can ship.

Describe your bottleneck