---
library: "bootstrap"
slug: "AgentSandbox"
name: "AgentSandbox"
ref: "AgentSandbox#1594"
hash: "sema:AgentSandbox#mh:SHA-256:1594a10a882956e4b8501764091e1d5025ba0b405cce34b7ef931bb17e5c634a"
type: "Protocols"
layer: "Society"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/AgentSandbox"
---

# AgentSandbox

Isolate agent execution with resource limits and egress controls

Society · Protocols

## Mechanism

Execution isolation for AI [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md)s treating them as untrusted insiders. The [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) runs in a containerized environment (gVisor, Firecracker microVM) with: resource quotas (CPU, memory, time), network egress allowlists, filesystem restrictions, and comprehensive logging. Code generated by the [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) is executed in this [Sandbox](https://semahash.org/vocabularies/bootstrap/patterns/Sandbox.md), preventing impact on production systems even if the agent is compromised or generates malicious code. It wraps the execution [Context](https://semahash.org/vocabularies/bootstrap/patterns/Context.md) with [InputGuard](https://semahash.org/vocabularies/bootstrap/patterns/InputGuard.md) to sanitize ingress data and [OutputGuard](https://semahash.org/vocabularies/bootstrap/patterns/OutputGuard.md) to prevent exfiltration, effectively placing the [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) in a digital quarantine.

## Invariants

- Network egress is whitelist-only.
- The sandboxed process cannot reach the host filesystem.
- Declares resource quotas for CPU, memory and time.
- Every action inside the [Sandbox](https://semahash.org/vocabularies/bootstrap/patterns/Sandbox.md) is logged.

## Signature

- Sandbox(Agent)

## Preconditions

- Resource limits defined
- Untrusted code/agent

## Postconditions

- Execution completed or terminated by supervisor

## Failure modes

- [Sandbox](https://semahash.org/vocabularies/bootstrap/patterns/Sandbox.md) Escape: Exploiting container vulnerabilities.
- Quota Starvation: Legitimate tasks failing due to overly restrictive limits.
- Log Blindness: Missing critical events in [Audit](https://semahash.org/vocabularies/bootstrap/patterns/Audit.md) logs.

## Where this came from

—

## Builds on

- [Agent](https://semahash.org/vocabularies/bootstrap/patterns/Agent.md) (references)
- [Audit](https://semahash.org/vocabularies/bootstrap/patterns/Audit.md) (references)
- [Sandbox](https://semahash.org/vocabularies/bootstrap/patterns/Sandbox.md) (references)
- [Context](https://semahash.org/vocabularies/bootstrap/patterns/Context.md) (references)
- [OutputGuard](https://semahash.org/vocabularies/bootstrap/patterns/OutputGuard.md) (composes_with)
- [InputGuard](https://semahash.org/vocabularies/bootstrap/patterns/InputGuard.md) (composes_with)

## Used by

- [EmpathySim](https://semahash.org/vocabularies/bootstrap/patterns/EmpathySim.md) (references)
- [MentalSim](https://semahash.org/vocabularies/bootstrap/patterns/MentalSim.md) (references)

## Related

- [Solution](https://semahash.org/vocabularies/bootstrap/patterns/Solution.md)
- [Task](https://semahash.org/vocabularies/bootstrap/patterns/Task.md)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: AgentSandbox#1594
- Hash: sema:AgentSandbox#mh:SHA-256:1594a10a882956e4b8501764091e1d5025ba0b405cce34b7ef931bb17e5c634a

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/AgentSandbox
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/AgentSandbox.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
