When to reach for it
- Multiple agents operate across different trust zones.
- Sensitive data or actions are involved.
- Security boundaries should be architecturally visible.
Each agent sees the smallest world that lets it do its job.
Each agent receives only the tools, data, and permissions its specific task requires — the principle of least privilege applied to agents, so a compromised or misdirected agent can reach only its own blast radius rather than the whole system.
In practiceA content-moderation agent is granted read access to the user-content database and write access to a quarantine bucket only, so even a prompt-injection cannot instruct it to delete production records.
Without itWithout least privilege, a single compromised or misdirected agent holds keys to the entire system, turning a model error into a platform-wide incident. See the anti-pattern →
Each agent is given the tools, data and permissions of its own task and no others. If one agent is misled, the damage ends at the edge of what that agent was allowed to do.
1 · Design
2 · At run time
| Agent | May do | Sees the post | Effect |
|---|---|---|---|
| Moderation | Read user content, move items to quarantine | Yes | None. It has no tool that deletes or posts |
| Reply | Read approved content, post one reply per thread | Only if moderation approves it | At most one reply |
| Admin | Delete accounts, after a person approves | Never | Not reachable from the post |
ROLES = {
"moderation": {"tools": {"read_content", "quarantine"}, "data": {"user_content": "read"}},
"reply": {"tools": {"read_approved", "post_reply"}, "data": {"approved_content": "read"}},
"admin": {"tools": {"delete_account"}, "data": {"accounts": "write"}},
}
def build_agent(role):
grant = ROLES[role] # deny by default: nothing else exists
return Agent(
instructions=PROMPTS[role],
# other tools are not in its context
tools=[TOOLS[name] for name in grant["tools"]],
credentials=issue_credentials(role, grant["data"]),
)
def call_tool(agent_role, tool_name, arguments):
# checked outside the model
if tool_name not in ROLES[agent_role]["tools"]:
raise PermissionError(f"{agent_role} may not call {tool_name}")
return TOOLS[tool_name](**arguments)When to reach for it
When it backfires
Multiple agents reuse the same 'shared' role for convenience. The role accretes every permission anyone ever needed; least privilege is the name, not the practice.
Countermeasure
Bind permissions to the agent definition, not to a shared role. Generate the role from the declared toolset at deploy time.
The agent is granted only a 'read report' tool, but that tool authenticates with a service account that can also write. The agent's blast radius is the tool's permissions, not its own grant.
Countermeasure
Scope the credentials the tool itself runs with, not just which tools the agent may call. Audit each tool's effective permissions against the agent's intended scope.
EU law
Duties from EU law that this pattern helps meet, or that land on it. A reading aid, not legal advice.
An engineer's reading aid, not legal advice. The legal texts and their interpretation are authoritative.
Keep going
Search patterns, frameworks, and pages.