Secrets, Sandboxes, and Safe Execution › Capability Sandboxes: Bounding What the Agent Can Do

Michael BrenndoerferDecember 2, 20266 min read
Language AI HandbookAll chapters
Part 61 of 67Agentic AI and Protocol Security
Chapter 469Secrets, Sandboxes, and Safe Execution › Capability Sandboxes: Bounding What the Agent Can Do
Reading section 3 of 10 · Capability Sandboxes: Bounding What the Agent Can Do · 6 minSection 3 of 10 · 6 min

Section 3 of 10 · 6 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

A sandbox restricts resources reachable by a workload. Treat application-level permission and environment-level enforcement as distinct checks. The environment should enforce its restrictions independently of choices made by the model-facing layer.

  • A deployment capability is what the sandbox technology allows the process to do (which operations, paths, or service connections). This is enforced by the operating system, container runtime, or a language runtime; the kernel does not negotiate.
  • An agent capability is what the orchestration layer exposes as a callable tool and authorizes the model to invoke (read_file, http_get, run_query), subject to policy. This is enforced by your code.

By default, restrict the workload to a narrow, read-only view, a per-task writable area, and no network egress unless the job needs it. Constrain CPU, memory, storage, and elapsed time independently. Mechanisms should be chosen for the level of isolation required, then tested on the actual deployment.

Separate the effective environment from the declared intent

A manifest can document which resources are expected to be present, how many calls a workload may make, what runtime limits apply, and which component owns each enforcement decision. A reviewer can use that declaration to compare two policy revisions. Deployment still needs tests. Verify that each enforcement point loaded the intended policy and observe what it did. A manifest that describes the right boundary does not make the boundary effective on its own.

Admission, resource, and custody tests assert different conditions.
BoundaryExample of a test conditionEvidence
Input viewAn eligible document is visible and an unrelated record is absentWorkload identity, effective view and policy revision
Operation scopeThe local policy rejects an unlisted operationDecision before and after the request
QuotaEarlier admissions consume the last available unitStarting and remaining count
Runtime resource limitA harmless job reaches the declared test limitBounded termination under the actual environment
Scratch segregationUnrelated tasks cannot read temporary stateEffective storage identity and observed ownership
Result custodyA valid candidate stays held after the recipient's authorization changesOutput version, audience decision and disposition

Each row of the table names a separate test condition. None of them substitutes for another, so a boundary matrix is more informative than a single pass/fail score. The fixture below records only whether each condition has a dedicated test; the values are declared demonstration inputs.

PythonIn [5]
CollapseExpand
# Declared demonstration inputs: 1 means a dedicated test exists here.
boundary_labels = [
    "Input view",
    "Operation scope",
    "Quota",
    "Runtime limit",
    "Scratch segregation",
    "Result custody",
]
# Columns are hypothetical deployments with different coverage.
deployment_names = ["Policy only", "Policy + runtime", "Full boundary"]
coverage = [
    [1, 1, 1],
    [0, 1, 1],
    [1, 1, 1],
    [0, 0, 1],
    [0, 1, 1],
    [1, 1, 1],
]

assert len(coverage) == len(boundary_labels)
assert all(len(row) == len(deployment_names) for row in coverage)
VisualizationOut [6]
CollapseExpand
Grid of six boundaries by three deployment profiles, with a dot wherever a test exists.
Whether each enforcement boundary has a dedicated test across three hypothetical deployments. The full boundary deployment covers all six conditions. Policy-only deployment leaves operation scope, runtime limit, and scratch segregation untested, while policy plus runtime deployment leaves only the runtime limit untested.

A conventional container and a virtual machine have different isolation mechanisms.

  • Container: processes on the same host can share a kernel.
  • Virtual machine: generally has a guest kernel and an additional virtualization boundary.

Both rely on parts of the deployment to enforce the configured isolation. Consider which resources they share and where you want to place trust. NIST SP 800-190 §2.2 describes container architectures and their relationship to virtual machines.

Read-only access prevents writes through that view. It does not make the contents confidential from the reader. This difference matters when a workload receives a view of multiple tenants' records. Check both which objects an isolated worker can read and what records it can modify. For document summarization, a narrow, immutable view makes the input easier to verify and leaves less unrelated state visible. If you configure a wider view merely to simplify lookup, record that design decision and check that it is necessary for the intended workflow.

A quota and a resource bound also answer different questions. An operation quota limits how many attempts qualify under some policy. A time, memory, or storage limit constrains the effect of activity even after admission, subject to the mechanisms enforcing those limits. The quotas in the example start from a declared count and charge on admission. That controls what the notebook records as available for the next request. It cannot stop a process or cap allocation. Test the actual runtime bounds separately. For a shared quota, measure whether concurrent clients can overspend it and define what must be accounted for if a request times out.

Egress and the default-deny posture

If the task needs no network-dependent operation, deny outbound worker connectivity. Where a job needs one such operation, use a trusted mediated service with a narrow destination, operation, and response contract. Its own network and credential boundaries need separate review. NIST SP 800-190 §§4.3.3 and 4.4.2 recommends separating container network traffic by sensitivity and controlling outbound traffic.

Egress is one boundary. Output delivery, managed storage, and mediated service requests are other paths. Remove direct worker networking and test its expected absence. Then test how the permitted work behaves when an authorized external service is unavailable. A fallback should follow the service policy and expose a clear result rather than silently widening the worker’s permission.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy