Skip to main content
AI & Models10 min read

Tool Sprawl Is Becoming Agent Technical Debt: Use Retrieval to Keep AI Agents Maintainable

As internal AI agents gain access to more systems, tool catalogs can become expensive, hard to govern, and difficult to maintain. Google’s Tool Retrieval in the Gemini API points to a useful architecture pattern: retrieve only the tools an agent needs for the task instead of loading every capability into every prompt.

AI agents are quickly moving from demos to internal platforms, DevOps workflows, and engineering productivity systems. But as teams connect agents to ticketing systems, CI/CD pipelines, observability tools, cloud consoles, code search, security scanners, and internal APIs, a new problem appears: the agent may have too many tools to carry around.

That is not just a token problem. It is a maintainability problem. Tool sprawl is becoming a form of agent technical debt, and retrieval-based tool selection may become one of the practical patterns that keeps agent architectures scalable.

Context: tool catalogs are growing faster than prompt budgets

Tool Sprawl Is Becoming Agent Technical Debt: Use Retrieval to Keep AI Agents Maintainable
Tool Sprawl Is Becoming Agent Technical Debt: Use Retrieval to Keep AI Agents Maintainable

Google recently introduced Tool Retrieval in the Gemini API, positioning it for agents that need access to hundreds of tools. According to Google’s announcement on the Google AI Blog, the feature helps agents dynamically select relevant tools from a larger catalog rather than including every tool definition in the prompt. The summary benefit is straightforward: agents can use fewer tokens while still having broad capabilities.

That matters because many enterprise agent projects start small. A team wires up an agent to search documentation, summarize incidents, or generate release notes. Then someone adds Jira access. Then GitHub or GitLab. Then Kubernetes diagnostics. Then cloud cost reporting. Then security findings. Eventually the agent is surrounded by dozens, then hundreds, of callable functions.

At that point, the architecture often starts to look like an overloaded command center. Every prompt carries a long list of tools, schemas, descriptions, constraints, and examples. The model spends context on possibilities that are irrelevant to the current task. Developers spend more time debugging tool selection. Platform teams struggle to answer basic governance questions: which tools can this agent use, when, and why?

Tool retrieval reframes the problem. Instead of asking the model to reason across the entire universe of available capabilities, the system retrieves a smaller, relevant subset of tools for the current task. It is the same maintainability instinct engineers already apply to code: do not import the whole world when you only need a few dependencies.

From prompt bloat to agent technical debt

Technical debt is not limited to legacy code. It appears anywhere short-term convenience creates long-term friction. In agent systems, one of the most common shortcuts is adding another tool directly to the prompt or agent configuration without reconsidering the architecture.

The early-stage pattern: just add another tool

In the early phases, this approach feels productive. Adding one more function is easy. The agent becomes more useful. A support engineer can ask it to query logs. A developer can ask it to inspect a pull request. A release manager can ask it to check deployment status.

But each added tool increases operational surface area. It adds more text to the prompt, more permission boundaries to manage, more failure modes to test, and more ambiguity for the model. If two tools have overlapping descriptions, the agent may choose the wrong one. If a tool is obsolete but still listed, it may continue to be selected. If sensitive tools are always present in context, the security model becomes harder to reason about.

Over time, the tool catalog becomes similar to an unmaintained dependency graph. Everything is technically available, but nobody is confident which capabilities are current, safe, or appropriate for a given workflow.

The cost is more than tokens

Google emphasizes that Tool Retrieval can help agents use fewer tokens. That is important, especially for high-volume internal automation where prompt size directly affects latency and cost.

However, the deeper value is architectural. Smaller prompts are easier to audit. Cleaner tool boundaries are easier to test. Retrieved tool sets are easier to log and explain. When an incident response agent selected five tools from a catalog of 300, the platform team can review those five selections instead of trying to reconstruct why the entire catalog was available.

This is where tool retrieval becomes relevant to CTOs and engineering leaders. It is not only an optimization. It is a governance and maintainability pattern.

What Tool Retrieval changes in the agent architecture

Google’s Tool Retrieval in the Gemini API points toward a layered model for agents with large capability sets. Rather than placing every tool definition in every request, teams can maintain a broader tool catalog and retrieve the most relevant tools at runtime.

A maintainable agent stack has layers

A scalable agent architecture usually needs at least four layers:

  1. A user or workflow intent layer that captures what the agent is trying to do.
  2. A retrieval layer that selects relevant knowledge, policies, and tools.
  3. A reasoning and execution layer that plans and invokes tools.
  4. An observability and governance layer that records decisions, permissions, and outcomes.

Many early agent implementations collapse these layers into one prompt. That can work for a prototype, but it becomes brittle in production. Tool retrieval separates tool discovery from tool execution, which gives teams a cleaner place to apply ranking, permissions, deprecation policies, and environment-specific controls.

For example, an internal DevOps agent may have access to tools for Kubernetes, Terraform, Datadog, PagerDuty, GitHub, cloud billing, and service ownership metadata. A request such as investigate elevated error rates for checkout should not require loading every deployment, billing, and access-management tool. The retrieval layer should identify the likely observability, ownership, and deployment tools first.

Retrieval creates better boundaries

Tool boundaries matter because tools are not just APIs. They are operational capabilities. Some read logs. Some mutate infrastructure. Some open pull requests. Some restart services. Some access customer-impacting systems.

When all tools are always present, it is easy to blur read-only and write-capable operations. With retrieval, teams can structure catalogs around boundaries such as environment, sensitivity, service ownership, operational risk, and approval requirements.

This also helps modernization efforts. Many organizations are running a mix of legacy systems, SaaS tools, cloud-native services, and internal platforms. A retrieved tool catalog can hide some of that complexity from the agent while preserving clear integration contracts. Instead of bloating every prompt with legacy-specific instructions, teams can expose well-described tools that map to stable maintenance workflows.

Lessons from adjacent agent operations work

The broader AI engineering ecosystem is converging on the same idea: production agents need systems around them, not just bigger prompts.

OpenAI’s article on its Performance Factory describes Codex-powered workflows used to find and fix performance issues. The lesson for engineering teams is that agentic automation becomes more valuable when it is embedded in a repeatable operating system: measurement, issue discovery, code changes, review, and feedback.

Similarly, OpenAI’s Daybreak Red reference architecture for supervised security investigations highlights the need for safety controls, setup, and monitoring when agents participate in sensitive workflows. The Codex Security Plugin demo points in the same direction: security-oriented agents must produce reviewable results and fit into existing developer workflows.

These examples are not about tool retrieval specifically, but they reinforce the same operating principle. As agents become part of engineering systems, teams need architecture, policy, and observability. Tool retrieval is one mechanism that helps keep that architecture manageable.

Practical implications for engineering teams

If your organization is adding AI agents to internal platforms, now is the time to treat tool catalogs as a first-class design concern. Waiting until you have hundreds of tools makes cleanup harder.

1. Build a tool registry, not a pile of functions

Create a central registry for agent tools. Each tool should have metadata: owner, description, input schema, output schema, permissions, risk level, environment, deprecation status, and examples of appropriate use.

This registry becomes the source of truth for retrieval. It also makes maintenance easier. If a tool maps to an old API that is being replaced, you can mark it deprecated, route usage to a modern equivalent, or remove it from retrieval results without editing every agent prompt.

2. Separate tool discovery from tool execution

Do not make the model choose from the full catalog by default. Introduce a retrieval step that selects a short list of candidate tools based on task intent, user role, service context, and operational state.

This can reduce token usage, but it also improves reliability. A smaller candidate set gives the model fewer opportunities to select an unrelated or unsafe tool.

3. Design for least privilege

Tool retrieval should not be only semantic search. It should respect authorization. A developer asking about a staging deployment should not retrieve production mutation tools unless the workflow explicitly requires them and the user has appropriate permissions.

Think of retrieval as policy-aware routing. The best tool for a task is not just the most semantically similar tool. It is the most relevant tool the agent is allowed to use in that context.

4. Log retrieved tools and rejected tools

For maintainability, log which tools were retrieved, which were invoked, and why. If possible, also log high-ranking tools that were rejected because of permissions, environment, or risk controls.

