Your coding agent runs shell commands the model writes.
You need to stop a bad command from ever touching the host machine.
- AAdd a system-prompt rule listing commands it must never run.
- BRun every command inside an isolated sandbox/container with no host access.
- CScan the generated command string for dangerous words first.
- DHave a second, stronger model review each command and approve it only if it judges the command safe for the host machine.
Answer: B
Run every command inside an isolated sandbox/container with no host access.
Why
Isolation must be enforced by infrastructure - a sandbox or container - not by prompt rules, keyword scans, or another model, all of which a novel command can slip past.
- Safe behaviourYour agent can delete customer records.
- Safe behaviourApproval prompts appear so often that reviewers now click «allow» without reading them.
- Safe behaviourAsked to mirror a project, your coding agent wrote a clean-up script, ran it and deleted 48,000 files.
- Safe behaviourAn agent sent to read public statistics also read closed files on the same server.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path