When to use it
Use this prompt before you give a coding agent access to a real repository, a CI pipeline or a cloud environment. It turns a plain description of what the agent should and should not do into a written policy covering files, network, credentials, approvals and logging. Containment is no longer a niche concern: California’s lawsuit over OpenAI’s test agents, covered in our story on the California attorney general’s suit, turns on whether agents were properly contained. Our explainer on AI agent sandboxing describes the isolation options the prompt asks you to choose between.
How to customize it
- [WHERE IT RUNS] changes everything. A local terminal agent shares your machine and your logged-in sessions; a cloud container starts clean. Say which.
- [TASKS THE AGENT MUST DO] should be concrete verbs. “Help with the code” gives the model nothing to scope; “run the test suite and fix failing tests” does.
- [TASKS IT MUST NEVER DO] is where you name the real risks, such as production deploys, customer data or billing systems.
- [SANDBOX OPTIONS] should list only what your tools really support, so the policy can be implemented.
- [SECRETS] should list names only, never values. The point is to decide which ones stay out of the agent’s reach.
Why it works
Starting from tasks rather than from permissions forces every rule to have a reason, which is the core of least privilege. Default-deny networking with a per-task allowlist closes the most common route for damage, since agents that misbehave usually do it over the network. The “CHECK DOCS” label stops the model from inventing configuration options your tool does not have. Ending with risks and tests turns the policy into something you can verify rather than trust.
Tips and variations
- Paste the resulting policy into your agent tool’s real configuration, then run the suggested tests before giving the agent real work.
- Re-run the prompt whenever you add a new task; new tasks are the usual way permissions creep.
- For CI agents, ask for a separate policy for pull requests from forks, which should get even less access.
- Have a second person review the approvals list. The model cannot know your organization’s change-control rules.