These logs are valuable during incident reviews and platform tuning. They help answer whether the agent failed because the right tool did not exist, the retrieval layer missed it, the model chose poorly, or the tool itself returned bad data.

5. Treat tool descriptions like production interfaces

A vague tool description is a reliability bug. If two tools sound similar, the agent may choose inconsistently. Maintain tool descriptions with the same care you apply to API docs, runbooks, and interface contracts.

Good descriptions should state what the tool does, when to use it, when not to use it, required inputs, expected outputs, side effects, and safety constraints.

Where this fits into modernization strategy

For teams modernizing legacy systems, agents can be a useful bridge. They can help engineers navigate old codebases, correlate incidents across fragmented systems, and automate repetitive maintenance work. But if every legacy integration becomes another always-on tool in the prompt, modernization efforts can recreate the same complexity in a new layer.

Tool retrieval supports a cleaner approach. Teams can wrap legacy capabilities in well-defined tools, place them in a governed catalog, and retrieve them only when relevant. As systems are upgraded or retired, the tool registry can evolve without rewriting the entire agent experience.

This is especially relevant for DevOps automation. A platform agent may need broad awareness across CI/CD, infrastructure, observability, service catalogs, security scanners, and change management. Retrieval lets that agent remain broad without becoming bloated.

Conclusion: the next agent architecture is smaller at runtime

The future of internal AI agents is not one giant prompt with every possible capability attached. It is a governed system that can find the right context and the right tools at the right time.

Google’s Tool Retrieval in the Gemini API is a timely signal that agent platforms are moving toward more scalable patterns for large tool catalogs. For engineering leaders, the practical takeaway is clear: as agents become part of software maintenance and modernization workflows, tool retrieval can help reduce token usage, improve governance, and keep automation architectures maintainable.

Agent capability will keep expanding. The teams that succeed will be the ones that keep runtime context intentionally small, tool boundaries clean, and maintenance responsibilities visible.

Vibgrate CLI

See a real scan run

A replay of the actual CLI running against our test repositories — live progress, real findings, a genuine DriftScore. Nothing executes in your browser.

Replay
demo@vibgrate — bash
❯ npx @vibgrate/cli scan
 
╭──────────────────────────────────────────╮
│ Vibgrate Drift Report │
╰──────────────────────────────────────────╯
 
── node-turborepo (node) .
Runtime: >=18.0.0 (8 majors behind)
Frameworks:
Turbo: 1.13.4 → 2.11.13 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
1 current 1 1-behind 3 2+ behind 1 unknown
 
── @repo/admin (node) apps/admin
Frameworks:
TanStack Query: 5.108.4 → 5.108.4 (current)
React: 18.3.1 → 19.3.1 (1 behind)
React DOM: 18.3.1 → 19.3.1 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vite: 5.4.21 → 8.4.1 (3 behind)
Dependencies:
3 current 9 1-behind 3 2+ behind 4 unknown
 
── @repo/api (node) apps/api
Frameworks:
Express: 4.22.3 → 5.3.0 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vitest: 1.6.1 → 5.1.2 (4 behind)
Dependencies:
7 current 4 1-behind 4 2+ behind 4 unknown
 
── @repo/web (node) apps/web
Frameworks:
Next.js: 14.2.35 → 16.5.0 (2 behind)
React: 18.3.1 → 19.3.1 (1 behind)
React DOM: 18.3.1 → 19.3.1 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
2 current 6 1-behind 3 2+ behind 5 unknown
 
── @repo/config (node) packages/config
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
2 current 2 1-behind 5 2+ behind 0 unknown
 
