Skip to content

[BUG] Error on crewai_tools import TavilySearchTool #3210

Description

@cooleye72

Description

The Tavily Search Tool shown in Crewai document encounter the following error

ImportError: cannot import name 'TavilySearchTool' from 'crewai_tools

Below are the package versions that I am using.
crewai==0.148.0
crewai-tools==0.55.0
tavily-python==0.7.10
python == 3.11.13

Anyone can assist on this issue?

Steps to Reproduce

pip install 'crewai[tools]' tavily-python

export TAVILY_API_KEY='your_tavily_api_key'

import os
from crewai import Agent, Task, Crew
from crewai_tools import TavilySearchTool

Ensure the TAVILY_API_KEY environment variable is set

os.environ["TAVILY_API_KEY"] = "YOUR_TAVILY_API_KEY"

Initialize the tool

tavily_tool = TavilySearchTool()

Create an agent that uses the tool

researcher = Agent(
role='Market Researcher',
goal='Find information about the latest AI trends',
backstory='An expert market researcher specializing in technology.',
tools=[tavily_tool],
verbose=True
)

Create a task for the agent

research_task = Task(
description='Search for the top 3 AI trends in 2024.',
expected_output='A JSON report summarizing the top 3 AI trends found.',
agent=researcher
)

Form the crew and kick it off

crew = Crew(
agents=[researcher],
tasks=[research_task],
verbose=2
)

result = crew.kickoff()
print(result)

Expected behavior

ImportError: cannot import name 'TavilySearchTool' from 'crewai_tools

Screenshots/Code snippets

ImportError: cannot import name 'TavilySearchTool' from 'crewai_tools

Operating System

Ubuntu 20.04

Python Version

3.10

crewAI Version

0.148.0

crewAI Tools Version

0.55.0

Virtual Environment

Venv

Evidence

Image

Possible Solution

None

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions