### Install and Login with Tavily CLI Source: https://docs.tavily.com/llms.txt Install the Tavily CLI using pip and log in to your account. This is the fastest way to get started with Tavily. ```bash pip install tavily-cli tvly login ``` -------------------------------- ### Agent-installable prompt for Tavily MCP setup Source: https://docs.tavily.com/documentation/keyless This prompt guides an AI assistant to set up the Tavily MCP server. It includes steps for detecting the platform, installing the server, verifying the connection, and running a test search. ```text Set up the Tavily MCP server so you can search the web and extract content from URLs. Follow these steps: 1. Detect which platform you're running on (Claude Code, Cursor, Windsurf, Claude Desktop, etc.) 2. Install the Tavily MCP server using the correct method for your platform: - Server URL: https://mcp.tavily.com/mcp/ - Transport: Streamable HTTP - Authentication: none required. Tavily is free to use without an API key. 3. Verify the server is connected and you have access to the tavily-search and tavily-extract tools. 4. Run a test search (e.g. "current weather in Tel Aviv") to confirm you get real results from a live source. 5. Report back whether setup succeeded. ``` -------------------------------- ### Full CrewAI Research Example Source: https://docs.tavily.com/documentation/integrations/crewai A complete example demonstrating the setup of agents, tasks, and crews using the TavilyResearchTool for an agent. Ensure API keys are set as environment variables. ```python import os from crewai import Agent, Task, Crew from crewai_tools import TavilyResearchTool # Set up environment variables os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" # Initialize the Tavily research tool tavily_tool = TavilyResearchTool() # Create an agent that uses the tool researcher = Agent( role="Research Analyst", goal="Investigate questions and produce concise, well-cited briefings.", backstory=( "You are a meticulous analyst who delegates web research to the Tavily " "Research tool, then synthesizes the findings into short briefings." ), tools=[tavily_tool], verbose=True, ) # Create a task for the agent research_task = Task( description=( "Investigate notable open-source agent orchestration frameworks released " "in the last six months and summarize their differentiators." ), expected_output="A bulleted briefing with citations.", agent=researcher, ) # Form the crew and execute the task crew = Crew( agents=[researcher], tasks=[research_task], verbose=True, ) result = crew.kickoff() print("Research Results:") print(result) ``` -------------------------------- ### Tavily Crawl Example Source: https://docs.tavily.com/llms-full.txt Demonstrates how to instantiate the Tavily client, define a starting URL, execute a crawl with a query, and print the results. ```APIDOC ## Crawl ### Description Executes a web crawl starting from a given URL, optionally guided by a query. ### Method `crawl(url: str, query: str)` ### Parameters - `url` (str) - Required - The starting URL for the crawl. - `query` (str) - Required - The query to guide the crawl. ### Request Example ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") url = "https://docs.tavily.com" response = tavily_client.crawl(url, query="Python SDK") print(response) ``` ### Response #### Success Response Returns a dictionary containing crawl results, including URLs, raw content, and image URLs. #### Response Example ```json { "base_url": "https://docs.tavily.com", "results": [ { "url": "https://docs.tavily.com/sdk/python/reference", "raw_content": "SDK Reference - Tavily Docs...", "images": ["image_url1", "image_url2"] } ] } ``` ``` -------------------------------- ### Install Tavily Python Package Source: https://docs.tavily.com/examples/quick-tutorials/research-streaming Install the Tavily Python client library. The `tavily-agent-toolkit` is optional and used for specific production helper examples. ```bash uv venv uv pip install tavily-python # Optional (used in the production helper example below) uv pip install tavily-agent-toolkit ``` -------------------------------- ### Example Use Case: Market Research with Tavily and OpenAI Source: https://docs.tavily.com/documentation/integrations/composio Perform market research using Tavily for web search and OpenAI for analysis. This example demonstrates how to define a task, send it to the LLM, handle tool calls, and get a summarized response. ```python from composio import Composio from composio_openai import OpenAIProvider from openai import OpenAI import os from dotenv import load_dotenv load_dotenv() # Initialize OpenAI client with API key client = OpenAI() # Initialize Composio toolset composio = Composio( api_key=os.getenv("COMPOSIO_API_KEY"), provider=OpenAIProvider() ) user_id = "your-user-id" # Get the Tavily tool with all available parameters tools = composio.tools.get(user_id, toolkits=['TAVILY'] ) # Define the market research task with specific parameters task = { "query": "Analyze the competitive landscape of AI-powered customer service solutions in 2024", "search_depth": "advanced", "include_answer": True, "max_results": 10, # Focus on relevant industry sources "include_domains": [ "techcrunch.com", "venturebeat.com", "forbes.com", "gartner.com", "marketsandmarkets.com" ], } # Send request to LLM messages = [{"role": "user", "content": str(task)}] response = client.chat.completions.create( model="gpt-4.1", messages=messages, tools=tools, tool_choice="auto" ) # Handle tool call via Composio execution_result = None response_message = response.choices[0].message if response_message.tool_calls: execution_result = composio.provider.handle_tool_calls(user_id,response) print("Execution Result:", execution_result) messages.append(response_message) # Add tool response messages for tool_call, result in zip(response_message.tool_calls, execution_result): messages.append({ "role": "tool", "content": str(result["data"]), "tool_call_id": tool_call.id }) # Get final response from LLM final_response = client.chat.completions.create( model="gpt-4.1", messages=messages ) print("\nMarket Research Summary:") print(final_response.choices[0].message.content) else: print("LLM responded directly (no tool used):", response_message.content) ``` -------------------------------- ### Python Mapping Request Example Source: https://docs.tavily.com/sdk/python/reference Instantiate the TavilyClient, define a starting URL, and execute the mapping function with specific instructions. This snippet shows how to initiate a web mapping task. ```python from tavily import TavilyClient # Step 1. Instantiating your TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") # Step 2. Defining the starting URL of the mapping url = "https://docs.tavily.com" # Step 3. Executing the mapping with some guidance parameters response = tavily_client.mapping(url, instructions="Find information on the JavaScript SDK") # Step 4. Printing the results print(response) ``` -------------------------------- ### Install Tavily MCP using Git Source: https://docs.tavily.com/documentation/mcp Clone the repository, install dependencies, and build the project if you prefer a local source installation. ```bash git clone https://github.com/tavily-ai/tavily-mcp.git cd tavily-mcp npm install npm run build ``` -------------------------------- ### Full Example: Tavily Search with OpenAI Function Calling Source: https://docs.tavily.com/documentation/integrations/openai A complete, runnable example demonstrating the integration of Tavily search with OpenAI's function calling. This includes setup, tool definition, conversation flow, tool execution, and final response generation. ```python import os import json from tavily import TavilyClient from openai import OpenAI # --- setup --- tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) def tavily_search(**kwargs): # Pass ALL supported kwargs straight to Tavily results = tavily_client.search(**kwargs) return results # --- define tools --- tools = [ { "type": "function", "function": { "name": "tavily_search", "description": "Search the web with Tavily for up-to-date information", "parameters": { "type": "object", "properties": { "query": {"type": "string", "description": "The search query"}, "max_results": {"type": "integer", "default": 5}, }, "required": ["query"], }, }, } ] # --- conversation --- messages = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] #Ask the model; let it decide whether to call the tool response = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, tools=tools, ) assistant_msg = response.choices[0].message messages.append(assistant_msg) # keep the assistant msg that requested tool(s) if getattr(assistant_msg, "tool_calls", None): for tc in assistant_msg.tool_calls: args = tc.function.arguments if isinstance(args, str): args = json.loads(args) elif not isinstance(args, dict): args = json.loads(str(args)) if tc.function.name == "tavily_search": # forward ALL args results = tavily_search(**args) messages.append({ "role": "tool", "tool_call_id": tc.id, "name": "tavily_search", "content": json.dumps(results), }) else: print("\nNo tool call requested by the model.") # Ask the model again for the final grounded answer final = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, ) final_msg = final.choices[0].message print("\nFINAL ANSWER:\n", final_msg.content or "(no content)") ``` -------------------------------- ### Install Tavily Agent Toolkit Source: https://docs.tavily.com/examples/agent-toolkit/overview Install the core library using pip. For LLM features, also install the package for your preferred provider. ```bash pip install tavily-agent-toolkit ``` ```bash pip install langchain-openai # OpenAI pip install langchain-anthropic # Anthropic pip install langchain-google-genai # Google pip install langchain-groq # Groq ``` -------------------------------- ### Full CrewAI Example with Tavily Search Tool Source: https://docs.tavily.com/documentation/integrations/crewai Demonstrates a complete CrewAI setup using the TavilySearchTool for a researcher agent. Ensure your OpenAI and Tavily API keys are set as environment variables. ```python import os from crewai import Agent, Task, Crew from crewai_tools import TavilySearchTool # Set up environment variables os.environ["OPENAI_API_KEY"] = "your-openai-api-key" 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='News Researcher', goal='Find trending information about AI agents', backstory='An expert News researcher specializing in technology, focused on AI.', tools=[tavily_tool], verbose=True ) # Create a task for the agent research_task = Task( description='Search for the top 3 Agentic AI trends in 2025.', 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=True ) result = crew.kickoff() print(result) ``` -------------------------------- ### Install OpenAI Agents SDK Source: https://docs.tavily.com/documentation/integrations/openai Install the OpenAI Agents SDK for building agentic AI applications. ```bash pip install -U openai-agents ``` -------------------------------- ### Install Langflow using UV Source: https://docs.tavily.com/llms-full.txt Installs Langflow using the UV package manager, which is recommended for faster installation. ```bash # Using UV (recommended) uv pip install langflow ``` -------------------------------- ### Interactive Mode Commands Example Source: https://docs.tavily.com/llms-full.txt Examples of commands that can be run within the interactive REPL. ```bash ❯ search "latest AI news" ❯ extract https://example.com ❯ exit ``` -------------------------------- ### Install Required Packages Source: https://docs.tavily.com/documentation/integrations/anthropic Install the necessary Python libraries for Anthropic and Tavily integration. ```bash pip install anthropic tavily-python ``` -------------------------------- ### Install Tavily Python Package Source: https://docs.tavily.com/llms-full.txt Install the Tavily Python client library and the agent toolkit for production use. ```bash uv venv uv pip install tavily-python # Optional (used in the production helper example below) uv pip install tavily-agent-toolkit ``` -------------------------------- ### Set Up Environment Variables Source: https://docs.tavily.com/documentation/integrations/cartesia Create a .env file to store your Tavily and OpenAI API keys for authentication. ```bash TAVILY_API_KEY=tvly-your-api-key OPENAI_API_KEY=your-openai-api-key ``` -------------------------------- ### Tavily Crawl with Custom Parameters Source: https://docs.tavily.com/sdk/javascript/reference Initiate a web crawl starting from a specified URL with options to control depth, breadth, and filtering. This example demonstrates a basic crawl setup. ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = tavily_client.crawl( url="https://example.com", max_depth=2, max_breadth=10, limit=100, query="latest news", select_paths=["/docs/.*", "/api/v1.*"], select_domains=["^docs\\.example\\.com$", "^example\\.com$"], allow_external=True, include_images=True ) print(response) ``` -------------------------------- ### Client Instantiation Source: https://docs.tavily.com/llms-full.txt Shows how to instantiate the synchronous and asynchronous Tavily clients, with options for API keys and proxies. ```APIDOC ## Client Instantiation ### Description Instantiate the Tavily client using your API key. Both synchronous and asynchronous clients are available. Proxies can also be configured. ### Synchronous Client ```python from tavily import TavilyClient client = TavilyClient("tvly-YOUR_API_KEY") ``` ### Asynchronous Client ```python from tavily import AsyncTavilyClient client = AsyncTavilyClient("tvly-YOUR_API_KEY") ``` ### Proxies Configure proxies by passing a dictionary to the `proxies` parameter. ```python from tavily import TavilyClient proxies = { "http": "", "https": "", } client = TavilyClient("tvly-YOUR_API_KEY", proxies=proxies) ``` Alternatively, set `TAVILY_HTTP_PROXY` and `TAVILY_HTTPS_PROXY` environment variables. ``` -------------------------------- ### Start ADK Web Interface Source: https://docs.tavily.com/documentation/integrations/google-adk Launch the ADK web interface by running `adk web --port 8000`. This command starts a web server providing a visual chat interface for your agent. Ensure you run this from the parent directory containing your agent folder. ```bash adk web --port 8000 ``` -------------------------------- ### Example Tavily Get Research Response Source: https://docs.tavily.com/llms-full.txt Example response from the TavilyGetResearch tool, showing details of a completed research task including content and sources. ```json { "request_id": "test-request-123", "created_at": "2024-01-01T00:00:00Z", "completed_at": "2024-01-01T00:05:00Z", "status": "completed", "content": "This is a comprehensive research report on AI developments...", "sources": [ { "title": "AI Research Paper", "url": "https://example.com/ai-paper", } ] } ``` -------------------------------- ### Get Free API Key Source: https://docs.tavily.com/llms-full.txt Obtain your free Tavily API key. No credit card is required to get started with 1,000 free API credits monthly. ```html You get 1,000 free API Credits every month. **No credit card required.** ``` -------------------------------- ### Initial Conversation Setup Source: https://docs.tavily.com/llms-full.txt Sets up the initial system and user messages for a conversation with an AI model. ```python messages = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] ``` -------------------------------- ### Tavily Crawl Request Example Source: https://docs.tavily.com/llms-full.txt This example demonstrates how to initiate a web crawl using the TavilyClient. You can specify parameters like the starting URL, crawl depth, and domain restrictions. ```python from tavily import TavilyClient # Step 1. Instantiating your TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") # Step 2. Defining the root URL to begin the crawl url = "https://en.wikipedia.org/wiki/Artificial_intelligence" # Step 3. Executing the crawl request with custom parameters response = tavily_client.crawl( url=url, max_depth=2, max_breadth=10, limit=30, query="Explain the history of AI", select_paths=["/wiki/", "/w/index.php"] ) # Step 4. Printing the crawl results print(response) ``` -------------------------------- ### Install Tavily Python SDK Source: https://docs.tavily.com/examples/quick-tutorials/extract-api Install the Tavily Python SDK using uv. This is the first step before using any Tavily API functionalities. ```bash uv venv uv pip install tavily-python ``` -------------------------------- ### Set up Tavily Client Source: https://docs.tavily.com/examples/quick-tutorials/map-api Initialize the TavilyClient with your API key. The API key should be set as an environment variable named TAVILY_API_KEY. ```python import os from tavily import TavilyClient client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) ``` -------------------------------- ### Full Code Example for OpenAI Agents with Tavily Source: https://docs.tavily.com/documentation/integrations/openai A complete example demonstrating the integration of Tavily search with OpenAI agents, including setup, tool definition, and agent execution. ```python import os import asyncio from agents import Agent, Runner, function_tool from tavily import TavilyClient tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) @function_tool def tavily_search(query: str) -> str: """ Perform a web search using Tavily and return a summarized result. """ response = tavily_client.search(query,search_depth='advanced',max_results='5') results = response.get("results", []) return results or "No results found." async def main(): agent = Agent( name="Web Research Agent", instructions="Use tavily_search when you need up-to-date info.", tools=[tavily_search], ) out = await Runner.run(agent, "Latest developments about quantum computing from 2025") print(out.final_output) asyncio.run(main()) ``` -------------------------------- ### Tavily CLI Crawl Command Examples Source: https://docs.tavily.com/documentation/tavily-cli Examples of using the `tvly crawl` command to scrape websites. You can specify paths to select, output directories, or provide instructions for guided crawls. ```bash tvly crawl https://example.com --select-paths "/blog/.*" ``` ```bash # Save each page as a markdown file tvly crawl https://docs.example.com --output-dir ./docs-mirror ``` ```bash # Guided crawl tvly crawl https://docs.example.com --instructions "focus on API reference pages" ``` -------------------------------- ### Python SDK Mapping Example Source: https://docs.tavily.com/sdk/javascript/reference Illustrates how to generate a sitemap from a base URL using the Tavily Python SDK. Supports query parameters for guidance. ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") url = "https://docs.tavily.com" response = tavily_client.mapping(url, query="JavaScript") print(response) ``` -------------------------------- ### Global CLI Options Source: https://docs.tavily.com/llms-full.txt Examples of using global options with the 'tvly' command. ```bash tvly --version tvly --status tvly search --help ``` -------------------------------- ### Example Research Query Source: https://docs.tavily.com/documentation/best-practices/best-practices-research Use this query to get a brief overview of a company, its products, services, and market position. ```text "Research the company ____ and it's 2026 outlook. Provide a brief overview of the company, its products, services, and market position." ``` -------------------------------- ### Tavily Crawl Source: https://docs.tavily.com/sdk/javascript/reference Initiate a web crawl starting from a given URL. You can guide the crawl with a query to focus on specific information. ```APIDOC ## Crawl Initiate a web crawl starting from a given URL. You can guide the crawl with a query to focus on specific information. ### Example Usage ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = tavily_client.crawl(url="https://docs.tavily.com", query="Python SDK") print(response) ``` ### Results Format Each successful result in the `results` list will be in the following `Result` format: | Key | Type | Description | | --- | --- | --- | | `url` | `str` | The URL of the webpage. | | `raw_content` | `str` | The raw content extracted. | | `images` | `list[str]` | Image URLs extracted from the page. | ``` -------------------------------- ### Initialize Tavily and OpenAI Clients Source: https://docs.tavily.com/documentation/integrations/openai Set up the necessary clients for Tavily search and OpenAI API interactions. Ensure your API keys are set as environment variables. ```python import os import json from tavily import TavilyClient from openai import OpenAI # --- setup --- tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) ``` -------------------------------- ### Instantiating a Synchronous Client Source: https://docs.tavily.com/sdk/javascript/reference Demonstrates how to create a synchronous Tavily client instance using your API key. ```APIDOC ## Instantiating a Synchronous Client To interact with Tavily in Python, you must instantiate a client with your API key. This example shows how to create a synchronous client. ### Method ```python from tavily import TavilyClient client = TavilyClient("tvly-YOUR_API_KEY") ``` ### Parameters * `api_key` (str): Your Tavily API key. (Required) * `proxies` (dict, optional): A dictionary of proxy configurations. (Optional) ``` -------------------------------- ### Instantiating an Asynchronous Client Source: https://docs.tavily.com/sdk/python/reference This example demonstrates how to create an asynchronous client for non-blocking API interactions. ```APIDOC ## Instantiating an Asynchronous Client ### Description Instantiate the asynchronous Tavily client with your API key. ### Method ```python from tavily import AsyncTavilyClient client = AsyncTavilyClient("tvly-YOUR_API_KEY") ``` ``` -------------------------------- ### Initialize TavilySearchTool with Custom Parameters Source: https://docs.tavily.com/documentation/integrations/crewai Demonstrates how to initialize the TavilySearchTool, potentially with custom parameters for search queries or other configurations. ```python from crewai_tools import TavilySearchTool ``` -------------------------------- ### Extract Information from URL Source: https://docs.tavily.com/llms-full.txt Use the Extract API to get specific information from a given URL. This example shows how to configure the extraction with various parameters. ```Python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = tavily_client.extract("https://en.wikipedia.org/wiki/Artificial_intelligence", query="", chunks_per_source=3, extract_depth="basic", include_images=False, include_favicon=False, format="markdown", timeout="None", include_usage=False) print(response) ``` -------------------------------- ### Perform a Tavily Web Search Source: https://docs.tavily.com/sdk/javascript/reference Execute a web search using the Tavily SDK. This example demonstrates a basic search with a query and starting URL. ```python from tavily import TavilyClient # Initialize the client with your API key tavily_client = TavilyClient("YOUR_API_KEY") # Define the starting URL of the crawl url = "https://docs.tavily.com" # Execute the crawl with some guidance parameters response = tavily_client.crawl(url, query="Python SDK") # Printing the crawled results print(response) ``` -------------------------------- ### Initialize Tavily Client and Import Libraries Source: https://docs.tavily.com/documentation/integrations/openai Initialize the Tavily client and import necessary libraries for agent creation. ```python import os import asyncio from agents import Agent, Runner, function_tool from tavily import TavilyClient tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) ``` -------------------------------- ### Perform a Tavily Web Crawl Source: https://docs.tavily.com/llms-full.txt Execute a web crawl starting from a specified URL with a given query. This example demonstrates how to initiate a crawl and print the results. ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="YOUR_API_KEY") # Step 2. Defining the starting URL of the crawl url = "https://docs.tavily.com" # Step 3. Executing the crawl with some guidance parameters response = tavily_client.crawl(url, query="Python SDK") # Step 4. Printing the crawled results print(response) ``` -------------------------------- ### Run the Anthropic SDK Chatbot Source: https://docs.tavily.com/examples/agent-toolkit/chatbot Execute the chatbot application using Python after setting up the environment variables and installing dependencies. This command starts the interactive chatbot. ```bash python chatbot.py ``` -------------------------------- ### Instantiate Tavily Client with Proxies Source: https://docs.tavily.com/llms-full.txt Illustrates how to specify proxy settings when instantiating the Tavily client for both synchronous and asynchronous clients. ```python from tavily import TavilyClient proxies = { "http": "", "https": "", } client = TavilyClient("tvly-YOUR_API_KEY", proxies=proxies) ``` -------------------------------- ### Run Agent with Web Interface Source: https://docs.tavily.com/llms-full.txt Start the ADK web interface on a specified port for a visual testing experience with your agent. ```bash adk web --port 8000 ``` -------------------------------- ### Crawl a Website with Tavily Source: https://docs.tavily.com/examples/quick-tutorials/crawl-api Crawl a website starting from a given URL, limiting the depth and number of pages. This example demonstrates how to retrieve and print the raw content of crawled pages. ```python import os from tavily import TavilyClient client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) response = client.crawl( url="https://docs.tavily.com", max_depth=1, limit=10, ) for page in response["results"]: print(f"\n--- {page['url']} ---") print(f"Content length: {len(page['raw_content'])} chars") print(page["raw_content"][:200]) ``` -------------------------------- ### Example Prompt for Devin with Tavily MCP Source: https://docs.tavily.com/documentation/integrations/devin Use this prompt to instruct Devin to create a Next.js app and utilize Tavily MCP for package selection, implementation, and documentation. ```text Create a Next.js app called `qr-maker`. Use Tavily MCP to pick a QR-code package, build a text-to-QR page, add a README, and commit it. ``` -------------------------------- ### Tavily Crawl with Query Example Source: https://docs.tavily.com/sdk/python/reference Illustrates how to initiate a website crawl starting from a specific URL and searching for a particular query within the crawled content. Useful for targeted data gathering. ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = tavily_client.crawl("https://docs.tavily.com", query="Python SDK") print(response) ``` -------------------------------- ### Perform a Smart Crawl with Tavily Python SDK Source: https://docs.tavily.com/sdk/javascript/reference Initiate a smart crawl starting from a specified URL using the Tavily Python SDK. This example shows how to use the 'crawl' method with a query. ```python from tavily import TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = tavily_client.crawl("https://docs.tavily.com", query="Python SDK") print(response) ``` -------------------------------- ### Competitive Intelligence Agent Prompt Source: https://docs.tavily.com/llms-full.txt Create an agent that monitors competitor product launches and generates weekly summary reports. ```bash /tavily-best-practices Create an agent that monitors competitor product launches and generates weekly reports ``` -------------------------------- ### Generate a Sitemap with Tavily Map Source: https://docs.tavily.com/llms-full.txt Use the `mapping` function to generate a sitemap starting from a base URL. You can guide the crawler with natural language queries and specify parameters like max depth and link limits. ```python from tavily import TavilyClient # Step 1. Instantiating your TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") # Step 2. Defining the starting URL of the mapping url = "https://docs.tavily.com" # Step 3. Executing the mapping with some guidance parameters response = tavily_client.mapping(url, query="JavaScript") # Step 4. Printing the results print(response) ``` -------------------------------- ### Generate Sitemap with Tavily Mapping Source: https://docs.tavily.com/sdk/python/reference Use the Tavily client's mapping function to generate a sitemap starting from a given URL. You can guide the mapping with parameters like query, max depth, and path/domain filters. ```python from tavily import TavilyClient # Step 1. Instantiating your TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") # Step 2. Defining the starting URL of the mapping url = "https://docs.tavily.com" # Step 3. Executing the mapping with some guidance parameters response = tavily_client.mapping(url, query="JavaScript") # Step 4. Printing the results print(response) ```