AI Hints
Home›Agentic AI Tutorial›Security One
Agentic AI · Lesson 60 of 100

Least Agency

Give less, get safer.

⏱ 2 min read▶ Video at 1:46:00🎓 Free
Watch this lesson in the Agentic AI courseWatch on YouTube ↗Full Agentic AI course

Security engineers have a very old rule. Least privilege. Give each thing only the access that it needs. Agents need a stronger version, because they make their own decisions. The newest guidance calls it least agency. Don't give an agent more freedom than the task requires.

Least Agency
From the video: Least Agency
  • Least privilege is an old rule
  • Agents make their own decisions
  • Least agency

Tools by role

Remember routing? Here's the safety benefit. Each route only gets the tools that it needs. A tracking request can't call refund, however it's tricked, because that tool simply doesn't exist for it. Run it. The tracking role is refused. Only the refunds role can use the refund tool. A tool that an agent doesn't have can't be misused.

scopes.pypython
ROLES = {
    "tracking": {"get_order"},
    "returns": {"get_order", "search_policy"},
    "refunds": {"get_order", "search_policy", "refund"},
}

def allowed(role, tool):
    return tool in ROLES.get(role, set())

for role, tool in [("tracking", "get_order"), ("tracking", "refund"), ("refunds", "refund")]:
    print(f"{role:<9} {tool:<10} {allowed(role, tool)}")
Output
tracking  get_order  True
tracking  refund     False
refunds   refund     True

Practical least agency

Here's how to apply it. Give read only access by default. Use separate credentials for each agent, with narrow scopes, so that a leak is contained. Use short lived tokens. Limit amounts and rates. Log every action to a place that the agent can't edit. And prefer a small set of purposeful tools over a general one, such as run any SQL.

Read-only defaultwrite only when needed
Own credentialsnarrow scopes
Short-lived tokensexpire quickly
Rate limitsper tool
Tamper-proof logsoutside the agent

Too much power, or just enough

Compare these two tools. Run any SQL gives the model your entire database. Get order summary does one safe thing. One shell command tool can do anything. A run tests tool does exactly one thing. Every powerful general tool is a risk that you've chosen to take.

Too much power

  • run_any_sql
  • run_shell_command
  • send_email(to, body)

Just enough

  • get_order_summary
  • run_tests
  • reply_to_this_customer

Summary

Fewer tools, narrower access, and tamper proof logs. Next, how to layer your defences, so that no single failure causes harm.

Key takeaways
  • Least agency, not just privilege
  • Scope tools by role
  • Prefer narrow tools
Next up: Guardrails in Layers — no single point of failure