liveBook · Manning

Principle of least privilege

As explained in AI Agents in Action, Second Edition

Least privilege is a security principle that grants each user, process, or agent only the minimum permissions needed for its tasks.

The principle of least privilege grants users and agents only the permissions they need for their tasks. In agentic systems, that means limiting access to tools, databases, and other services rather than granting broad access by default. section 8.4.3

Treat permissions as part of the agent’s operating boundary: verify identity before exposing account data, then provide only the user’s role and associated tools. Narrow scopes reduce unnecessary access while keeping responsibilities focused. section 11.2

Apply least privilege with these practical rules:

  • Scope access to the specific tools and resources required, such as selected databases or services. section 8.4.3
  • Verify identity before account actions or revealing account data. section 11.2 section 11.5
  • Grant an agent the user’s role and associated tools instead of unrestricted capabilities. section 11.2
  • Combine access boundaries with secret management, tool sandboxing, and defenses against prompt injection. section 8.6

Customer-support triage

A support agent can use a retrieval agent and an escalate_to_human tool, while its instructions require identity verification before account actions and escalation for unclear or sensitive cases. This keeps the agent’s capabilities aligned with its support role. section 11.2

Listing 11.5 06_support_agent_tips.py
from agents import Agent, function_tool, ModelSettings

@function_tool    #1
def escalate_to_human(ticket_id: str, reason: str) -> str:
    """Escalate this conversation to a human. Use for angry users, large refunds, or unclear policy."""    
    return f"Escalated ticket {ticket_id}: {reason}"    #2

retrieval_agent = Agent(... )  #3

support = Agent(
    name="Triage Support Agent",
    instructions=(
        "Verify identity before account actions. Cite policies. "
        "If unsure or user is upset, call escalate_to_human."
        "Pass on complex queries to retrieval_agent."    #4
    ),
    tools=[escalate_to_human, retrieval_agent.as_tool()],  
    model_settings=ModelSettings(tool_choice="auto")
)

Inspect a compact support-agent configuration that exposes only escalation and retrieval tools, with identity and handoff rules in its instructions. section 11.2

How AI Agents in Action, Second Edition covers it

How deep it goes
Explains access scoping and role alignment through support-agent guidance, but does not detail permission-system implementation.
Examples
Uses customer-support triage, retrieval tools, escalation tools, databases, services, account data, and business APIs as access-scope examples.
What you can do after
Apply it via scoped support-agent tools and role-aligned permissions before exposing account data or invoking business APIs.
How it connects
Connects least privilege with identity and access management, secrets management, tool sandboxing, prompt injection defense, and observability.

Also explained in

Compare how 17 books explain principle of least privilege →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.