Tier

Adaptive tool routing for AI agents of any size.
Adapt the interface, not the model.

DOI PyPI License

The Problem

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.

35B
88%
1.5B
50%

The model isn't bad at using tools — it's bad at finding them.

The Insight

P(correct tool) = P(correct family) x P(correct tool | correct family)

Tool selection decomposes into two stages. The results are surprising:

56%
1.5B finds the right family
vs 90% for 35B
89%
1.5B picks the right tool
within the right family
vs 98% for 35B

Even a 1.5B model picks the right tool 89% of the time — when shown the right neighborhood.

The Solution

Different model sizes get different tool presentations. Same 80 tools, adapted per capability:

Tiny

< 4B parameters

8 detailed + 72 name-only

"Read file"
path: string
60%
+10pp vs baseline

Large

14B - 35B

All 80, reordered + hint

"Read file with
encoding control"
path, encoding, lines
88%
+8pp vs baseline

XL

35B+

All 80, full descriptions

"Read file with line
numbers, offset,
and encoding"
path, encoding, lines,
offset, limit
88%
baseline

Benchmark Results

1,000+ native tool calling inference calls. Ollama /api/chat with tools parameter. 80 tools, 50 prompts, 4 models.

Strategy1.5B9B20B35BTokens
Baseline (all 80)50%80%80%88%2,100-5,300
Hybrid (8+72)60%-76%-~1,800
Reorder + hint54%-88%-same
Semantic top-864%72%70%76%310-724
Family oracle70%86%84%88%400-900

Quick Start

# 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
View on GitHub