What happens when an AI agent has permission to read a GitHub repository, but the instructions it finds there tell it to do something else? It might try to use an API, write a file it shouldn't, or get distracted and take a longer route to complete the task (which, in today's tokenomics economy, isn't cheap). The tricky part is that, from the outside, an agent following a malicious instruction versus an agent making an ordinary mistake can look remarkably similar.
We can tell an agent not to do these things in its system prompt. But with non-deterministic systems like language models, a prompt is more of a suggestion. That's where OpenShell comes in, an open source runtime that gives AI agents clear, enforceable boundaries. It traces their actions and enforces policy as they work, and in this article, we'll see it in action.
Why does OpenShell exist?
For decades, we've built software that does what we programmed it to do. Agents are different because, after you give an agent a goal, the path of tools and commands it uses to get there can be unpredictable. But rather than hoping an agent follows rules written in natural language, OpenShell enforces boundaries outside the model. Whereas your prompt might say "Only read from GitHub," OpenShell gives you a way to enforce that restriction at the network layer. It does this by combining several controls:
- Network access: Connections are denied by default unless a policy grants them. Rules can be scoped to a particular executable, destination, and HTTP method.
- File system and process restrictions: Sandboxes use operating system controls to limit what code can access or execute (which matters when an agent chooses a tool you didn't expect).
- Provider credentials: Where an agent needs credentials or a secret, OpenShell can give the workload an opaque placeholder and substitute the real credentials only when the request reaches an authorized endpoint.
- Visibility: Denied requests are logged, so you can inspect what the agent attempted rather than relying on its own account of what happened.
We already have tools for isolating workloads, but they were built for code that does the same thing every run, so they draw their boundaries around the whole workload. A container isolates the application, but not what the agent decides to run inside it. A Kubernetes NetworkPolicy works per pod, not per program inside it. And a secret mounted into a container can be read by whatever runs there, including a compromised agent. OpenShell brings the protections agents need into one runtime. The goal isn't to make agents infallible, but to limit the damage when one makes a bad decision.
NVIDIA launched OpenShell at GTC in March 2026, with Red Hat as a founding contributor. It then became a CNCF Sandbox project, also backed by Docker, GitHub, SAP, Google, and Dell. No matter the agent you use (Claude Code, Codex, OpenCode, or OpenClaw), you can run it inside sandboxes that let you decide what each agent can read, run, and reach on the network.
Getting started with OpenShell
At a high level, OpenShell has 3 main pieces: a gateway, an agent sandbox, and a supervisor.
The gateway manages sandboxes and distributes their configuration. The agent runs in an isolated workload, with file system and process controls applied at the boundary. A separate supervisor, on the trusted side of that boundary, evaluates outbound requests against the sandbox's policies. Approved connections can proceed, but requests that violate policy are denied and can be logged for review (Figure 1). So for a coding agent, while the model can still ask to visit a site, the network request won't succeed.

Installing OpenShell
Before you get started, you'll need to install OpenShell. On Linux or macOS, NVIDIA provides an installation script that installs the CLI and starts a local gateway:
$ curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh | shYou'll also need a supported container runtime, such as Docker or Podman, to run your sandboxes. Once installed, verify that OpenShell is up and running:
$ openshell statusServer Status Gateway: openshell Server: https://localhost:17670 Status: Connected Authentication: Authenticated (mTLS transport) Version: 0.1.10
And that's it! For other platforms or more advanced deployments, check out the OpenShell installation guide.
Writing your first network policy
Let's try the network policy tutorial, which doesn't require an agent setup—only the curl tool—so you can see OpenShell's default-deny behavior before selectively allowing a single destination. After following the installation instructions for your machine, let's create a sandbox using Red Hat Universal Base Image:
$ openshell sandbox create \
--name demo \
--from registry.access.redhat.com/ubi10/ubi-minimal \
--no-auto-providersYou'll land in an interactive shell inside the sandbox, where you can try:
$ curl -s https://api.github.com/zenThe connection is denied. From a 2nd terminal on your host, let's inspect the log and add a read-only policy, as shown in Figure 2:
$ openshell logs demo --since 5m --source sandbox[sandbox] [OCSF ] [ocsf] NET:OPEN [MED] DENIED /usr/bin/curl(58) -> api.github.com:443 [reason:transparent_tcp_policy_denied]
$ openshell policy update demo \
--rule-name github_api \
--binary /usr/bin/curl \
--add-endpoint api.github.com:443:read-only:rest:enforce \
--wait
See how OpenShell denies our container's request, logs it, and lets us apply a new policy that's updated in real time.
Back inside the same sandbox, try a read (which will work) and a write (which we haven't given permission for):
$ curl -s https://api.github.com/zen
$ curl -s -X POST https://api.github.com/repos/octocat/hello-world/issues \
-H "Content-Type: application/json" \
-d '{"title":"oops"}'The GET succeeds, but the POST gets a policy denial. OpenShell isn't simply allowing or blocking GitHub; it can enforce which HTTP operations a process may perform there. The policy takes effect without a restart, and the denial appears in the sandbox logs. Run exit to leave the shell, and run openshell sandbox delete demo to delete this sandbox.
Running a coding agent with OpenShell
Now, let's put an actual AI agent inside our sandbox. For this example, we'll use Claude Code, a coding agent that can read files, execute commands, and write code on our behalf.
First, we're going to need a container image with Claude Code installed. OpenShell's default image doesn't include any agents, so I've already built one locally that includes Claude Code using the following Red Hat Universal Base Image:
# Claude Code on Red Hat Universal Base Image, for use as an OpenShell sandbox image.
FROM registry.access.redhat.com/ubi10/ubi-minimal
RUN microdnf install -y git tar gzip shadow-utils \
&& microdnf clean all
# Install Claude Code, then copy the real binary to a path the
# claude-code provider profile allows (/usr/local/bin/claude).
RUN curl -fsSL https://claude.ai/install.sh | bash \
&& cp -L /root/.local/bin/claude /usr/local/bin/claude \
&& chmod 755 /usr/local/bin/claude \
&& rm -rf /root/.local /root/.claude*
# Regular user with a writable home and workspace (UID 1000 is OpenShell's default).
RUN useradd -m -u 1000 sandbox \
&& mkdir -p /sandbox && chown sandbox:sandbox /sandbox
USER sandbox
WORKDIR /sandbox
ENV DISABLE_AUTOUPDATER=1With this Containerfile, we can run podman build -t localhost/claude-agent:local -f Containerfile . in the local directory to build that custom image.
Next, we'll import a provider profile. A profile is a YAML file that tells OpenShell what a service needs: which credentials it uses, which endpoints those credentials can go to, and which programs can use them. The Claude Code profile only allows ANTHROPIC_API_KEY to be sent to api.anthropic.com, and only from the claude binary.
$ openshell profile import \
--url https://raw.githubusercontent.com/NVIDIA/OpenShell/main/providers/claude-code.yaml \
--globalThen, we'll create a provider (an instance of that profile) using our Anthropic API key:
$ export ANTHROPIC_API_KEY=<your-anthropic-api-key>
$ openshell provider create --name my-claude --type claude-code --from-existingNow let's start Claude Code in a sandbox with the provider attached:
$ openshell sandbox create \
--name claude-demo \
--from localhost/claude-agent:local \
--provider my-claude \
-- claudeThat's it. Claude Code launches inside the sandbox. But what key does it actually have? From a 2nd terminal, let's check:
$ openshell sandbox exec --name claude-demo -- printenv ANTHROPIC_API_KEYopenshell:resolve:env:v1758916102505108697_ANTHROPIC_API_KEY
It's an opaque placeholder, not our key. The supervisor only swaps in the real one for requests to Anthropic's API, so even if the agent were tricked into sending its key somewhere else, it would have nothing useful to give away (Figure 3).

Wrapping up
A sandbox adds a valuable layer of security, but it doesn't eliminate every risk. Depending on the runtime, ordinary containers can still share a host kernel. Added isolation, including virtual machine-backed Kata Containers, can add another boundary around untrusted workloads, especially as agents move from developers' laptops to shared infrastructure.
So, you've learned how to set boundaries for AI agents, and more importantly, stop them when they step outside of those boundaries. Bringing agents to the enterprise requires these boundaries, along with capabilities for governance and observability that Red Hat is developing upstream with projects like NeMo Guardrails and MLflow as part of Red Hat AI.