Example

The following assistant will run a search on Tavily for “language models” and print the response.

cookbook/tools/tavily_tools.py
from phi.assistant import Assistant
from phi.tools.tavily import TavilyTools

assistant = Assistant(tools=[TavilyTools()], show_tool_calls=True)
assistant.print_response("Search tavily for 'language models'", markdown=True)

Toolkit Params

api_key
str

The API key used for authentication to access the service.

search
bool
default: "True"

Determines whether search functionality is enabled.

max_tokens
int
default: "6000"

The maximum number of tokens to use in operations.

include_answer
bool
default: "True"

Specifies if the answer should be included in the response.

search_depth
Literal['basic', 'advanced']
default: "advanced"

Defines the depth of search, either ‘basic’ or ‘advanced’.

format
Literal['json', 'markdown']
default: "markdown"

The format of the output, either ‘json’ or ‘markdown’.

use_search_context
bool
default: "False"

Indicates if the search should consider the context provided in the request.

Toolkit Functions

web_search_using_tavily

This function uses the Tavily API to provide realtime online information about the query.