Sub topic 4
Excessive agency: too many tools, too much permission, too much autonomy
This chapter assumes you know how LLM tool calling works, can read short Python and JSON snippets, and understand basic access control such as roles and permissions. It builds on the threat model from the previous chapter: prompt injection can steer a model, and a confused deputy uses its own authority on an attacker's behalf. Excessive agency is what makes that steering expensive.
What excessive agency means
Excessive agency is a weakness where an agent can do more than its task requires, so a wrong or manipulated model decision causes real damage. The cause is not a bug in the model. The cause is a design that gives the model more reach than the job needs.
The damage can come from three sources: a prompt injection, a hallucinated tool call, or an ordinary misreading of the user's request. The fix is the same for all three. Limit what the agent can do before it decides anything.
Excessive agency has three parts. Each one has its own fix.
| Part | The problem | Example |
|---|---|---|
| Excessive functionality | The agent has tools the task never uses | A docs assistant that can also send email |
| Excessive permissions | A tool has broader rights than it needs | A read tool that connects with write access to the whole database |
| Excessive autonomy | The agent acts on high-impact steps with no check | Deleting records without anyone approving |
Excessive functionality
Agents often get a shared toolbox because it is convenient. Every extra tool is extra attack surface. If the task is answering questions from documentation, an email tool has no legitimate use, but an injected instruction in a web page can still try to call it.
A common variant is a tool that is too general. A tool such as run_shell(command) or query_database(sql) can do almost anything, so it carries the risk of everything. A narrow tool such as get_order_status(order_id) carries only its own risk.
Excessive permissions
A tool can be well named and still be dangerous because of the identity it runs under. Suppose read_report uses an administrator token. The tool only reads, but a crafted argument or a bug in the tool can reach anything the token can reach.
Here is a typical anti-pattern:
import os
# Anti-pattern: one broad credential shared by every tool and every user.
ADMIN_TOKEN = os.environ["ADMIN_TOKEN"]
def read_report(report_id: str) -> str:
# Authenticates as an administrator, even though it only needs to read.
return fetch_from_api(f"/reports/{report_id}", token=ADMIN_TOKEN)The permission is wider than the tool's purpose. Later chapters replace this with scoped, short-lived, per-user credentials.
Excessive autonomy
Autonomy is how many steps the agent takes without a person involved. Low autonomy means a person confirms each action. High autonomy means the agent plans and executes alone, possibly across many tool calls.
High autonomy is not wrong by itself. It becomes excessive when the actions are irreversible or high-impact, such as sending messages, spending money, or deleting data, and nothing checks them first. A long chain of unattended steps also gives an injected instruction more chances to take effect.
How the three parts combine
The parts multiply each other. An agent with few tools but full autonomy can still do harm with those tools. An agent with narrow tools but an admin credential can still be misused through a flaw in one tool.
A quick audit
For each agent, list every tool and answer three questions.
- Does the current task ever need this tool? If not, remove it.
- What is the most the tool's credential could do? If that is more than the tool's purpose, narrow it.
- What happens if this call is wrong and nobody notices? If the result is irreversible, add approval.
Where the fixes come next
The rest of the tutorial maps onto the three parts. Tool allowlists address functionality. Scoped credentials and argument constraints address permissions. Human approval, usage limits, and audit logging address autonomy. Enforcement must happen in ordinary code outside the model, because the model is the component you are assuming may be misled.
Exercise
An agent answers customer questions about orders. It has three tools: get_order_status(order_id), send_email(to, body), and issue_refund(order_id, amount). All three use one shared admin API key, and the agent runs each call without confirmation. Name one example of each kind of excess agency in this design.
Show answer
Excessive functionality: send_email and issue_refund are not needed to answer questions about orders. Excessive permissions: the shared admin API key gives even get_order_status far more rights than reading an order. Excessive autonomy: issue_refund and send_email run with no confirmation, although they are hard to reverse.