Adaptive tool routing for AI agents of any size.
Adapt the interface, not the model.
Every AI agent framework shows all tools identically to every model. A 1.5B model on a Raspberry Pi gets the same 80 tool descriptions as GPT-4.
The model isn't bad at using tools — it's bad at finding them.
Tool selection decomposes into two stages. The results are surprising:
Even a 1.5B model picks the right tool 89% of the time — when shown the right neighborhood.
Different model sizes get different tool presentations. Same 80 tools, adapted per capability:
8 detailed + 72 name-only
All 80, reordered + hint
All 80, full descriptions
1,000+ native tool calling inference calls. Ollama /api/chat with tools parameter. 80 tools, 50 prompts, 4 models.
| Strategy | 1.5B | 9B | 20B | 35B | Tokens |
|---|---|---|---|---|---|
| Baseline (all 80) | 50% | 80% | 80% | 88% | 2,100-5,300 |
| Hybrid (8+72) | 60% | - | 76% | - | ~1,800 |
| Reorder + hint | 54% | - | 88% | - | same |
| Semantic top-8 | 64% | 72% | 70% | 76% | 310-724 |
| Family oracle | 70% | 86% | 84% | 88% | 400-900 |
# Install pip install yantrikos-sdk # Define a tier-aware tool from yantrikos import BaseTool, ToolResult, Tier, register @register class FileReadTool(BaseTool): name = "file_read" category = "filesystem" descriptions = { Tier.S: "Read file", Tier.M: "Read a file from disk", Tier.L: "Read file with encoding control", Tier.XL: "Read file with line numbers, offset, encoding", } parameters = { Tier.S: {"path": str}, Tier.M: {"path": str, "encoding": str}, Tier.L: {"path": str, "encoding": str, "lines": bool}, Tier.XL: {"path": str, "encoding": str, "lines": bool, "offset": int}, } # Route by model tier from yantrikos import TierRouter router = TierRouter(model_name="qwen2.5:1.5b") tools = router.route("Read the file config.yaml") # Returns native tool definitions adapted for 1.5B