Zero Labs
Industry News / AI

The 10,000-Tool Agent

Source · Towards AI By Sami Marreed

From the publisher’s feed, collected in the ZeroLabs newsroom.

Why dumping every API into a single MCP context is quietly killing your agents — and the architectures that actually scale.Co-authored by Sami Marreed, Mansura H., Michal Ulewicz, Offer Akrabi, Rodrigo AraujoWe’ve reached a critical inflection point in production agentic AI. The “Hello World” era — connecting an LLM to a calculator or a weather API — is over. The agents being built today need access to hundreds, sometimes thousands of APIs, scripts, and database queries simultaneously.And the standard response? Dump every tool definition into a system prompt or a single Model Context Protocol (MCP) endpoint and hope the model figures it out.This is a mistake. And it’s quietly breaking production systems everywhere.The Monolithic Tooling ProblemWhen you expose 500+ tools through a single MCP, you hit two walls at once.Context Saturation. You burn thousands of tokens just describing tools the agent will never touch. On a query about sending an email, the model is reading through your entire AWS S3 API surface before thinking about a single line of response.Analysis Paralysis. Give a model 800 tools and ask it to pick three, and it will either hallucinate a parameter, select the wrong variant, or get stuck. This isn’t a model failure — it’s an architecture failure.“The problem isn’t that LLMs can’t use tools. It’s that we’re asking them to find a needle in a haystack before they’ve understood the question.”What follows is a breakdown of the leading architectural patterns for dealing with the Large Tool Problem — culminating in how we solved it in production.Pattern 1: The Multi-Layered MCPInstead of giving the agent your tools, you give it tools to find tools. The agent treats the tool registry like a filesystem it must navigate before using anything.Figure 1 — The agent navigates a hierarchy of abstractions before touching a real tool.The architecture splits into three layers: a Discovery Layer where the agent searches for the right category; a Planning Layer where it receives schemas only for that domain; and an Execution Layer where it finally invokes the function.The tradeoff: Navigation costs money and time. A simple task now requires 2–3 extra LLM round-trips. If the discovery layer isn’t intuitive, the agent can fail to find a tool that actually exists — you’ve traded one failure mode for another.When it wins: High tool density in a specific domain. If your agent needs deep access to a complex proprietary codebase or a single cloud platform, the logical grouping matches how the domain actually works.Pattern 2: The Tool LakeThis is RAG for tools. Every tool definition lives in a database. At query time, you embed the user’s intent and retrieve only the most semantically relevant tools. The agent never sees the other 9,997.Figure 2 — The agent’s context receives only the tools relevant to this specific query.The key insight: you decouple the existence of a tool from the context of the agent. Your library can grow to 10,000 tools without degrading performance — because the agent never sees the full list.The dangerous failure mode: retrieval misses. If the user asks about “EC2” and your tool is described as “Virtual Machine,” semantic search might catch it. If it doesn’t, the agent is powerless — it doesn’t even know the tool exists.Why Embeddings Alone Aren’t EnoughHere’s a simple example that exposes the fundamental limitation.Query: “What is the area of Poland?”Available tools: fetch_content (web search) and evaluate_expression (calculator).Run purely embedding-based similarity and the calculator wins. “Area” has strong semantic overlap with math and geometry in the embedding space — evaluate_expression scores 0.4485 versus 0.3519 for fetch_content.The agent is now equipped with a calculator to answer a geography question. It cannot succeed.Embeddings capture surface semantic similarity, not intent. Connecting this query to the right tool requires world knowledge and reasoning — not vector distance.Pattern 3: The Two-Stage ApproachUse each component for what it’s actually good at. Embeddings are fast and eliminate irrelevant tools at scale. LLMs are precise and understand intent, tool chaining, and complex workflows. Neither is sufficient alone.Figure 3 — For small sets, go straight to Stage 2. For large ones, use embeddings to filter first.For small tool sets (N ≤ k), skip embeddings entirely. For large sets, use embeddings to narrow down to k candidates (20 in this example), then let the LLM choose the best 1–3. Crucially, the reranker doesn't need to be a large model — latency matters here. A fast model like GPT-3.5-turbo is deliberate.Pattern 4: Multi-Agent Routing (The Supervisor Approach)Instead of giving a single agent access to thousands of tools, you introduce a “Router” or “Supervisor” agent. The supervisor has no tools of its own — only the ability to evaluate intent and delegate the task to a highly specialized sub-agent.In fact, we recently introduced this exact architecture into the CUGA ecosystem. Using the CugaSupervisor, developers can define multiple specialized CugaAgent capabilities (e.g., a GitHub Agent with only 50 repo-specific tools, and a Salesforce Agent with 100 CRM tools) while having the supervisor intelligently manage the routing.Figure 4 — The Supervisor delegates the user’s request to specialized, domain-specific agents.Pros: Excellent context isolation. Each sub-agent is laser-focused on its specific toolset, making the system highly token-efficient, less prone to hallucination, and much easier to debug.Cons: Struggles heavily with cross-domain tasks. If a user asks to “Find the bug in GitHub and DM the assignee on Slack”, the supervisor must coordinate complex, multi-step handoffs between agents rather than executing a fluid chain directly.Pattern 5: Tool Dependency GraphsRather than relying on flat vector embeddings, tools are mapped onto a knowledge graph based on their inputs and outputs (e.g., the output of a get_user_id tool directly links to the required input of a reset_password tool). This structurally solves the "tool chaining" problem by mapping the legal paths between APIs upfront, though building and maintaining this ontology is highly complex.(Other emerging techniques — like fine-tuning models specifically on your API schemas to bake them into the weights, or using agent-driven pagination where the agent actively searches a registry — also exist, but generally trade away too much flexibility or latency for general production use.)Open Source Case StudyHow We Built This Into CUGATheory is one thing. Here’s how we implemented the Two-Stage approach inside a single CUGA Agent — an open-source generalist agent built to orchestrate across vast tool ecosystems seamlessly.CUGA’s challenge was acute: it needed to work across Jira, Slack, Gmail, Salesforce, GitHub, and dozens of internal APIs simultaneously. A user might say “create a ticket for the production bug Omer reported yesterday and link it to the relevant Slack thread” — and the agent needs to pick the exact right tools from thousands of options, in the right order, with the right parameters.Figure 5 — CUGA’s complete tool provider pipeline, from startup to execution.Initialization: front-loading the costOn startup, CUGA loads every registered app. For any app with more than 100 tools, we automatically generate embeddings and store them in ChromaDB. Apps with fewer tools are served directly — the vector search overhead isn’t worth it below that threshold. Embedding 500 tools once at boot is vastly cheaper than re-embedding at every query.The Shortlister: where the intelligence livesThe LLM Shortlister isn’t just picking the most similar tool — it’s reasoning about the entire workflow. For each candidate it evaluates: does it directly match what the user asked? Are required parameters available from user input or from another tool’s output? Can it participate in a chain?The output is a structured ShortListerOutput: a thoughts array with the reasoning chain, and a result array with each tool's name, relevance score (0–1), and explicit reasoning. The agent arrives knowing not just which tools to use, but why and in what order.Production result: Tool selection accuracy increased from ~61% (monolithic MCP) to ~94% (two-stage) across 200 multi-step queries over 8 apps. Hallucinated parameter errors dropped by 78%.We give the Shortlister more candidates than it needs so it can reason about chaining across the full set. It returns only the 1–3 it’s confident about.The VerdictThere’s no silver bullet, but the decision tree is becoming clear.Use Multi-Layered MCP for deep, domain-specific agents where logical grouping mirrors the domain structure. Use Tool Lake (embeddings alone) for broad coverage with straightforward queries where retrieval misses are acceptable. Use Two-Stage for any generalist agent bridging multiple products, and wrap it in a Supervisor when you need to strictly separate distinct domains.The future is likely a hybrid: a small core context of the most common tools always present, plus a discovery fallback that reaches into the database when the agent hits a dead end. That’s the direction we’re building toward.Two further enhancements sit on the near-term roadmap for the CUGA project. First, description augmentation: before computing embeddings, enriching each tool description — either by expanding it or by generating the natural-language questions it answers — so that semantic similarity to real user queries is structurally higher from the start. Second, fully integrating the offline tool dependency graphs discussed above to automate cross-tool chaining structurally.Want to see the two-stage architecture and supervisor routing in action? You can explore the complete code, test the Shortlister logic yourself, and contribute to these roadmap features over at the cuga-agent GitHub repository.Meet the AuthorsRodrigo Araujo — AI Technical AdvocateMichał Ulewicz — AI Technical AdvocateMansura Habiba — Principal Architect, Project SolisSami Marreed — Staff Engineer, CUGA AgentOffer Akrabi — Engineer, CUGA AgentThe 10,000-Tool Agent was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.