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

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:
- A user or workflow intent layer that captures what the agent is trying to do.
- A retrieval layer that selects relevant knowledge, policies, and tools.
- A reasoning and execution layer that plans and invokes tools.
- 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.