── @repo/database (node) packages/database
Frameworks:
Prisma: 5.22.0 → 7.10.1 (2 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
1 current 0 1-behind 3 2+ behind 1 unknown
 
── @repo/types (node) packages/types
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
0 current 0 1-behind 1 2+ behind 1 unknown
 
── @repo/ui (node) packages/ui
Frameworks:
React: 18.3.1 → 19.3.1 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
React: 18.3.1 → 19.3.1 (1 behind)
Dependencies:
1 current 4 1-behind 1 2+ behind 1 unknown
 
── @repo/utils (node) packages/utils
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vitest: 1.6.1 → 5.1.2 (4 behind)
Dependencies:
0 current 1 1-behind 2 2+ behind 1 unknown
 
Tech Stack
Frontend: React, React DOM
Meta-frameworks: Next.js
Bundlers: tsx, Turbo, Vite
CSS / UI: Autoprefixer, PostCSS, Tailwind CSS
Backend: Express
ORM / Database: Prisma, Prisma Client
Testing: Vitest
Lint & Format: ESLint, ESLint Prettier, ESLint React, Prettier, typescript-eslint
 
Services & Integrations
Auth: JWT 9.0.3
Databases: Prisma 5.22.0
 
TypeScript
v5.3.3 · strict ✔ · MIXED · target: ES2022
 
Build & Deploy
Package Managers: pnpm
Monorepo: npm-workspaces, pnpm-workspaces, turbo
 
Product Purpose Signals
Frameworks: react, nextjs
Evidence: 177
Top Signals:
- [heading] Dashboard (apps/admin/src/pages/Dashboard.tsx)
- [title] Revenue Overview (apps/admin/src/pages/Dashboard.tsx)
- [copy] workspace:* (packages/ui/package.json)
- [copy] ./dist (packages/ui/tsconfig.json)
- [copy] ./src/index.ts (packages/ui/package.json)
- [copy] @repo/config/tsconfig-base.json (packages/ui/tsconfig.json)
- [copy] @repo/ui (packages/ui/package.json)
- [copy] #3b82f6 (apps/admin/src/pages/Dashboard.tsx)
Unknowns:
- No pricing or billing evidence found.
- No integrations/connectors evidence found.
- No route structure evidence found.
 
Security Posture
Lockfile ✖ · node_modules ✔
 
Platform
Native modules: turbo
 
Code Quality
Files: 36 · Functions: 183 · Avg complexity: 2.62 · Avg length: 21.13 lines
Max nesting: 2 · Circular deps: 0 · Dead code: 0%
God files: apps/admin/src/pages/Products (448 lines)
 
Database Schema
postgresql · 8 models · 1 enum
Models: Address, CartItem, Category, Order, OrderItem (+3 more)
 
Findings (16 errors, 11 warnings)
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.11).
vibgrate/dependency-major-lag in .
✖ 60% of dependencies are 2+ major versions behind in node-turborepo.
vibgrate/dependency-rot in .
✖ Node.js runtime ">=18.0.0" reached end-of-life on 2025-04-30 (latest: 26.0.0).
vibgrate/runtime-eol in .
✖ vite is 3 major versions behind (spec: ^5.0.12, latest: 8.4.1).
vibgrate/dependency-major-lag in apps/admin
✖ Vite is 3 major versions behind (current: 5.4.21, latest: 8.4.1).
vibgrate/framework-major-lag in apps/admin
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.11).
vibgrate/dependency-major-lag in apps/api
✖ vitest is 4 major versions behind (spec: ^1.2.1, latest: 5.1.2).
vibgrate/dependency-major-lag in apps/api
✖ Vitest is 4 major versions behind (current: 1.6.1, latest: 5.1.2).
vibgrate/framework-major-lag in apps/api
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.11).
vibgrate/dependency-major-lag in apps/web
✖ eslint-plugin-react-hooks is 3 major versions behind (spec: ^4.6.0, latest: 7.1.1).
vibgrate/dependency-major-lag in packages/config
✖ 56% of dependencies are 2+ major versions behind in @repo/config.
vibgrate/dependency-rot in packages/config
✖ 75% of dependencies are 2+ major versions behind in @repo/database.
vibgrate/dependency-rot in packages/database
✖ 100% of dependencies are 2+ major versions behind in @repo/types.
vibgrate/dependency-rot in packages/types
✖ vitest is 4 major versions behind (spec: ^1.2.1, latest: 5.1.2).
vibgrate/dependency-major-lag in packages/utils
✖ 67% of dependencies are 2+ major versions behind in @repo/utils.
vibgrate/dependency-rot in packages/utils
✖ Vitest is 4 major versions behind (current: 1.6.1, latest: 5.1.2).
vibgrate/framework-major-lag in packages/utils
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in .
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/admin
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/api
⚠ Next.js is 2 major versions behind (current: 14.2.35, latest: 16.5.0).
vibgrate/framework-major-lag in apps/web
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/web
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/config
⚠ Prisma is 2 major versions behind (current: 5.22.0, latest: 7.10.1).
vibgrate/framework-major-lag in packages/database
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/database
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/types
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/ui
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/utils
 
