Module 5: Safety, testing and cost · 9 min
Guardrails and least privilege
Give an agent the smallest set of powers it needs, and no more. This is called least privilege.
- Use a separate account or key for the agent, with read-only access if writing is not needed.
- Allow-list tools and allowed values. Block everything else.
- Set limits: maximum steps, maximum spend, maximum files changed.
- Run risky actions (running code) in a sandbox that cannot reach important systems.
- Keep secrets out of prompts. Tools should hold keys, not the model.