crewai - 💡(How to fix) Fix Proposal: Tier-aware tool definitions for multi-model crews [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#5100Fetched 2026-04-08 01:35:21
View on GitHub
Comments
1
Participants
1
Timeline
0
Reactions
0
Author
Participants

Code Example

from crewai.tools import tool

@tool("File Reader")
def file_read(path: str, encoding: str = "utf-8",
              line_numbers: bool = False, offset: int = 0) -> str:
    """Read file contents with line numbers, offset, and encoding control."""
    with open(path, encoding=encoding) as f:
        return f.read()

---

from crewai import Agent, Crew, Task
from yantrikos import BaseTool, Tier, TierRouter, 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, "line_numbers": bool},
        Tier.XL: {"path": str, "encoding": str, "line_numbers": bool, "offset": int},
    }

# Each agent gets tools adapted to its model
researcher = Agent(
    role="Researcher",
    llm="gpt-4o",              # XL tier — gets full tool descriptions
    tools=TierRouter("gpt-4o").route("..."),
)

classifier = Agent(
    role="Classifier",
    llm="ollama/qwen2.5:1.5b", # S tier — gets minimal descriptions
    tools=TierRouter("qwen2.5:1.5b").route("..."),
)
RAW_BUFFERClick to expand / collapse

Problem

CrewAI crews can have agents backed by different models — a researcher on GPT-4, a writer on a local 7B, a classifier on a 1.5B. But every agent receives the same tool definitions regardless of its backing model's capability.

With 30+ tools in a crew, smaller agents waste tokens and misselect tools. Benchmarks show a 1.5B model achieves only 50% tool selection accuracy with 80 tools via native tool calling.

Key Finding

Across 1,000+ benchmarks (Ollama native tool calling, 80 tools, 4 model sizes):

ModelP(correct family)P(correct tool | family)
1.5B56%89%
35B90%98%

Even a 1.5B model picks the right tool 89% of the time — when shown the right tool neighborhood. The problem is navigation, not selection.

Proposed: Tier-Aware Tools for CrewAI

Current CrewAI tool:

from crewai.tools import tool

@tool("File Reader")
def file_read(path: str, encoding: str = "utf-8",
              line_numbers: bool = False, offset: int = 0) -> str:
    """Read file contents with line numbers, offset, and encoding control."""
    with open(path, encoding=encoding) as f:
        return f.read()

Every agent sees: full description + 4 parameters. A 1.5B classifier agent doesn't need line_numbers or offset.

With tier awareness:

from crewai import Agent, Crew, Task
from yantrikos import BaseTool, Tier, TierRouter, 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, "line_numbers": bool},
        Tier.XL: {"path": str, "encoding": str, "line_numbers": bool, "offset": int},
    }

# Each agent gets tools adapted to its model
researcher = Agent(
    role="Researcher",
    llm="gpt-4o",              # XL tier — gets full tool descriptions
    tools=TierRouter("gpt-4o").route("..."),
)

classifier = Agent(
    role="Classifier",
    llm="ollama/qwen2.5:1.5b", # S tier — gets minimal descriptions
    tools=TierRouter("qwen2.5:1.5b").route("..."),
)

Why this matters for CrewAI specifically

CrewAI's multi-agent design means different agents naturally use different model sizes. A crew might have:

  • A cheap 1.5B model for classification/triage
  • A 7B model for summarization
  • A 70B model for complex reasoning

Each should see tools appropriate to its capability. Today they all see the same tools.

Benchmark Results

Strategy1.5B20BToken savings
Baseline (all tools)50%80%
Hybrid (8 detailed + rest name-only)60%76%47%
Reorder + hint54%88%0% (accuracy gain)

References

extent analysis

Fix Plan

To implement tier-aware tools for CrewAI, follow these steps:

  • Define tool descriptions and parameters for each tier using the descriptions and parameters dictionaries in the FileReadTool class.
  • Create a TierRouter instance for each agent, passing the agent's model name as an argument.
  • Use the route method of the TierRouter instance to get the adapted tools for each agent.
  • Assign the adapted tools to each agent using the tools attribute.

Example code:

from crewai import Agent, Crew, Task
from yantrikos import BaseTool, Tier, TierRouter, 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, "line_numbers": bool},
        Tier.XL: {"path": str, "encoding": str, "line_numbers": bool, "offset": int},
    }

researcher = Agent(
    role="Researcher",
    llm="gpt-4o",              # XL tier — gets full tool descriptions
    tools=TierRouter("gpt-4o").route("..."),
)

classifier = Agent(
    role="Classifier",
    llm="ollama/qwen2.5:1.5b", # S tier — gets minimal descriptions
    tools=TierRouter("qwen2.5:1.5b").route("..."),
)

Verification

To verify that the fix worked, check the following:

  • Each agent receives the correct set of tools adapted to its model size.
  • The tool descriptions and parameters are correctly filtered based on the agent's tier.
  • The agents can successfully use the adapted tools to perform tasks.

Extra Tips

  • Make sure to update the TierRouter instance for each agent whenever the agent's model size changes.
  • Consider adding more tiers or fine-tuning the existing tiers to better suit the needs of your agents.
  • Refer to the yantrikos-sdk documentation for more information on implementing tier-aware tools.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING