Best Practices for Building LLM Apps

Chapter 4 · Practice 1 of 5

Give each agent the fewest, narrowest tools that do the job

From Tools, agents and least privilege

Why it matters

Every tool widens what a fooled or mistaken model can do. Give each agent only the tools its main tasks need, and make each tool as narrow as possible.

PreferOver
get_order_statusa generic run_sql
a read-only database useran admin one
scoped API tokensaccount-wide keys

Then tighten further:

  • List the tools for each agent and remove any it does not need.
  • Separate read tools from write tools, and give write tools to fewer agents.
  • Give each agent its own credentials, per environment, rather than sharing one powerful key.

The OWASP Agentic Top 10 lists tool misuse as its own risk, which is why these boundaries matter.

Do

  • Use separate credentials per agent and per environment

Avoid

  • Generic tools such as run any SQL, fetch any URL or execute any command