Activity
Mon
Wed
Fri
Sun
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
What is this?
Less
More

Memberships

AI Developer Accelerator

10.8k members โ€ข Free

AI Agency Vault

956 members โ€ข Free

1 contribution to AI Developer Accelerator
How to Create Custom Tool and pass it to the Tasks
This is pretty basis question, I'm new to crewAI learning from the tutorials but I can't find a way to define the custom Tools and then call it in the crew.py file so that I can use it in the tasks. I find a file called "custom_tool.py" inside "tools" directory, so I assume this is where I need to create my custom tools. Ok, then how can I call this tool from within the crew.py file and I would like to pass this tool inside one of the Tasks. Any basic code would help, just want to know how to make it work. Thanks in advance, Rajeev
0 likes โ€ข Jan 25
Wow! that's an awesome help. So I followed the suggestion and added my tool in the "tools" directory under filename called: custom_tool.py Then I went to crew.py file and used this command to import it: from tools.custom_tool import SentimentAnalysisTool But it still gives me following error. I must be making stupid mistake. I'm attaching screenshot of both crew.py file and the custom_tool.py file and the error I'm getting.
2 likes โ€ข Jan 25
Finally, able to fix the issue using ChatGPT. Paul, I'm very grateful to you for pointing me in right direction. It said that Python is not recognizing my path correctly and suggested me to add the project name in front so the final import line that worked for me is following: from project_2.tools.custom_tool import SentimentAnalysisTool where project_2 is the name of folder inside the scr folder. Thanks a lot for your help Paul.
1-1 of 1
Rajeev Sahay
1
2points to level up
@rajeev-sahay-5365
I'm trying to learn AI and build apps

Active 224d ago
Joined Jan 22, 2025
Powered by