Sub topic 3
Approval Prompts and Choosing Agent Isolation
Assume you are comfortable with Linux commands, Docker volumes, file permissions, and the basic behavior of an LLM coding agent.
Approval prompts and permission policy
A sandbox limits what an agent can do, but a permission policy controls when it may do it. Deny actions by default, then allow only the smallest set needed for the task.
A useful policy separates actions into levels:
- Read-only: inspect project files and run local tests.
- Workspace writes: edit files inside the mounted project directory.
- Risky actions: install packages, access the network, modify credentials, delete files, or change system configuration.
- Irreversible actions: publish code, deploy services, or remove data.
Require explicit human approval for risky and irreversible actions. Show the exact command, target files, requested network destination, and expected effect. Do not approve a vague request such as “run setup.”
Recording what the agent did
Audit logs should make the run reproducible. Record the agent identity, timestamp, sandbox image digest, approved policy, commands, exit codes, file changes, and network decisions. Keep command output, but redact tokens and other secrets. Store logs outside the writable project mount so the agent cannot alter its own history.
Stronger isolation with gVisor
Standard containers isolate processes with kernel features but still rely heavily on the host kernel. gVisor adds a user-space kernel that handles many application system calls before they reach the host kernel. This reduces the host-kernel attack surface, but may reduce compatibility and performance. Test tools that use unusual system calls.
Virtual machines and microVMs for strong isolation
A virtual machine runs a separate guest kernel. A microVM uses the same basic boundary with a smaller device model and faster startup. Both usually provide stronger separation than ordinary containers, at the cost of more memory, startup time, and operational complexity.
Choosing the right isolation level
| Situation | Suitable starting point |
|---|---|
| Trusted code, no secrets, no network | Hardened container |
| Untrusted dependencies or scripts | gVisor |
| Host compromise would be severe | MicroVM or VM |
Use a container when speed and simplicity matter. Choose gVisor or a VM when the agent processes untrusted code or has access to valuable data.
What sandboxing does not protect against
Sandboxing does not prevent malicious edits inside the mounted workspace, prompt injection, leaked secrets that were provided to the agent, unsafe approved actions, or data exfiltration through an allowed network path. Resource limits reduce denial-of-service risk but do not eliminate it. Review changes, minimize mounts and credentials, and treat external inputs as untrusted.
Exercise
Why might a microVM be preferable to a container for an agent running untrusted code?
Show answer
It provides a separate guest kernel and usually a stronger boundary from the host, although it costs more resources and operational complexity.