AI Development

Why Must AI Agents Run in a Sandbox? 2026 NVIDIA OpenShell Runtime Boundaries and MCP tools/call Egress

About 15 min read

The model only fills JSON. The risk is who executes, who touches disk, who opens sockets. In 2026 NVIDIA OpenShell runs agents under openshell-sandbox: landlock and filesystem policy lock at creation, egress goes through a TOFU binary allowlist proxy, and L7 enforcement splits protocol: mcp from legacy json-rpc. This piece is the runtime sandbox, not a retread of chat permissions or Sentry.

Before you read

Piece OpenShell fact (docs / PR) What to read in JSON
openshell-sandbox Supervises agent process lifecycle; status is queryable sandbox_id, state, supervisor
L7 egress proxy 2026 policy matches MCP methods / tools/call and json-rpc method at application layer connections[].protocol, enforcement
TOFU binaries Only registered binaries may open outbound connections proxy.binary_allowlist, matched_rule
Landlock / FS filesystem_policy and landlock apply at sandbox creation; not hot-reloaded like network rules landlock.applied_at_create
Batch json-rpc One deny in a batch denies the whole batch (same as MCP) Second hop legacy method rejected

Facts through 2026-11-06: OpenShell policy docs, openshell-sandbox CLI, 2026 L7 MCP/json-rpc enforcement PRs and release notes. Order A-1042 and sb_agent_demo_7f3a are fictional. The status JSON is illustrative for diffing, not an unpublished wire dump.

Agents need a sandbox because JSON is not the kernel or the egress gate

Every coding-agent loop is the same: the model emits tool_use, then a runtime executes it. Without a sandbox, one bad tool name can become any process, any path, any URL. OpenShell puts three layers outside the model:

  • Process and files: openshell-sandbox starts the worker; Landlock and filesystem_policy pin the tree at creation.
  • Outbound HTTP: the proxy parses JSON-RPC by endpoint protocol—MCP tools/call vs legacy reports.search use different rule tables.
  • The host still validates arguments: the proxy does not match arguments by default; shape like A-1042 stays on Schema.

Tool-name allow/deny and Sentry hardware: OpenShell tool names and Sentry. This article is runtime only. Session allow/ask/deny is the harness list: the coding-agent permission model. MCP wire shape: how a coding agent calls MCP. Loop and state: agent harness and JSON state.

openshell-sandbox supervises the process, not chat permissions

The openshell-sandbox CLI (supervisor name appears in status JSON) places the agent worker in isolation: cgroups/namespaces, Landlock, and an egress proxy attached to the same sandbox. Model-side tool_use is approved in the harness; the process that sends tools/call is Python or a runner binary inside the box. TOFU therefore registers which binary may reach which tool server—not what the model token said. network_policies can hot-reload; filesystem and Landlock cannot—change disk rights by recreating the sandbox. 2026 docs stress L7 enforcement: on MCP endpoints inspect method and params.name; on legacy json-rpc inspect the top-level method (e.g. reports.search). Private nets, loopback, link-local, and the cloud metadata address stay off the default outbound allow list.

From tool_use to egress: four JSON objects

1. Model tool_use (in the harness). Name and input still pass strict/Schema; the sandbox is not involved yet:

{
  "type": "tool_use",
  "id": "toolu_order_01",
  "name": "lookup_order",
  "input": {
    "order_id": "A-1042"
  }
}

2. Fictional sandbox status. Tool server connections, protocol, last egress decision—for diffing against policy:

{
  "sandbox_id": "sb_agent_demo_7f3a",
  "state": "running",
  "supervisor": "openshell-sandbox",
  "created_at": "2026-11-06T08:12:04Z",
  "landlock": { "applied_at_create": true, "filesystem_policy": "orders_ro_v1" },
  "proxy": {
    "mode": "tofu",
    "binary_allowlist": ["/usr/bin/python3", "/opt/agent/runner"],
    "connections": [
      {
        "tool_server": "orders-mcp",
        "host": "orders.example.com",
        "port": 443,
        "path": "/mcp",
        "protocol": "mcp",
        "enforcement": "enforce",
        "status": "connected"
      },
      {
        "tool_server": "reports-legacy",
        "host": "reports.internal.example.com",
        "port": 8443,
        "path": "/rpc",
        "protocol": "json-rpc",
        "enforcement": "enforce",
        "status": "connected"
      }
    ]
  },
  "last_egress_decision": {
    "allowed": true,
    "method": "tools/call",
    "tool": "lookup_order",
    "matched_rule": "orders-mcp.tools/call.lookup_order"
  }
}

3. MCP tools/call from the sandbox process. The proxy reads this body at L7, not the model’s prose:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lookup_order",
    "arguments": { "order_id": "A-1042" }
  }
}

