ANTIGRAVITY LABJP
Articles/Agents & Manager
Agents & Manager/2026-06-03Advanced

Choosing the Right Granularity for an Agent's Tools — Bundle or Split?

Should you split an agent's tools finely or bundle them coarsely? A single decision rule, an intentionally asymmetric two-tier design for destructive actions, and real numbers from running six apps.

AI agents24tool designAntigravity338function calling2architecture19

Premium Article

When I give an agent a new tool, the thing I agonize over most is not the feature itself but how large a slice to carve it into. Do I split things finely, like readFile and writeFile, or do I fold a whole chunk of work into one updateConfig? It looks like a trivial design choice. In practice it turned out to be a surprisingly deep one — it quietly decides whether the agent behaves intelligently or not.

I have been building apps on my own since 2014. Today I run six of them across iOS and Android (around 50 million downloads in total) while handing the upkeep of four technical blogs to agents. At that scale there is almost no time left to approve each individual action by hand. That is exactly why "which tools, at what granularity" silently governs how stable the whole operation is. In this article I want to walk through the granularity rule I arrived at the long way round, and the two-tier structure I use for destructive actions, with real code and real numbers.

Tools that are too fine — or too coarse — leave the agent lost

My first mistake was turning API endpoints directly into tools. When I tried to semi-automate optimizing my AdMob mediation settings through Claude in Chrome, I copied the UI's units of operation straight into tools: getAdUnit, listMediationGroups, getEcpmFloor, setEcpmFloor, enableNetwork, and so on.

The results were underwhelming. To achieve a single goal — "align the eCPM floor across every network for this ad unit" — the agent would call five or six tools, each time re-reading the previous return value to assemble the next step. Misread the shape of one return value along the way, and every step after it drifted quietly off course. What I was watching was not a clever agent but an agent straining to follow a detailed instruction sheet one line at a time.

Reacting against that, I once built a single all-in-one optimizeMediation tool. Now the agent only had to call once — but from the outside no one could see what was happening inside it, and there was no room at all to step in and say "actually, don't make that change right now." A tool that is too coarse makes the agent look smart while stripping the human of any control point.

After bouncing between those extremes, something finally clicked. Granularity is not a question of "how many pieces," but of "where the decision happens."

The rule: does it resolve in one decision?

The rule I use now is a single one. Does this tool call resolve within one of the agent's decisions?

By "decision" I mean the unit in which the agent reasons about what to do next. Reading a value with getEcpmFloor and then writing it back with setEcpmFloor is, in a human's head, one decision: "adjust the floor." Yet when the tools are split, the agent is forced to cleave that single decision in two at the tool boundary. Into the seam between the halves slips a misread, an interruption, or some unrelated detour.

So I started mapping the unit a human feels as "doing one thing" onto one tool. If a read and the write that depends on it always happen together, I fold them into a single tool. Conversely, the places where the agent genuinely wants to branch its judgment — like "which ad unit do I target?" — I deliberately keep as separate tools.

It sounds simple stated plainly, but having this rule kept my design from wobbling. Whenever I hesitate over "should I split this?", I just re-ask: "Is this one decision for the agent, or two?" The answer falls out.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
The single rule that decides tool granularity: does the call resolve in one decision?
Three failures caused by tools that are too fine, and the control you lose with tools that are too coarse
A two-tier design that deliberately lowers granularity for destructive actions, with TypeScript code and production numbers
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Agents & Manager2026-07-15
When Your Agent Commits a .bak File: Why Fix-Tool Artifacts End Up in Git
Backup files like .bak and .orig slip into commits after an agent runs a --fix tool. Here are the reproduction conditions, the real root cause, and three fixes: narrowing the staged scope, wrapping the fixer, and adding a pre-commit extension gate.
Agents & Manager2026-06-30
When the Android CLI Got 3x Faster and Cut Tokens by ~70%, the Right Move Was More Verification Per Change — Not More Parallelism
Reading that the Android CLI agent runs ~3x faster while using ~70% fewer tokens, my first instinct was to ask how many runs to parallelize. But a faster agent doesn't change how much work ships — it changes where the queue forms. This walks through why, sizes the new bottleneck (review and verification gates) with Little's Law, enforces a WIP cap with a working Python admission controller, and reinvests the freed budget into depth per change — with measured results.
Agents & Manager2026-06-22
Stop Hard-Coding Your Agent Concurrency: Let It Tune Itself From What It Observes
When you run several Antigravity 2.0 agents in parallel, a single fixed concurrency number is wrong twice: it stalls at 429s during the day and idles capacity at night. Here is an adaptive design borrowed from TCP congestion control — additive increase, multiplicative decrease — that moves your concurrency from observed signals, with working Python and field notes.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →