### Quick Start with SnowflakeSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/snowflake_search_tool/README.md Initialize and use the SnowflakeSearchTool with basic configuration. This example demonstrates setting up the connection and executing a simple query asynchronously. ```python import asyncio from crewai_tools import SnowflakeSearchTool, SnowflakeConfig # Create configuration config = SnowflakeConfig( account="your_account", user="your_username", password="your_password", warehouse="COMPUTE_WH", database="your_database", snowflake_schema="your_schema" # Note: Uses snowflake_schema instead of schema ) # Initialize tool tool = SnowflakeSearchTool( config=config, pool_size=5, max_retries=3, enable_caching=True ) # Execute query async def main(): results = await tool._run( query="SELECT * FROM your_table LIMIT 10", timeout=300 ) print(f"Retrieved {len(results)} rows") if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Install CrewAI with Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/contextualai_create_agent_tool/README.md Install CrewAI with the necessary tools and the contextual-client library. Ensure you have a Contextual AI API key. ```bash pip install 'crewai[tools]' contextual-client ``` -------------------------------- ### Initialize NL2SQLTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/nl2sql/README.md Initialize the NL2SQLTool by providing the database URI. Ensure the URI is in the correct format: dialect+driver://username:password@host:port/database. This example uses PostgreSQL. ```python from crewai_tools import NL2SQLTool # psycopg2 was installed to run this example with PostgreSQL nl2sql = NL2SQLTool(db_uri="postgresql://example@localhost:5432/test_db") ``` -------------------------------- ### Install Stagehand Python SDK Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/stagehand_tool/README.md Install the necessary Python SDK for the Stagehand tool. ```bash pip install stagehand-py ``` -------------------------------- ### Install crewai[tools] Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/brave_search_tool/README.md Install the crewai package with tools support to use BraveSearchTool. ```shell pip install 'crewai[tools]' ``` -------------------------------- ### CrewAI Agent with ParallelSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/parallel_tools/README.md An example demonstrating how to integrate ParallelSearchTool into a CrewAI agent for web research. This setup involves defining an LLM, the search tool, a researcher agent, and a task for the agent to perform. ```python import os from crewai import Agent, Task, Crew, LLM, Process from crewai_tools import ParallelSearchTool # LLM llm = LLM( model="gemini/gemini-2.0-flash", temperature=0.5, api_key=os.getenv("GEMINI_API_KEY") ) # Parallel Search search = ParallelSearchTool() # User query query = "find all the recent concerns about AI evals? please cite the sources" # Researcher agent researcher = Agent( role="Web Researcher", backstory="You are an expert web researcher", goal="Find cited, high-quality sources and provide a brief answer.", tools=[search], llm=llm, verbose=True, ) # Research task task = Task( description=f"Research the {query} and produce a short, cited answer.", expected_output="A concise, sourced answer to the question. The answer should be in this format: [query]: [answer] - [source]", agent=researcher, output_file="answer.mdx", ) # Crew crew = Crew( agents=[researcher], tasks=[task], verbose=True, process=Process.sequential, ) ``` -------------------------------- ### Install crewai[tools] and exa_py Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/exa_tools/README.md Install the necessary packages for using the EXASearchTool. Ensure you have crewai[tools] and exa_py installed. ```shell uv add crewai[tools] exa_py ``` -------------------------------- ### Configure BedrockKBRetrieverTool with Custom Retrieval Settings Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/aws/bedrock/knowledge_base/README.md Example of initializing the BedrockKBRetrieverTool with custom retrieval configurations, including specifying the number of results and overriding the search type to HYBRID. This allows for more tailored knowledge base queries. ```python kb_tool = BedrockKBRetrieverTool( knowledge_base_id="your-kb-id", retrieval_configuration={ "vectorSearchConfiguration": { "numberOfResults": 10, "overrideSearchType": "HYBRID" } } ) policy_expert = Agent( role='Policy Expert', goal='Analyze company policies in detail', backstory='I am an expert in corporate policy analysis with deep knowledge of regulatory requirements.', tools=[kb_tool] ) ``` -------------------------------- ### Install SingleStore dependencies manually Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Install the required dependencies for SingleStore support manually using pip. ```shell pip install singlestoredb>=1.12.4 SQLAlchemy>=2.0.40 ``` -------------------------------- ### Example with Logging for Snowflake Queries Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/snowflake_search_tool/README.md Implement logging for Snowflake query execution to track success and failures. This example shows how to configure basic logging and handle exceptions during query execution. ```python import logging # Configure logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) async def main(): try: # ... tool initialization ... results = await tool._run(query="SELECT * FROM table LIMIT 10") logger.info(f"Query completed successfully. Retrieved {len(results)} rows") except Exception as e: logger.error(f"Query failed: {str(e)}") raise ``` -------------------------------- ### Initialize GithubSearchTool with Custom Model and Embeddings Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/github_search_tool/README.md Customize the language model and embeddings used by the GithubSearchTool. This example shows configuration for Ollama as the LLM provider and Google for embeddings. Ensure the 'provider' and 'model' values match your setup. ```python tool = GithubSearchTool( config=dict( llm=dict( provider="ollama", # or google, openai, anthropic, llama2, ... config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", # title="Embeddings", ), ), ) ) ``` -------------------------------- ### Run ArxivPaperTool via __main__ Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/arxiv_paper_tool/README.md Example of how to initialize and run the ArxivPaperTool within a standard Python script's __main__ block. This includes downloading PDFs and specifying a save directory. ```python if __name__ == "__main__": tool = ArxivPaperTool( download_pdfs=True, save_dir="./downloads2", use_title_as_filename=False ) result = tool._run( search_query="deep learning", max_results=1 ) print(result) ``` -------------------------------- ### Initialize MySQLSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/mysql_search_tool/README.md Initialize the tool with the database URI and the target table name. Ensure the `crewai_tools` package is installed. ```python from crewai_tools import MySQLSearchTool # Initialize the tool with the database URI and the target table name tool = MySQLSearchTool(db_uri='mysql://user:password@localhost:3306/mydatabase', table_name='employees') ``` -------------------------------- ### POST /kickoff Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/invoke_crewai_automation_tool/README.md Starts a new crew automation task. ```APIDOC ## POST {crew_api_url}/kickoff ### Description Starts a new crew automation task. ### Method POST ### Endpoint `POST {crew_api_url}/kickoff` ### Request Body (Details not provided in the source text) ### Response (Details not provided in the source text) ``` -------------------------------- ### Initialize TavilySearchTool with Custom Configuration Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/tavily_search_tool/README.md Example of initializing the TavilySearchTool with default configurations for max_results and search_depth, and providing a specific API key. These defaults can be overridden during tool execution. ```python # Example: Initialize with a default max_results and specific API key custom_tavily_tool = TavilySearchTool( api_key="YOUR_SPECIFIC_TAVILY_KEY", config={ 'max_results': 10, 'search_depth': 'advanced' } ) # The agent will use these defaults unless overridden in the task input agent_with_custom_tool = Agent( # ... agent configuration ... tools=[custom_tavily_tool] ) ``` -------------------------------- ### Install CrewAI Tools and Bedrock Dependencies Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/aws/bedrock/code_interpreter/README.md Install the necessary crewai-tools and bedrock-agentcore dependencies using uv. ```bash uv add crewai-tools bedrock-agentcore ``` -------------------------------- ### Install Browserbase SDK and CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/browserbase_load_tool/README.md Install the Browserbase SDK and the crewai[tools] package using pip. Ensure you have your Browserbase API key and Project ID set as environment variables. ```bash pip install browserbase 'crewai[tools]' ``` -------------------------------- ### Install Composio and CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/composio_tool/README.md Install the necessary packages for composio-core and crewai tools. Ensure your composio API key is set as an environment variable or logged in. ```shell pip install composio-core pip install 'crewai[tools]' ``` -------------------------------- ### Install Scrapfly Python SDK Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/scrapfly_scrape_website_tool/README.md Install the scrapfly-sdk package using pip. This is required to use the ScrapFly Web Loader. ```bash pip install scrapfly-sdk ``` -------------------------------- ### Install Hyperbrowser SDK and CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/hyperbrowser_load_tool/README.md Install the Hyperbrowser SDK and the CrewAI tools package. This is a prerequisite for using the HyperbrowserLoadTool. ```bash pip install hyperbrowser 'crewai[tools]' ``` -------------------------------- ### Minimal Adapter Example for RagTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/BUILDING_TOOLS.md Implement a custom adapter for RagTool by extending the base Adapter class. This example shows a simple in-memory adapter for storing and querying text. ```python from typing import Any from pydantic import BaseModel from crewai_tools.tools.rag.rag_tool import Adapter, RagTool class MemoryAdapter(Adapter): store: list[str] = [] def add(self, text: str, **_: Any) -> None: self.store.append(text) def query(self, question: str) -> str: # naive demo: return all text containing any word from the question tokens = set(question.lower().split()) hits = [t for t in self.store if tokens & set(t.lower().split())] return "\n".join(hits) if hits else "No relevant content found." class MemoryRagTool(RagTool): name: str = "In‑memory RAG" description: str = "Toy RAG that stores text in memory and returns matches." adapter: Adapter = MemoryAdapter() ``` -------------------------------- ### Preload documents into Weaviate database Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/weaviate_tool/README.md Load documents from a local directory into the Weaviate database using batch operations. This example demonstrates how to read files, extract relevant information (like 'year'), and add them as objects to a specified Weaviate collection. ```python import os from crewai_tools import WeaviateVectorSearchTool # Assuming 'client' is an initialized Weaviate client test_docs = client.collections.get("example_collections") docs_to_load = os.listdir("knowledge") with test_docs.batch.dynamic() as batch: for d in docs_to_load: with open(os.path.join("knowledge", d), "r") as f: content = f.read() batch.add_object( { "content": content, "year": d.split("_")[0], } ) tool = WeaviateVectorSearchTool(collection_name='example_collections', limit=3) ``` -------------------------------- ### Initialize DirectorySearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/directory_search_tool/README.md Initialize the tool to search any directory at runtime or a specific directory upon initialization. Ensure 'crewai[tools]' is installed. ```python from crewai_tools import DirectorySearchTool # To enable searching within any specified directory at runtime tool = DirectorySearchTool() # Alternatively, to restrict searches to a specific directory tool = DirectorySearchTool(directory='/path/to/directory') ``` -------------------------------- ### Set Up Agent and Task for Research Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/linkup/README.md Define a CrewAI agent with the LinkupSearchTool and create a task for information retrieval. This example demonstrates how to assign the tool to an agent and specify the expected output for a research task. ```python from crewai import Agent, Task, Crew # Define the agent research_agent = Agent( role="Information Researcher", goal="Fetch relevant results from Linkup.", backstory="An expert in online information retrieval...", tools=[linkup_tool], verbose=True ) # Define the task search_task = Task( expected_output="A detailed list of Nobel Prize-winning women in physics with their achievements.", description="Search for women who have won the Nobel Prize in Physics.", agent=research_agent ) # Create and run the crew crew = Crew( agents=[research_agent], tasks=[search_task] ) result = crew.kickoff() print(result) ``` -------------------------------- ### All ArxivPaperTool Options Combined Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/arxiv_paper_tool/README.md Demonstrates initializing the ArxivPaperTool with all available options: downloading PDFs, specifying a save directory, and using paper titles as filenames. ```python tool = ArxivPaperTool( download_pdfs=True, save_dir="./downloads", use_title_as_filename=True ) result = tool._run( search_query="stable diffusion", max_results=3 ) print(result) ``` -------------------------------- ### Basic SingleStoreSearchTool Connection Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Initialize the SingleStoreSearchTool with basic connection parameters and execute a SQL query. ```python from crewai_tools import SingleStoreSearchTool # Basic connection using host/user/password tool = SingleStoreSearchTool( host='localhost', user='your_username', password='your_password', database='your_database', port=3306 ) # Execute a search query result = tool._run("SELECT * FROM employees WHERE department = 'Engineering' LIMIT 10") print(result) ``` -------------------------------- ### Install Tavily Search Tool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/tavily_search_tool/README.md Install the necessary libraries for the Tavily Search Tool. Ensure 'crewai[tools]' and 'tavily-python' are installed. ```shell pip install 'crewai[tools]' tavily-python ``` -------------------------------- ### Initialize WebsiteSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/website_search/README.md Initialize the WebsiteSearchTool. Use the default constructor to allow searching any website, or provide a specific website URL to restrict the search scope. ```python from crewai_tools import WebsiteSearchTool tool = WebsiteSearchTool() ``` ```python tool = WebsiteSearchTool(website='https://example.com') ``` -------------------------------- ### Install Firecrawl SDK and CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/firecrawl_search_tool/README.md Install the necessary Python packages for Firecrawl and CrewAI tools. Ensure you have Python and pip installed. ```bash pip install firecrawl-py 'crewai[tools]' ``` -------------------------------- ### Initialize and Use SerperDevTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/serper_dev_tool/README.md Initialize the SerperDevTool with custom parameters and execute a search query. Ensure your SERPER_API_KEY is set as an environment variable. ```python from crewai_tools import SerperDevTool # Initialize the tool tool = SerperDevTool( n_results=10, # Optional: Number of results to return (default: 10) save_file=False, # Optional: Save results to file (default: False) search_type="search", # Optional: Type of search - "search" or "news" (default: "search") country="us", # Optional: Country for search (default: "") location="New York", # Optional: Location for search (default: "") locale="en-US" # Optional: Locale for search (default: "") ) # Execute a search results = tool._run(search_query="your search query") ``` -------------------------------- ### Install CrewAI AWS Bedrock Browser Dependencies Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/aws/bedrock/browser/README.md Installs the necessary packages for using CrewAI with AWS Bedrock Browser tools. Ensure you have uv installed. ```bash uv add crewai-tools bedrock-agentcore beautifulsoup4 playwright nest-asyncio ``` -------------------------------- ### Install crewai_tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/couchbase_tool/README.md Install the crewai_tools package with the necessary dependencies for tools. ```shell uv pip install 'crewai[tools]' ``` -------------------------------- ### Initialize and Use ParallelSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/parallel_tools/README.md Demonstrates direct usage of the ParallelSearchTool with specified parameters for a research objective. Ensure the PARALLEL_API_KEY environment variable is set. ```python from crewai_tools import ParallelSearchTool tool = ParallelSearchTool() resp_json = tool.run( objective="When was the United Nations established? Prefer UN's websites.", search_queries=["Founding year UN", "Year of founding United Nations"], processor="base", max_results=5, max_chars_per_result=1500, ) print(resp_json) # => {"search_id": ..., "results": [{"url", "title", "excerpts": [...]}, ...]}) ``` -------------------------------- ### Initialize and Use ContextualAIQueryTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/contextualai_query_tool/README.md Initialize the ContextualAIQueryTool with your API key and query an agent. The tool supports optional datastore ID for document readiness checking. ```python from crewai_tools import ContextualAIQueryTool # Initialize the tool tool = ContextualAIQueryTool(api_key="your_api_key_here") # Query the agent with IDs result = tool._run( query="What are the key findings in the financial report?", agent_id="your_agent_id_here", datastore_id="your_datastore_id_here" # Optional: for document readiness checking ) print(result) ``` -------------------------------- ### Install CrewAI Tools and Oxylabs Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/oxylabs_google_search_scraper_tool/README.md Install the necessary packages for CrewAI tools and Oxylabs. ```bash pip install 'crewai[tools]' oxylabs ``` -------------------------------- ### SingleStoreSearchTool with Connection URL Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Initialize the SingleStoreSearchTool using a connection URL and specify tables. ```python from crewai import Agent, Task, Crew from crewai_tools import SingleStoreSearchTool # Initialize the tool with connection URL singlestore_tool = SingleStoreSearchTool( host="user:password@localhost:3306/ecommerce_db", tables=["orders", "products", "customers", "order_items"] ) # Data Analyst Agent data_analyst = Agent( role="Senior Data Analyst", goal="Extract insights from database queries and provide data-driven recommendations", backstory="You are an experienced data analyst with expertise in SQL and business intelligence.", tools=[singlestore_tool], verbose=True ) # Business Intelligence Agent bi_specialist = Agent( role="Business Intelligence Specialist", goal="Transform data insights into actionable business recommendations", backstory="You specialize in translating complex data analysis into clear business strategies.", verbose=True ) ``` -------------------------------- ### Install CrewAI and Langchain-Apify Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/apify_actors_tool/README.md Install the necessary Python packages for CrewAI and the Langchain Apify integration. ```bash pip install 'crewai[tools]' langchain-apify ``` -------------------------------- ### Install CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/brightdata_tool/README.md Install the necessary CrewAI packages and dependencies for using the BrightData tools. ```shell pip install crewai[tools] aiohttp requests ``` -------------------------------- ### Initialize and Use FileCompressorTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/files_compressor_tool/README.md Initializes the FileCompressorTool and demonstrates compressing a directory with subdirectories and files into a zip archive, allowing overwrites. ```python from crewai_tools import FileCompressorTool # Initialize the tool tool = FileCompressorTool() # Compress a directory with subdirectories and files into a zip archive result = tool._run( input_path="./data/project_docs", # Folder containing subfolders & files output_path="./output/project_docs.zip", # Optional output path (defaults to zip format) overwrite=True # Allow overwriting if file exists ) print(result) # Example output: Successfully compressed './data/project_docs' into './output/project_docs.zip' ``` -------------------------------- ### Initialize ComposioTool using App and Tags Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/composio_tool/README.md Initialize the ComposioTool by selecting an application (e.g., GitHub) and filtering actions by tags. This is useful when the specific action is unknown but a general category is desired. ```python tools = ComposioTool.from_app(App.GITHUB, tags=["important"]) ``` -------------------------------- ### Initialize EXASearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/exa_tools/README.md Initialize the EXASearchTool with your API key. This tool is used for internet searching capabilities. ```python from crewai_tools import EXASearchTool # Initialize the tool for internet searching capabilities tool = EXASearchTool(api_key="your_api_key") ``` -------------------------------- ### Install crewai-tools with MongoDB support Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/mongodb_vector_search_tool/README.md Install the crewai_tools package with MongoDB support using pip or uv. ```shell pip install crewai-tools[mongodb] ``` ```shell uv add crewai-tools --extra mongodb ``` -------------------------------- ### Install CrewAI with Databricks Extra Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/databricks_query_tool/README.md Install the crewai_tools package with the databricks extra and the databricks-sdk for Databricks functionality. ```shell pip install 'crewai[tools]' 'databricks-sdk' ``` -------------------------------- ### Initialize ComposioTool using App and Use Case Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/composio_tool/README.md Initialize the ComposioTool by specifying an application and a use case. This method helps in finding relevant actions based on a natural language description of the desired functionality. ```python tools = ComposioTool.from_app(App.GITHUB, use_case="Star a github repository") ``` -------------------------------- ### Execute Agent Task with Zapier Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/zapier_action_tool/README.md Use the agent's kickoff method to initiate a task that utilizes the configured Zapier tools. The agent will interpret the task and use the appropriate Zapier action. ```python result = zapier_agent.kickoff( "Find emails from john@example.com in Gmail" ) ``` -------------------------------- ### Initialize DatabricksQueryTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/databricks_query_tool/README.md Instantiate the DatabricksQueryTool. Default parameters for catalog, schema, and warehouse can be provided during initialization. ```python from crewai_tools import DatabricksQueryTool # Basic usage databricks_tool = DatabricksQueryTool() # With default parameters for catalog, schema, and warehouse databricks_tool = DatabricksQueryTool( default_catalog="my_catalog", default_schema="my_schema", default_warehouse_id="warehouse_id" ) ``` -------------------------------- ### Install crewai_tools with Qdrant and OpenAI support Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/qdrant_vector_search_tool/README.md Install the crewai_tools package with Qdrant and OpenAI dependencies using pip. ```shell uv pip install 'crewai[tools] qdrant-client openai' ``` -------------------------------- ### Multi-step Workflow with Browser Tool Source: https://context7.com/crewaiinc/crewai-tools/llms.txt Execute multi-step instructions on a webpage using the browser tool. Ensure the tool is properly initialized before use. ```python result = browser_tool.run( url="https://example.com", instruction="Step 1: Click the login button; Step 2: Fill email with test@example.com", command_type="act" ) ``` ```python with StagehandTool() as browser_tool: browser_tool.run(url="https://example.com", command_type="navigate") browser_tool.run(instruction="Click the sign up button", command_type="act") ``` -------------------------------- ### Configure Bright Data Environment Variables Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/brightdata_tool/README.md Set up your Bright Data API key and zone as environment variables before using the tools. ```bash export BRIGHT_DATA_API_KEY="your_api_key_here" export BRIGHT_DATA_ZONE="your_zone_here" ``` -------------------------------- ### Install SpiderTool and CrewAI Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/spider_tool/README.md Install the Spider SDK and the crewai[tools] SDK using pip. This is a prerequisite for using the SpiderTool. ```python pip install spider-client 'crewai[tools]' ``` -------------------------------- ### Install Snowflake Search Tool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/snowflake_search_tool/README.md Install the Snowflake Search Tool and its dependencies using uv or pip. Ensure you have the correct versions for snowflake-connector-python, snowflake-sqlalchemy, and cryptography. ```bash uv sync --extra snowflake ``` ```bash uv pip install snowflake-connector-python>=3.5.0 snowflake-sqlalchemy>=1.5.0 cryptography>=41.0.0 ``` ```bash pip install snowflake-connector-python>=3.5.0 snowflake-sqlalchemy>=1.5.0 cryptography>=41.0.0 ``` -------------------------------- ### Create Contextual AI Agent with Documents Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/contextualai_create_agent_tool/README.md Initialize the ContextualAICreateAgentTool with your API key and use it to create a new agent. Provide agent details, datastore name, and paths to the documents you want to upload. ```python from crewai_tools import ContextualAICreateAgentTool # Initialize the tool tool = ContextualAICreateAgentTool(api_key="your_api_key_here") # Create agent with documents result = tool._run( agent_name="Financial Analysis Agent", agent_description="Agent for analyzing financial documents", datastore_name="Financial Reports", document_paths=["/path/to/report1.pdf", "/path/to/report2.pdf"], ) print(result) ``` -------------------------------- ### Install CrewAI with Tools Source: https://github.com/crewaiinc/crewai-tools/blob/main/README.md Install the CrewAI library with the necessary tools using pip. This command ensures all dependencies for using CrewAI's tool integrations are met. ```shell pip install crewai[tools] ``` -------------------------------- ### Initialize SerperDevTool and Set API Key Source: https://context7.com/crewaiinc/crewai-tools/llms.txt Set the SERPER_API_KEY environment variable and initialize SerperDevTool for performing Google searches. Basic web search functionality is demonstrated. ```python import os os.environ["SERPER_API_KEY"] = "your-serper-api-key" from crewai_tools import SerperDevTool search_tool = SerperDevTool() results = search_tool.run(search_query="Python machine learning tutorials") ``` -------------------------------- ### Configuration Parameters Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Overview of all available parameters for configuring the SingleStoreSearchTool. ```APIDOC ## Configuration Parameters Overview of all available parameters for configuring the SingleStoreSearchTool. ### Basic Connection Parameters - `host` (string) - Database host address or complete connection URL - `user` (string) - Database username - `password` (string) - Database password - `port` (integer) - Database port (default: 3306) - `database` (string) - Database name - `tables` (list of strings) - List of specific tables to work with (optional) ### Connection Pool Parameters - `pool_size` (integer) - Maximum number of connections in the pool (default: 5) - `max_overflow` (integer) - Maximum overflow connections beyond pool_size (default: 10) - `timeout` (integer) - Connection timeout in seconds (default: 30) ### SSL/TLS Parameters - `ssl_key` (string) - Path to client private key file - `ssl_cert` (string) - Path to client certificate file - `ssl_ca` (string) - Path to certificate authority file - `ssl_disabled` (boolean) - Disable SSL (default: None) - `ssl_verify_cert` (boolean) - Verify server certificate - `ssl_verify_identity` (boolean) - Verify server identity ### Advanced Parameters - `charset` (string) - Character set for the connection - `autocommit` (boolean) - Enable autocommit mode - `connect_timeout` (integer) - Connection timeout in seconds - `results_format` (string) - Format for query results ('tuple', 'dict', etc.) - `vector_data_format` (string) - Format for vector data ('binary', 'json') - `parse_json` (boolean) - Parse JSON columns automatically ``` -------------------------------- ### Install CrewAI Tools with MCP Dependencies Source: https://github.com/crewaiinc/crewai-tools/blob/main/README.md Install the crewai-tools package with the 'mcp' extra dependencies to enable Model Context Protocol support. Alternatively, use 'uv add' for dependency management. ```bash pip install crewai-tools[mcp] # or uv add crewai-tools --extra mcp ``` -------------------------------- ### Initialize AIMindTool with Datasource Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/ai_mind_tool/README.md Initialize the AIMindTool by providing datasource connection details. Ensure the MINDS_API_KEY environment variable is set. ```python from crewai_tools import AIMindTool # Initialize the AIMindTool. aimind_tool = AIMindTool( datasources=[ { "description": "house sales data", "engine": "postgres", "connection_data": { "user": "demo_user", "password": "demo_password", "host": "samples.mindsdb.com", "port": 5432, "database": "demo", "schema": "demo_data" }, "tables": ["house_sales"] } ] ) aimind_tool.run("How many 3 bedroom houses were sold in 2008?") ``` -------------------------------- ### Initialize and Use TavilyExtractorTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/tavily_extractor_tool/README.md Demonstrates initializing the TavilyExtractorTool and setting up an agent and task to extract content from a single URL with basic depth. Ensure your TAVILY_API_KEY is set as an environment variable. ```python import os from crewai import Agent, Task, Crew from crewai_tools import TavilyExtractorTool # Ensure TAVILY_API_KEY is set in your environment # os.environ["TAVILY_API_KEY"] = "YOUR_API_KEY" # Initialize the tool tavily_tool = TavilyExtractorTool() # Create an agent that uses the tool extractor_agent = Agent( role='Web Content Extractor', goal='Extract key information from specified web pages', backstory='You are an expert at extracting relevant content from websites using the Tavily API.', tools=[tavily_tool], verbose=True ) # Define a task for the agent extract_task = Task( description='Extract the main content from the URL https://example.com using basic extraction depth.', expected_output='A JSON string containing the extracted content from the URL.', agent=extractor_agent, tool_inputs={ 'urls': 'https://example.com', 'extract_depth': 'basic' } ) # Create and run the crew crew = Crew( agents=[extractor_agent], tasks=[extract_task], verbose=2 ) result = crew.kickoff() print(result) ``` -------------------------------- ### Initialize BedrockKBRetrieverTool and Use with CrewAI Agent Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/aws/bedrock/knowledge_base/README.md Demonstrates initializing the BedrockKBRetrieverTool with a knowledge base ID and number of results, then creating a CrewAI agent and task that utilizes this tool. Ensure AWS credentials and Bedrock access are configured. ```python from crewai import Agent, Task, Crew from crewai_tools.aws.bedrock.knowledge_base.retriever_tool import BedrockKBRetrieverTool # Initialize the tool kb_tool = BedrockKBRetrieverTool( knowledge_base_id="your-kb-id", number_of_results=5 ) # Create a CrewAI agent that uses the tool researcher = Agent( role='Knowledge Base Researcher', goal='Find information about company policies', backstory='I am a researcher specialized in retrieving and analyzing company documentation.', tools=[kb_tool], verbose=True ) # Create a task for the agent research_task = Task( description="Find our company's remote work policy and summarize the key points.", agent=researcher ) # Create a crew with the agent crew = Crew( agents=[researcher], tasks=[research_task], verbose=2 ) # Run the crew result = crew.kickoff() print(result) ``` -------------------------------- ### GET /status/{crew_id} Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/invoke_crewai_automation_tool/README.md Checks the status of a running task. ```APIDOC ## GET {crew_api_url}/status/{crew_id} ### Description Checks the status of a running task. ### Method GET ### Endpoint `GET {crew_api_url}/status/{crew_id}` ### Parameters #### Path Parameters - **crew_id** (string) - Required - The unique identifier for the crew task. ### Response #### Success Response (200) - **result** (any) - The result of the task if successful. - **error** (any) - Error information if the task failed. ### Response Example (Examples not provided in the source text) ``` -------------------------------- ### Initialize PGSearchTool with Database Credentials Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/pg_search_tool/README.md Initialize the PGSearchTool by providing the database URI and the target table name. Ensure the db_uri includes authentication details and the database location. ```python from crewai_tools import PGSearchTool # Initialize the tool with the database URI and the target table name tool = PGSearchTool(db_uri='postgresql://user:password@localhost:5432/mydatabase', table_name='employees') ``` -------------------------------- ### ParallelSearchTool with Source Policy Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/parallel_tools/README.md Example of using ParallelSearchTool with a `source_policy` to restrict search results to specific domains. This is useful for targeted research. ```python source_policy = { "allow": {"domains": ["un.org"]}, # "deny": {"domains": ["example.com"]}, # optional } resp_json = tool.run( objective="When was the United Nations established?", processor="base", max_results=5, max_chars_per_result=1500, source_policy=source_policy, ) ``` -------------------------------- ### Configure Custom LLM and Embeddings Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/youtube_video_search_tool/README.md Customize the language model (LLM) and embedder for the YoutubeVideoSearchTool. This example shows how to use Ollama for the LLM and Google for embeddings. ```python tool = YoutubeVideoSearchTool( config=dict( llm=dict( provider="ollama", # or google, openai, anthropic, llama2, ... config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", # title="Embeddings", ), ), ) ) ``` -------------------------------- ### SeleniumScrapingTool to Get Raw HTML Source: https://context7.com/crewaiinc/crewai-tools/llms.txt Retrieve the raw HTML content of a specific element or the entire page by setting `return_html=True` in the SeleniumScrapingTool run method. ```python scraper = SeleniumScrapingTool() html_content = scraper.run( website_url="https://example.com", css_element=".main-content", return_html=True ) ``` -------------------------------- ### Initialize BraveSearchTool and Set API Key Source: https://context7.com/crewaiinc/crewai-tools/llms.txt Set the BRAVE_API_KEY environment variable and initialize BraveSearchTool for performing web queries. Basic search functionality is demonstrated. ```python import os os.environ["BRAVE_API_KEY"] = "your-brave-api-key" from crewai_tools import BraveSearchTool search_tool = BraveSearchTool() results = search_tool.run(search_query="best Python frameworks 2024") ``` -------------------------------- ### Agent Setup for Website Research Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/spider_tool/README.md Define a researcher agent's role for crawling a specified website. The `website_url` placeholder should be replaced with the actual URL to be researched. ```yaml researcher: role: > You're a researcher that is tasked with researching a website and it's content (use crawl mode). The website is to crawl is: {website_url}. ``` -------------------------------- ### Initialize and Use PGSearchTool Source: https://context7.com/crewaiinc/crewai-tools/llms.txt Initialize the PGSearchTool with a PostgreSQL database connection URI and table name for semantic search. Customize search parameters and integrate with agents. ```python from crewai_tools import PGSearchTool # Initialize with database connection and table pg_tool = PGSearchTool( table_name="products", db_uri="postgresql://user:password@localhost:5432/mydb" ) # Search the table content semantically results = pg_tool.run(search_query="electronics with high ratings") ``` ```python # Customize search parameters results = pg_tool.run( search_query="products under $100", similarity_threshold=0.5, limit=20 ) ``` ```python # Use with an agent for database queries from crewai import Agent data_analyst = Agent( role="Data Analyst", goal="Analyze database content and provide insights", tools=[pg_tool] ) ``` -------------------------------- ### Instantiate BrowserbaseLoadTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/browserbase_load_tool/README.md Import and instantiate the BrowserbaseLoadTool to allow your agent to load websites. API key and Project ID are automatically read from environment variables. ```python from crewai_tools import BrowserbaseLoadTool tool = BrowserbaseLoadTool() ``` -------------------------------- ### Customize DOCXSearchTool Model and Embeddings Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/docx_search_tool/README.md Customize the language model and embeddings used by the DOCXSearchTool. This example shows how to configure it to use Ollama for the language model and Google for embeddings. ```python tool = DOCXSearchTool( config=dict( llm=dict( provider="ollama", # or google, openai, anthropic, llama2, ... config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", # title="Embeddings", ), ), ) ) ``` -------------------------------- ### Initialize SerpApi Google Shopping Tool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/serpapi_tool/README.md Initialize the Google Shopping tool from crewai_tools. Requires SERPAPI_API_KEY to be set in your environment. ```python from crewai_tools import SerpApiGoogleShoppingTool tool = SerpApiGoogleShoppingTool() ``` -------------------------------- ### Customize Model and Embeddings for XMLSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/xml_search_tool/README.md Customize the language model and embeddings used by XMLSearchTool. This example shows how to configure it to use Ollama with the llama2 model for the LLM and Google for embeddings. ```python tool = XMLSearchTool( config=dict( llm=dict( provider="ollama", # or google, openai, anthropic, llama2, ... config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", # title="Embeddings", ), ), ) ) ``` -------------------------------- ### Initialize ZapierActionTools with API Key Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/zapier_action_tool/README.md Initialize ZapierActionTools by providing your Zapier API key. This allows agents to access all available Zapier actions. ```python from crewai_tools import ZapierActionTools from crewai import Agent tools = ZapierActionTools( zapier_api_key="your-zapier-api-key" ) ``` -------------------------------- ### Configure Custom LLM and Embeddings for JSONSearchTool Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/json_search_tool/README.md Customize the language model and embeddings used by the tool. By default, it uses OpenAI. This example shows configuration for Ollama and Google embeddings. ```python tool = JSONSearchTool( config=dict( llm=dict( provider="ollama", # or google, openai, anthropic, llama2, ... config=dict( model="llama2", # temperature=0.5, # top_p=1, # stream=true, ), ), embedder=dict( provider="google", config=dict( model="models/embedding-001", task_type="retrieval_document", # title="Embeddings", ), ), ) ) ``` -------------------------------- ### Initialize GithubSearchTool for Any Repo Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/github_search_tool/README.md Initialize the tool to allow the agent to search any GitHub repository it learns about during its execution. Provide your GitHub token and desired content types. ```python # OR # Initialize the tool for semantic searches within a specific GitHub repository, so the agent can search any repository if it learns about during its execution tool = GithubSearchTool( gh_token='...', content_types=['code', 'issue'] # Options: code, repo, pr, issue ) ``` -------------------------------- ### SingleStore Environment Variable Configuration Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Initializes the SingleStoreSearchTool by reading connection details from the SINGLESTOREDB_URL environment variable. This method simplifies initialization when the variable is set. ```bash # Set the environment variable export SINGLESTOREDB_URL="singlestoredb://user:password@localhost:3306/database_name" # Or for cloud connections export SINGLESTOREDB_URL="singlestoredb://user:password@your_cloud_host:3333/database_name?ssl_disabled=false" ``` -------------------------------- ### Data Analyst Agent Setup for Python Analysis Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/aws/bedrock/code_interpreter/README.md Initializes a CrewAI agent configured as a Data Analyst using the code interpreter toolkit for Python-based data analysis tasks. ```python from crewai import Agent, Task, Crew, LLM from crewai_tools.aws import create_code_interpreter_toolkit # Create toolkit and tools toolkit, code_tools = create_code_interpreter_toolkit(region="us-west-2") # Create the Bedrock LLM llm = LLM( model="bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0", region_name="us-west-2", ) # Create a data analyst agent analyst_agent = Agent( role="Data Analyst", goal="Analyze data using Python", backstory="You're an expert data analyst who uses Python for data processing.", tools=code_tools, llm=llm ) ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/singlestore_search_tool/README.md Configure the connection by setting the SINGLESTOREDB_URL environment variable and initializing the tool without arguments. ```APIDOC ## Environment Variable Configuration Configure the connection by setting the SINGLESTOREDB_URL environment variable and initializing the tool without arguments. ### Method ```bash export SINGLESTOREDB_URL="singlestoredb://user:password@localhost:3306/database_name" # Or for cloud connections export SINGLESTOREDB_URL="singlestoredb://user:password@your_cloud_host:3333/database_name?ssl_disabled=false" ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # No connection arguments needed when using environment variable tool = SingleStoreSearchTool() # Or specify only table subset tool = SingleStoreSearchTool(tables=['employees', 'departments']) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### StagehandTool Act Command Examples Source: https://github.com/crewaiinc/crewai-tools/blob/main/crewai_tools/tools/stagehand_tool/README.md Demonstrates using the 'act' command type to perform various interactions on a webpage, such as clicking buttons or filling forms. The 'command_type' parameter defaults to 'act' and can be omitted. ```python # Perform an action (default behavior) result = stagehand_tool.run( instruction="Click the login button", url="https://example.com", command_type="act" # Default, so can be omitted ) ``` ```python # Fill out a form result = stagehand_tool.run( instruction="Fill the contact form with name 'John Doe', email 'john@example.com', and message 'Hello world'", url="https://example.com/contact" ) ``` ```python # Multiple actions in sequence result = stagehand_tool.run( instruction="Search for 'AI tools' in the search box and press Enter", url="https://example.com" ) ```