╭──────────────────────────────────────────╮
│ Top Priority Actions │
╰──────────────────────────────────────────╯
 
1. Upgrade EOL runtime in node-turborepo
End-of-life runtimes no longer receive security patches and block ecosystem upgrades.
./.
>=18.0.0 → 26.0.0 (8 majors behind)
Impact: −10 drift points (runtime & EOL)
 
2. Fix security posture: no lockfile found
Without a lockfile, installs are non-deterministic. Run the install command to generate one and commit it.
./
Missing: package-lock.json, pnpm-lock.yaml, or yarn.lock
 
3. Upgrade Vitest 1.6.1 → 5.1.2 in @repo/api (+2 more)
4 major versions behind. Major framework drift increases breaking change risk and blocks access to security fixes and performance improvements.
./apps/api
Vitest: 1.6.1 → 5.1.2 (4 majors behind)
./packages/utils
Vitest: 1.6.1 → 5.1.2 (4 majors behind)
./apps/admin
Vite: 5.4.21 → 8.4.1 (3 majors behind)
Impact: −5–15 drift points
 
4. Reduce dependency rot in @repo/types (100% severely outdated)
1 of 1 dependencies are 2+ majors behind. Run `npm outdated` and prioritise packages with known CVEs or breaking API changes.
./packages/types
typescript: 5.9.3 → 7.0.2 (2 majors behind)
Impact: −5–10 drift points
 
5. Reduce dependency rot in @repo/database (75% severely outdated)
3 of 4 dependencies are 2+ majors behind. Run `npm outdated` and prioritise packages with known CVEs or breaking API changes.
./packages/database
@prisma/client: 5.22.0 → 7.10.1 (2 majors behind)
prisma: 5.22.0 → 7.10.1 (2 majors behind)
typescript: 5.9.3 → 7.0.2 (2 majors behind)
Impact: −5–10 drift points
 
╭──────────────────────────────────────────╮
│ Architecture Layers │
╰──────────────────────────────────────────╯
 
Archetype: nextjs (80% confidence)
Files classified: 24 (11 unclassified)
Folders classified: 8
apps/admin/src presentation 100% 4 files
apps/admin/src/pages presentation 100% 2 files
apps/api/src/middleware middleware 100% 2 files
apps/api/src/routes routing 100% 2 files
apps/web/src/app presentation 100% 4 files
apps/web/src/app/products presentation 100% 2 files
apps/web/src/app/products/[id] presentation 100% 1 file
packages/ui/src presentation 100% 6 files
Unclassified source (sample): 11
 
presentation 15 files drift ████████████████████ 100 risk high
routing 4 files drift ████████████████████ 100 risk high
middleware 2 files drift ███████▍░░░░░░░░░░░░ 37 risk moderate
config 2 files drift ░░░░░░░░░░░░░░░░░░░░ 0 risk none
shared 1 file drift ████████████████████ 100 risk high
 
╭──────────────────────────────────────────╮
│ DriftScore Summary │
╰──────────────────────────────────────────╯
 
DriftScore: 70/100
Risk Level: HIGH
Projects: 9
Classified: 8 nano · 1 micro · 0 small · 0 standard
Billable: 0.42 · 9 detected → 0.42 billable projects (micro-project pricing)
0.1 micro · 0.32 nano
These fractions add up across repositories, then round down to whole billable projects.
 
Score Breakdown
Runtime: ████████████████████ 100
Frameworks: ███████████▊░░░░░░░░ 59
Dependencies: ███████▏░░░░░░░░░░░░ 36
EOL Risk: ████████████████████ 100
 
Scanned at 2026-12-04T09:51:34.300Z · 5.0s · 286 files scanned · 56 workspace files · 27 dirs
❯
Press Run to start.