Agent security
How to Make AI Agent Sandboxing the Default for Your Team
Make sandboxing the normal way your team starts coding-agent work, with limited credentials, usable workspaces and tested execution boundaries.

Executive summary
Make AI agent sandboxing a managed development workflow: provide a ready workspace, restrict its files and network access, and give it credentials scoped to the job. Test the restrictions through every tool path the team uses. A sandbox limits what an agent can reach; Harden adds a supported pre-execution check on how that access is used. Start with a pilot that proves ordinary development still works and prohibited actions fail.
Why asking developers to sandbox is not enough
Make sandboxing the default way to start coding-agent work, with a maintained workspace and limited credentials. Pair that setup with an enforceable policy and a straightforward exception process. Repeated reminders leave the decision with every individual developer, on every run.
A discussion in r/sysadmin describes the problem: developers and power users running coding agents on workstations under their own credentials. The author reports no incident. The thread raises an operational question, rather than establishing how common the behavior is.
The underlying concern is access. A model that only returns text has a different boundary from an agent that executes commands, edits files and calls services. An employee's account may be appropriate for their wider job while granting far more authority than one coding task requires.
Define what the sandbox actually contains
Write down the processes, files, identities and connections inside the boundary. A project directory alone is not an isolation mechanism. A disposable environment can still expose sensitive resources through mounted folders, inherited credentials or connected services.
NIST SP 800-190, published in 2017, treats container security across images, runtimes and host systems. It provides a useful foundation, not a configuration guide for today's coding agents. Review the current runtime separately.
For example, Docker's bind-mount documentation explains that mounts are writable by default. Mounting a developer's home directory into a container can expose exactly the files the team intended to protect. Keep mounts narrow and use read-only access where editing is unnecessary.
Give developers a workspace they can finish work in
Ship a maintained starter environment with the approved agent, repository checkout, build tools and test dependencies. Offer one documented launch path and name the team responsible for fixing it.
Before rollout, have a pilot group complete a real task: install dependencies, run tests, change code and open a pull request. Record every required permission change. A missing private registry or broken authentication flow becomes pressure to bypass the environment.
Use a container, VM or managed remote workspace according to the workload and isolation needs. Decide how patches, persistent project data and workspace deletion work. Disposable compute still needs a trustworthy base image and a recovery plan for useful changes.
Make the acceptable-use rule specific: which agent workflows must use the managed environment, who can approve an exception and when that exception expires. Give managers the same process as everyone else. Our AI agent security policy guide explains how to assign those responsibilities.
Separate task credentials from the developer's identity
Do not mount a personal cloud profile, SSH directory or general-purpose token into the starter environment. Issue access for the project and operation, with an expiry and a named owner. Where supported, keep raw credentials behind a broker that authorizes narrowly scoped operations.
Network access needs its own policy. Allow the model endpoint, required package sources and approved project services. Check arbitrary outbound traffic, internal destinations and connector traffic separately. An allowed domain does not authorize every upload to it.
Use this proposed launch record to make the boundary reviewable:
| Decision | Example for a staging bug fix |
|---|---|
| Files | One repository; no home-directory mount |
| Identity | Project access; no production role |
| Network | Required registries and approved staging services |
| Output | Branch changes and a pull request |
| Exception | Owner, reason and expiry recorded |
The example is a design aid, not a configuration we tested or a customer deployment. Expand each field into enforceable settings for the selected runtime. Use our least-privilege permissions worksheet to work through resource-level access.
Check each agent's real execution paths
Apply the policy to the environment the team actually uses. Settings with similar names can govern different tools.
The current Claude Code sandbox documentation describes a shell-command boundary. Built-in file tools, MCP servers and hooks run outside that sandbox. Its retry and startup behavior also need review when sandboxing is mandatory.
Codex documentation separates sandbox restrictions from approval policy. Local execution, cloud execution and connected tools need their own scope checks. Command network restrictions should not be assumed to cover apps or MCP.
Cursor's security documentation distinguishes terminal actions, file changes and MCP calls. It describes run-mode guardrails as best-effort controls rather than a hard security boundary. Verify the surrounding environment instead of treating a permission prompt as proof of isolation.
Keep the agent version, operating system and effective managed settings with the rollout record. Recheck them after upgrades.
Add an action check within the available access
A sandbox answers whether an operation can reach a resource. The operation can still be wrong for the task. A staging credential might allow an agent to change several services when the developer asked it to repair only one.
At Harden, we evaluate a supported proposed call before execution, using the action, relevant developer intent and session context. We can allow, redact or block that call. Our published research includes a staging approval that remains valid for staging but does not authorize a production target suggested by later tool output.
That is the additional boundary to evaluate alongside sandboxing. Verify the supported agent integration, captured tool path and available context in your setup. Harden does not replace the sandbox, credential scoping or controls over routes outside its coverage.
Prove the rollout with paired checks
Before widening the pilot, test useful work and the matching prohibited operation in a disposable environment with synthetic data:
- Run project tests, then attempt a write outside the approved workspace.
- Authenticate to staging, then check that production access is unavailable.
- Reach an approved service, then attempt an unapproved destination.
- Complete an authorized task, then propose an unrelated action through the supported Harden path.
Inspect the target state as well as the agent's response. Keep the expected result, observed result, settings and owner. These are proposed acceptance checks, not a claim of measured prevention.
For a team rollout, create a Harden Control account and evaluate one supported workflow alongside the sandbox. Account creation alone does not install or configure protection. Use the pilot evidence to decide what can safely become the default.
FAQs
Do we need to sandbox the model or the coding agent?
Contain the execution environment and tools that can affect resources. A remotely hosted model does not give a local agent isolation from workstation files or credentials. Review both data sent to the model and authority granted to its tools.
Is a dev container enough for every workload?
No. Review mounts, privileges, host interfaces, credentials and network reach. Select stronger isolation when the threat model calls for it. A container label does not establish that those settings meet your policy.
How should we handle work that needs extra access?
Give the request a resource, operation, owner and expiry. Fix missing capabilities in the standard environment where appropriate. Keep temporary exceptions narrow and review whether the legitimate task succeeded before making access permanent.
Does deleting the sandbox revoke its credentials?
Do not assume so. Workspace deletion removes local state according to the runtime's lifecycle, while credential validity is controlled by the issuer. Expire or revoke issued credentials and verify that persistent volumes do not retain sensitive material.
Can Harden help when developers run agents locally?
Yes, on supported and configured agent paths. Our pre-execution check evaluates pending calls with relevant context. Validate that the intended calls reach that check, alongside operating-system and credential restrictions, before treating the local workflow as covered.