4. Legacy json-rpc in the same batch. If reports.search is not in rules, the whole batch is denied:

[
  {
    "jsonrpc": "2.0",
    "id": "batch-1",
    "method": "tools/call",
    "params": {
      "name": "lookup_order",
      "arguments": { "order_id": "A-1042" }
    }
  },
  {
    "jsonrpc": "2.0",
    "id": "batch-2",
    "method": "reports.search",
    "params": {
      "query": "refund A-1042",
      "limit": 10
    }
  }
]

Sandbox, harness, tool-name policy, and Schema—each owns a slice

Everything is called “security.” The objects differ. Merge them and you leak egress or block the wrong session tool:

Gate What JSON / behavior Typical miss
Harness allow/ask/deny Whether Bash, Read, or an MCP client runs in the session Block Shell in the IDE but the runner still hits an unlisted orders host
OpenShell runtime sandbox In-box binary, Landlock, outbound body the proxy sees Clicked Allow once; unregistered binary still egresses
OpenShell tool-name policy MCP tools/call params.name Tool-name allow/deny lives in the OpenShell and Sentry post—deny_rules not repeated here
Host Schema tool_use.input and arguments Tool name allowed but order_id garbage still reaches the DB

Permission files are session scope: the coding-agent permission model. Argument gates use Schema: why AI needs JSON Schema. Tool names and Sentry: OpenShell tool names and Sentry.

Five steps to put an agent in an auditable sandbox

Run fictional order A-1042 in staging before you widen network policy:

  1. Store three JSON surfaces separately. tool_use in messages, host state, OpenShell policy/sandbox status—no single blob.
  2. Set filesystem + Landlock at sandbox creation. Need a new directory? Recreate; do not expect hot reload.
  3. Register TOFU binaries and tool servers. Each endpoint lists protocol, host, port, path, enforcement: enforce.
  4. Split MCP and legacy endpoints. Do not mix protocol: mcp with json-rpc method tables on one host:port.
  5. Accept batches by the worst hop. Do not pair lookup with reports.search in one batch to probe deny.

When all five land on diffable JSON, you can tell harness, proxy, and Schema apart.

When egress fails, lay out four objects

Start with last_egress_decision in sandbox status, then policy and the real outbound body.

  • format tool_use, status, and egress; Schema validate for A-1042 on arguments.
  • JSONPath extract for $.params.name, $.method, $.connections[*].protocol.
  • JSON Diff policy before/after hot reload; watch connections and deny_rules, not prompts.
  • openshell logs --tail --source sandbox for denied binary, host, path.
  • redact tokens in logs and status. JSONSort runs locally in the browser.

When the four align, you know whether binary, protocol, or an unlisted legacy method blocked the call.

Common traps

  • Treat allow/ask/deny as the sandbox. That is the harness session gate. MCP egress still needs OpenShell runtime.
  • Audit only model tool_use, not sandbox egress bodies. The runner may rewrite or resend JSON-RPC.
  • Expect network_policies hot reload to change Landlock. File policy is pinned at creation; recreate to change disk.
  • Share one rule table for MCP and legacy json-rpc. 2026 L7 branches on protocol; mixed endpoints silently mismatch.
  • Ignore TOFU binaries. Change the interpreter path without updating the allowlist and egress dies at the proxy.
  • Use this piece instead of the OpenShell and Sentry post for Sentry depth. Out-of-band hardware is not described by runtime JSON alone.

FAQ

Is harness permission enough without OpenShell?

No. Permission files gate IDE tools; the sandbox gates which paths a process reads and which binary may send JSON-RPC to which host. You need both.

Does the sandbox validate order_id in tools/call?

Not by default. L7 MCP policy matches method and tool name. Argument shape belongs to host Schema—OpenShell still says tool-argument matching is not supported yet.

How is legacy json-rpc different from MCP?

Endpoint protocol: MCP uses tools/call + params.name; legacy uses a top-level method like reports.search. Write separate rules.

What if one call in a JSON-RPC batch is denied?

Same as MCP: one deny denies the batch. Do not bundle lookup with an unauthorized search.

Is this the same as Docker for agents?

Containers are packaging. OpenShell adds Landlock, per-binary egress L7 policy, and openshell-sandbox lifecycle/status. A container alone does not parse MCP tools/call.

Conclusion

Agents must run in a sandbox because tool JSON states intent, not kernel, disk, or egress. OpenShell uses openshell-sandbox, Landlock, TOFU binaries, and an L7 MCP/json-rpc proxy to keep execution inside diffable boundaries.

Align tool_use, sandbox status, outbound tools/call, and policy before you widen rules. Read session permissions, tool-name policy, and Schema in their own posts—do not merge them into one allow list.

Further reading

Changelog: First published