Course Content
CrewAI Multi-Agents
9 sections · 53 lessons
How do agents in CrewAI use tools?
What you need to know
Four ways to get tools
- Ready-made:
pip install 'crewai[tools]'givescrewai_toolswith tools such asSerperDevTool(web search),ScrapeWebsiteTool,FileReadTooland many more. - Your own function: the
@tooldecorator — the docstring becomes the description, the type hints the schema. - Your own class: subclass
BaseToolwith anargs_schema, for anything needing configuration, clients or retries. - MCP servers: agents can load tools from Model Context Protocol servers through the
mcpsfield.
1from crewai import Agent, Task2from crewai.tools import tool3from crewai_tools import SerperDevTool45@tool("Company headcount")6def company_headcount(domain: str) -> str:7 """Return the latest employee count for a company website domain,8 for example 'acme.com'. Use this before scoring company size."""9 return lookup_headcount(domain) # your data provider1011researcher = Agent(role="Account Researcher", goal="...", backstory="...",12 tools=[SerperDevTool(), company_headcount], max_iter=8)1314score = Task(description="...", expected_output="...", agent=researcher,15 tools=[company_headcount]) # only this tool for this tasklookup_headcount stands for your own provider client. If a task sets tools, they replace the agent's tools for that task.
The loop, one call at a time
- The model sees the task and the list of tool names, descriptions and argument schemas.
- It returns a tool call, for example
company_headcount(domain="acme.com"). - CrewAI validates the arguments against the schema and runs the tool.
- The result goes back to the model as an observation, and the loop continues.
Useful tool options
result_as_answer=True— the tool's output becomes the task's final answer directly (good for tools that already produce the finished artefact).max_usage_count=N— the tool can be used at most N times.cache_function— decide which results the crew cache may store.
Why descriptions decide everything
The model never sees your code. It chooses a tool from its name and description alone. "Searches the web" is weak. "Searches recent news; use for events after 2024; returns 5 results with title, URL and snippet" tells the model when to use it and what comes back.
A real-life example
A B2B SaaS lead-qualification crew gave its researcher three tools: web search, a scraper and a headcount lookup. Traces showed the agent guessing company size from LinkedIn snippets found through web search in 40% of runs, and never calling the headcount tool.
The headcount tool's description was "Gets company data". The team rewrote it as in the example above — what it returns, what input format it takes, and when to use it. Headcount-tool usage rose to 95% of runs, and size errors in lead scores (compared with the sales team's manual checks on 60 leads) fell from 14 to 3. No model change, no prompt change — only the tool description.
Follow-up questions to expect
- "What happens if the model passes bad arguments?" — CrewAI validates them against the schema and returns the error to the model, which usually corrects the call on the next step.
- "Can a tool be async?" — Yes;
BaseToolsupports an_arunmethod, and async Flows andakickoffuse native async. - "How many tools should an agent have?" — As few as the job needs; accuracy of tool choice drops as the list grows. Split tools across agents or tasks rather than giving one agent twenty.