Built-in tools cover search, scraping and file reading, but every real crew has one job no built-in tool does. CrewAI lets you write a custom tool as a Python class based on BaseTool and attach it to an agent like any other tool.
Before you start
You need a CrewAI project and one job the custom tool must do, written as a single sentence with its input and its output. If the job takes more than one sentence to describe, it is two tools, not one.
Write the tool class with a clear name and description
Create the tool in the tools folder as a class based on BaseTool, with a name the model will read, a description stating exactly what it does, and one method that takes the input and returns the output. The description is the contract: the model only reads the name and description when it decides to call the tool.
Attach the tool and test it with a question that needs it
Import the tool in crew.py and add it to the agent tools list. Run the crew with a question that needs the custom tool, and check the log shows the tool call with the right input. If the agent never calls it, the description is too vague about when it applies.
Worked example: A custom calculator tool for a fictional invoices crew
Maple Invoices is a fictional billing desk. Its crew has a custom calculator tool that adds two numbers. The table shows three test calls.
| Input | Tool returns | Check |
|---|---|---|
| 48 and 36 | 84 | 48 + 36 = 84 |
| 120 and 24 | 144 | 120 + 24 = 144 |
| 250 and 37 | 287 | 250 + 37 = 287 |
Expected result (UNTESTED): each test question produces one custom tool call and a reply quoting the computed total. We checked the CrewAI documentation summary, which describes custom tools based on BaseTool, but we did not run the tool on this machine.
Limits
A custom tool runs your code with the arguments the model chooses, so validate the inputs inside the tool and never let it run a command from raw model text. Keep the tool to one job: a tool that does three things is three tools hiding in one description.
