Agents
Large toolsets
Hundreds of tools don’t fit in context: search for tools, call in parallel, or let the model write code.
What it is and why it exists
Every tool schema costs tokens and adds choice confusion. Options: tool search (load definitions on demand), grouping tools behind sub-agents, parallel tool calls for independent lookups, and code execution where the model writes a script that calls many tools without round-tripping each result through the context.
Quick prototype
All tools in every request.
In production, at scale
A curated core set always loaded, deferred tools discoverable by search, per-route tool subsets, and measured tool-selection accuracy.
Vendors and tools
| Tool search features (Anthropic, OpenAI) | Defer loading of tool definitions |
|---|---|
| Code-execution with MCP | Agents calling tools from generated code |
How it fails
- 30k tokens of tool schemas per call
- Similar tools with overlapping descriptions
What the interviewer asks next
Why can “code mode” be cheaper?
Intermediate results stay in the sandbox; only the final, filtered result returns to the model, instead of every tool output passing through the context.