diff --git a/crewai_tools/tools/stagehand_tool/stagehand_tool.py b/crewai_tools/tools/stagehand_tool/stagehand_tool.py index 557c6cb6..3d15d7ed 100644 --- a/crewai_tools/tools/stagehand_tool/stagehand_tool.py +++ b/crewai_tools/tools/stagehand_tool/stagehand_tool.py @@ -2,7 +2,6 @@ import json import logging from typing import Dict, List, Optional, Type, Union, Any - from pydantic import BaseModel, Field # Define a flag to track whether stagehand is available @@ -26,16 +25,16 @@ ActOptions = Any ExtractOptions = Any ObserveOptions = Any - + # Mock configure_logging function def configure_logging(level=None, remove_logger_name=None, quiet_dependencies=None): pass - + # Define only what's needed for class defaults class AvailableModel: CLAUDE_3_7_SONNET_LATEST = "anthropic.claude-3-7-sonnet-20240607" -from crewai.tools import BaseTool +from crewai.tools import BaseTool, EnvVar class StagehandCommandType(str): @@ -78,10 +77,10 @@ class StagehandToolSchema(BaseModel): ) command_type: Optional[str] = Field( "act", - description="""The type of command to execute (choose one): + description="""The type of command to execute (choose one): - 'act': Perform an action like clicking buttons, filling forms, etc. (default) - 'navigate': Specifically navigate to a URL - - 'extract': Extract structured data from the page + - 'extract': Extract structured data from the page - 'observe': Identify and analyze elements on the page """, ) @@ -136,7 +135,7 @@ class StagehandTool(BaseTool): name: str = "Web Automation Tool" description: str = """Use this tool to control a web browser and interact with websites using natural language. - + Capabilities: - Navigate to websites and follow links - Click buttons, links, and other elements @@ -144,7 +143,7 @@ class StagehandTool(BaseTool): - Search within websites - Extract information from web pages - Identify and analyze elements on a page - + To use this tool, provide a natural language instruction describing what you want to do. For different types of tasks, specify the command_type: - 'act': For performing actions (default) @@ -173,6 +172,13 @@ class StagehandTool(BaseTool): _logger: Optional[logging.Logger] = None _testing: bool = False + env_vars: List[EnvVar] = [ + EnvVar(name="BROWSERBASE_API_KEY", description="API key for Browserbase", required=False), + EnvVar(name="BROWSERBASE_PROJECT_ID", description="Project ID for Browserbase", required=False), + EnvVar(name="OPENAI_API_KEY", description="Model API key for OpenAI", required=False), + EnvVar(name="ANTHROPIC_API_KEY", description="Model API key for Anthropic", required=False), + ] + def __init__( self, api_key: Optional[str] = None, @@ -197,8 +203,9 @@ def __init__( self._logger = logging.getLogger(__name__) # For backward compatibility - browserbase_api_key = kwargs.get("browserbase_api_key") - browserbase_project_id = kwargs.get("browserbase_project_id") + browserbase_api_key = kwargs.get("browserbase_api_key") or os.getenv("BROWSERBASE_API_KEY") + browserbase_project_id = kwargs.get("browserbase_project_id") or os.getenv("BROWSERBASE_PROJECT_ID") + model_api_key = model_api_key or os.getenv("OPENAI_API_KEY") or os.getenv("ANTHROPIC_API_KEY") if api_key: self.api_key = api_key @@ -251,7 +258,7 @@ def _check_required_credentials(self): raise ImportError( "`stagehand-py` package not found, please run `uv add stagehand-py`" ) - + if not self.api_key: raise ValueError("api_key is required (or set BROWSERBASE_API_KEY in env).") if not self.project_id: @@ -265,7 +272,7 @@ def _check_required_credentials(self): async def _setup_stagehand(self, session_id: Optional[str] = None): """Initialize Stagehand if not already set up.""" - + # If we're in testing mode, return mock objects if self._testing: if not self._stagehand: @@ -275,43 +282,42 @@ def act(self, options): mock_result = type('MockResult', (), {})() mock_result.model_dump = lambda: {"message": "Action completed successfully"} return mock_result - + def goto(self, url): return None - + def extract(self, options): mock_result = type('MockResult', (), {})() mock_result.model_dump = lambda: {"data": "Extracted content"} return mock_result - + def observe(self, options): mock_result1 = type('MockResult', (), {"description": "Test element", "method": "click"})() return [mock_result1] - + class MockStagehand: def __init__(self): self.page = MockPage() self.session_id = "test-session-id" - + def init(self): return None - + def close(self): return None - + self._stagehand = MockStagehand() # No need to await the init call in test mode self._stagehand.init() self._page = self._stagehand.page self._session_id = self._stagehand.session_id - + return self._stagehand, self._page # Normal initialization for non-testing mode if not self._stagehand: self._logger.debug("Initializing Stagehand") # Create model client options with the API key - model_client_options = {"apiKey": self.model_api_key} # Build the StagehandConfig object config = StagehandConfig( @@ -323,13 +329,12 @@ def close(self): model_name=self.model_name, self_heal=self.self_heal, wait_for_captcha_solves=self.wait_for_captcha_solves, - model_client_options=model_client_options, verbose=self.verbose, - session_id=session_id or self._session_id, + browserbase_session_id=session_id or self._session_id, ) # Initialize Stagehand with config and server_url - self._stagehand = Stagehand(config=config, server_url=self.server_url) + self._stagehand = Stagehand(config=config, server_url=self.server_url, model_api_key=self.model_api_key) # Initialize the Stagehand instance await self._stagehand.init() @@ -355,7 +360,7 @@ async def _async_run( # Return predefined mock results based on command type if command_type.lower() == "act": return StagehandResult( - success=True, + success=True, data={"message": "Action completed successfully"} ) elif command_type.lower() == "navigate": @@ -368,7 +373,7 @@ async def _async_run( ) elif command_type.lower() == "extract": return StagehandResult( - success=True, + success=True, data={"data": "Extracted content", "metadata": {"source": "test"}} ) elif command_type.lower() == "observe": @@ -380,11 +385,11 @@ async def _async_run( ) else: return StagehandResult( - success=False, - data={}, + success=False, + data={}, error=f"Unknown command type: {command_type}" ) - + # Normal execution for non-test mode stagehand, page = await self._setup_stagehand(self._session_id) @@ -394,15 +399,8 @@ async def _async_run( # Process according to command type if command_type.lower() == "act": - # Create act options - act_options = ActOptions( - action=instruction, - model_name=self.model_name, - dom_settle_timeout_ms=self.dom_settle_timeout_ms, - ) - # Execute the act command - result = await page.act(act_options) + result = await page.act(instruction) self._logger.info(f"Act operation completed: {result}") return StagehandResult(success=True, data=result.model_dump()) @@ -427,31 +425,25 @@ async def _async_run( ) elif command_type.lower() == "extract": - # Create extract options - extract_options = ExtractOptions( + # Execute the extract command + result = await page.extract( instruction=instruction, model_name=self.model_name, dom_settle_timeout_ms=self.dom_settle_timeout_ms, - use_text_extract=True, + use_text_extract=True ) - - # Execute the extract command - result = await page.extract(extract_options) self._logger.info(f"Extract operation completed successfully {result}") return StagehandResult(success=True, data=result.model_dump()) elif command_type.lower() == "observe": - # Create observe options - observe_options = ObserveOptions( + # Execute the observe command + results = await page.observe( instruction=instruction, model_name=self.model_name, only_visible=True, dom_settle_timeout_ms=self.dom_settle_timeout_ms, ) - # Execute the observe command - results = await page.observe(observe_options) - # Format the observation results formatted_results = [] for i, result in enumerate(results): @@ -551,7 +543,7 @@ async def _async_close(self): self._stagehand = None self._page = None return - + if self._stagehand: await self._stagehand.close() self._stagehand = None @@ -565,7 +557,7 @@ def close(self): self._stagehand = None self._page = None return - + if self._stagehand: try: # Handle both synchronous and asynchronous cases @@ -586,9 +578,9 @@ def close(self): # Log but don't raise - we're cleaning up if self._logger: self._logger.error(f"Error closing Stagehand: {str(e)}") - + self._stagehand = None - + if self._page: self._page = None diff --git a/tool.specs.json b/tool.specs.json index c8b38de7..6c127b91 100644 --- a/tool.specs.json +++ b/tool.specs.json @@ -673,7 +673,14 @@ }, { "description": "", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Composio services", + "name": "COMPOSIO_API_KEY", + "required": true + } + ], "humanized_name": "ComposioTool", "init_params_schema": { "$defs": { @@ -832,7 +839,14 @@ }, { "description": "Generates images using OpenAI's Dall-E model.", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for OpenAI services", + "name": "OPENAI_API_KEY", + "required": true + } + ], "humanized_name": "Dall-E Tool", "init_params_schema": { "$defs": { @@ -1247,7 +1261,14 @@ }, { "description": "Search the internet using Exa", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Exa services", + "name": "EXA_API_KEY", + "required": false + } + ], "humanized_name": "EXASearchTool", "init_params_schema": { "$defs": { @@ -1288,6 +1309,29 @@ } }, "properties": { + "api_key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "API key for Exa services", + "required": false, + "title": "Api Key" + }, + "client": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null, + "title": "Client" + }, "content": { "anyOf": [ { @@ -1675,7 +1719,14 @@ }, { "description": "Crawl webpages using Firecrawl and return the contents", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Firecrawl services", + "name": "FIRECRAWL_API_KEY", + "required": true + } + ], "humanized_name": "Firecrawl web crawl tool", "init_params_schema": { "$defs": { @@ -1766,7 +1817,14 @@ }, { "description": "Scrape webpages using Firecrawl and return the contents", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Firecrawl services", + "name": "FIRECRAWL_API_KEY", + "required": true + } + ], "humanized_name": "Firecrawl web scrape tool", "init_params_schema": { "$defs": { @@ -1806,7 +1864,7 @@ "type": "object" } }, - "description": "Tool for scraping webpages using Firecrawl. To run this tool, you need to have a Firecrawl API key.\n\nArgs:\n api_key (str): Your Firecrawl API key.\n config (dict): Optional. It contains Firecrawl API parameters.\n\nDefault configuration options:\n formats (list[str]): Content formats to return. Default: [\"markdown\"]\n only_main_content (bool): Only return main content. Default: True\n include_tags (list[str]): Tags to include. Default: []\n exclude_tags (list[str]): Tags to exclude. Default: []\n headers (dict): Headers to include. Default: {}\n wait_for (int): Time to wait for page to load in ms. Default: 0\n json_options (dict): Options for JSON extraction. Default: None", + "description": "Tool for scraping webpages using Firecrawl. To run this tool, you need to have a Firecrawl API key.\n\nArgs:\n api_key (str): Your Firecrawl API key.\n config (dict): Optional. It contains Firecrawl API parameters.\n\nDefault configuration options:\n formats (list[str]): Content formats to return. Default: [\"markdown\"]\n onlyMainContent (bool): Only return main content. Default: True\n includeTags (list[str]): Tags to include. Default: []\n excludeTags (list[str]): Tags to exclude. Default: []\n headers (dict): Headers to include. Default: {}\n waitFor (int): Time to wait for page to load in ms. Default: 0\n json_options (dict): Options for JSON extraction. Default: None", "properties": { "api_key": { "anyOf": [ @@ -1850,7 +1908,14 @@ }, { "description": "Search webpages using Firecrawl and return the results", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Firecrawl services", + "name": "FIRECRAWL_API_KEY", + "required": true + } + ], "humanized_name": "Firecrawl web search tool", "init_params_schema": { "$defs": { @@ -2595,86 +2660,805 @@ } ], "default": null, - "title": "Default" - }, - "description": { - "title": "Description", - "type": "string" + "title": "Default" + }, + "description": { + "title": "Description", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + } + }, + "required": [ + "name", + "description" + ], + "title": "EnvVar", + "type": "object" + } + }, + "properties": { + "adapter": { + "$ref": "#/$defs/Adapter" + }, + "config": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Config" + }, + "db_uri": { + "description": "Mandatory database URI", + "title": "Db Uri", + "type": "string" + }, + "summarize": { + "default": false, + "title": "Summarize", + "type": "boolean" + } + }, + "required": [ + "db_uri" + ], + "title": "MySQLSearchTool", + "type": "object" + }, + "name": "MySQLSearchTool", + "package_dependencies": [], + "run_params_schema": { + "description": "Input for MySQLSearchTool.", + "properties": { + "search_query": { + "description": "Mandatory semantic search query you want to use to search the database's content", + "title": "Search Query", + "type": "string" + } + }, + "required": [ + "search_query" + ], + "title": "MySQLSearchToolSchema", + "type": "object" + } + }, + { + "description": "Converts natural language to SQL queries and executes them.", + "env_vars": [], + "humanized_name": "NL2SQLTool", + "init_params_schema": { + "$defs": { + "EnvVar": { + "properties": { + "default": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Default" + }, + "description": { + "title": "Description", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + } + }, + "required": [ + "name", + "description" + ], + "title": "EnvVar", + "type": "object" + } + }, + "properties": { + "columns": { + "additionalProperties": true, + "default": {}, + "title": "Columns", + "type": "object" + }, + "db_uri": { + "description": "The URI of the database to connect to.", + "title": "Database URI", + "type": "string" + }, + "tables": { + "default": [], + "items": {}, + "title": "Tables", + "type": "array" + } + }, + "required": [ + "db_uri" + ], + "title": "NL2SQLTool", + "type": "object" + }, + "name": "NL2SQLTool", + "package_dependencies": [], + "run_params_schema": { + "properties": { + "sql_query": { + "description": "The SQL query to execute.", + "title": "SQL Query", + "type": "string" + } + }, + "required": [ + "sql_query" + ], + "title": "NL2SQLToolInput", + "type": "object" + } + }, + { + "description": "Scrape Amazon product pages with Oxylabs Amazon Product Scraper", + "env_vars": [], + "humanized_name": "Oxylabs Amazon Product Scraper tool", + "init_params_schema": { + "$defs": { + "EnvVar": { + "properties": { + "default": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Default" + }, + "description": { + "title": "Description", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + } + }, + "required": [ + "name", + "description" + ], + "title": "EnvVar", + "type": "object" + }, + "OxylabsAmazonProductScraperConfig": { + "description": "Amazon Product Scraper configuration options:\nhttps://developers.oxylabs.io/scraper-apis/web-scraper-api/targets/amazon/product", + "properties": { + "callback_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "URL to your callback endpoint.", + "title": "Callback Url" + }, + "context": { + "anyOf": [ + { + "items": {}, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Additional advanced settings and controls for specialized requirements.", + "title": "Context" + }, + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The domain to limit the search results to.", + "title": "Domain" + }, + "geo_location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The Deliver to location.", + "title": "Geo Location" + }, + "parse": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True will return structured data.", + "title": "Parse" + }, + "parsing_instructions": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Instructions for parsing the results.", + "title": "Parsing Instructions" + }, + "render": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Enables JavaScript rendering.", + "title": "Render" + }, + "user_agent_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Device type and browser.", + "title": "User Agent Type" + } + }, + "title": "OxylabsAmazonProductScraperConfig", + "type": "object" + } + }, + "description": "Scrape Amazon product pages with OxylabsAmazonProductScraperTool.\n\nGet Oxylabs account:\nhttps://dashboard.oxylabs.io/en\n\nArgs:\n username (str): Oxylabs username.\n password (str): Oxylabs password.\n config: Configuration options. See ``OxylabsAmazonProductScraperConfig``", + "properties": { + "config": { + "$ref": "#/$defs/OxylabsAmazonProductScraperConfig" + }, + "oxylabs_api": { + "title": "Oxylabs Api" + } + }, + "required": [ + "oxylabs_api", + "config" + ], + "title": "OxylabsAmazonProductScraperTool", + "type": "object" + }, + "name": "OxylabsAmazonProductScraperTool", + "package_dependencies": [ + "oxylabs" + ], + "run_params_schema": { + "properties": { + "query": { + "description": "Amazon product ASIN", + "title": "Query", + "type": "string" + } + }, + "required": [ + "query" + ], + "title": "OxylabsAmazonProductScraperArgs", + "type": "object" + } + }, + { + "description": "Scrape Amazon search results with Oxylabs Amazon Search Scraper", + "env_vars": [], + "humanized_name": "Oxylabs Amazon Search Scraper tool", + "init_params_schema": { + "$defs": { + "EnvVar": { + "properties": { + "default": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Default" + }, + "description": { + "title": "Description", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + } + }, + "required": [ + "name", + "description" + ], + "title": "EnvVar", + "type": "object" + }, + "OxylabsAmazonSearchScraperConfig": { + "description": "Amazon Search Scraper configuration options:\nhttps://developers.oxylabs.io/scraper-apis/web-scraper-api/targets/amazon/search", + "properties": { + "callback_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "URL to your callback endpoint.", + "title": "Callback Url" + }, + "context": { + "anyOf": [ + { + "items": {}, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Additional advanced settings and controls for specialized requirements.", + "title": "Context" + }, + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The domain to limit the search results to.", + "title": "Domain" + }, + "geo_location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The Deliver to location.", + "title": "Geo Location" + }, + "pages": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The number of pages to scrape.", + "title": "Pages" + }, + "parse": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True will return structured data.", + "title": "Parse" + }, + "parsing_instructions": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Instructions for parsing the results.", + "title": "Parsing Instructions" + }, + "render": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Enables JavaScript rendering.", + "title": "Render" + }, + "start_page": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The starting page number.", + "title": "Start Page" + }, + "user_agent_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Device type and browser.", + "title": "User Agent Type" + } + }, + "title": "OxylabsAmazonSearchScraperConfig", + "type": "object" + } + }, + "description": "Scrape Amazon search results with OxylabsAmazonSearchScraperTool.\n\nGet Oxylabs account:\nhttps://dashboard.oxylabs.io/en\n\nArgs:\n username (str): Oxylabs username.\n password (str): Oxylabs password.\n config: Configuration options. See ``OxylabsAmazonSearchScraperConfig``", + "properties": { + "config": { + "$ref": "#/$defs/OxylabsAmazonSearchScraperConfig" + }, + "oxylabs_api": { + "title": "Oxylabs Api" + } + }, + "required": [ + "oxylabs_api", + "config" + ], + "title": "OxylabsAmazonSearchScraperTool", + "type": "object" + }, + "name": "OxylabsAmazonSearchScraperTool", + "package_dependencies": [ + "oxylabs" + ], + "run_params_schema": { + "properties": { + "query": { + "description": "Amazon search term", + "title": "Query", + "type": "string" + } + }, + "required": [ + "query" + ], + "title": "OxylabsAmazonSearchScraperArgs", + "type": "object" + } + }, + { + "description": "Scrape Google Search results with Oxylabs Google Search Scraper", + "env_vars": [], + "humanized_name": "Oxylabs Google Search Scraper tool", + "init_params_schema": { + "$defs": { + "EnvVar": { + "properties": { + "default": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Default" + }, + "description": { + "title": "Description", + "type": "string" + }, + "name": { + "title": "Name", + "type": "string" + }, + "required": { + "default": true, + "title": "Required", + "type": "boolean" + } + }, + "required": [ + "name", + "description" + ], + "title": "EnvVar", + "type": "object" + }, + "OxylabsGoogleSearchScraperConfig": { + "description": "Google Search Scraper configuration options:\nhttps://developers.oxylabs.io/scraper-apis/web-scraper-api/targets/google/search/search", + "properties": { + "callback_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "URL to your callback endpoint.", + "title": "Callback Url" + }, + "context": { + "anyOf": [ + { + "items": {}, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Additional advanced settings and controls for specialized requirements.", + "title": "Context" + }, + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The domain to limit the search results to.", + "title": "Domain" + }, + "geo_location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The Deliver to location.", + "title": "Geo Location" + }, + "limit": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Number of results to retrieve in each page.", + "title": "Limit" + }, + "pages": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The number of pages to scrape.", + "title": "Pages" + }, + "parse": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True will return structured data.", + "title": "Parse" + }, + "parsing_instructions": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Instructions for parsing the results.", + "title": "Parsing Instructions" + }, + "render": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Enables JavaScript rendering.", + "title": "Render" }, - "name": { - "title": "Name", - "type": "string" + "start_page": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The starting page number.", + "title": "Start Page" }, - "required": { - "default": true, - "title": "Required", - "type": "boolean" + "user_agent_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Device type and browser.", + "title": "User Agent Type" } }, - "required": [ - "name", - "description" - ], - "title": "EnvVar", + "title": "OxylabsGoogleSearchScraperConfig", "type": "object" } }, + "description": "Scrape Google Search results with OxylabsGoogleSearchScraperTool.\n\nGet Oxylabs account:\nhttps://dashboard.oxylabs.io/en\n\nArgs:\n username (str): Oxylabs username.\n password (str): Oxylabs password.\n config: Configuration options. See ``OxylabsGoogleSearchScraperConfig``", "properties": { - "adapter": { - "$ref": "#/$defs/Adapter" - }, "config": { - "anyOf": [ - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Config" - }, - "db_uri": { - "description": "Mandatory database URI", - "title": "Db Uri", - "type": "string" + "$ref": "#/$defs/OxylabsGoogleSearchScraperConfig" }, - "summarize": { - "default": false, - "title": "Summarize", - "type": "boolean" + "oxylabs_api": { + "title": "Oxylabs Api" } }, "required": [ - "db_uri" + "oxylabs_api", + "config" ], - "title": "MySQLSearchTool", + "title": "OxylabsGoogleSearchScraperTool", "type": "object" }, - "name": "MySQLSearchTool", - "package_dependencies": [], + "name": "OxylabsGoogleSearchScraperTool", + "package_dependencies": [ + "oxylabs" + ], "run_params_schema": { - "description": "Input for MySQLSearchTool.", "properties": { - "search_query": { - "description": "Mandatory semantic search query you want to use to search the database's content", - "title": "Search Query", + "query": { + "description": "Search query", + "title": "Query", "type": "string" } }, "required": [ - "search_query" + "query" ], - "title": "MySQLSearchToolSchema", + "title": "OxylabsGoogleSearchScraperArgs", "type": "object" } }, { - "description": "Converts natural language to SQL queries and executes them.", + "description": "Scrape any url with Oxylabs Universal Scraper", "env_vars": [], - "humanized_name": "NL2SQLTool", + "humanized_name": "Oxylabs Universal Scraper tool", "init_params_schema": { "$defs": { "EnvVar": { @@ -2711,47 +3495,140 @@ ], "title": "EnvVar", "type": "object" + }, + "OxylabsUniversalScraperConfig": { + "description": "Universal Scraper configuration options:\nhttps://developers.oxylabs.io/scraper-apis/web-scraper-api/other-websites", + "properties": { + "callback_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "URL to your callback endpoint.", + "title": "Callback Url" + }, + "context": { + "anyOf": [ + { + "items": {}, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Additional advanced settings and controls for specialized requirements.", + "title": "Context" + }, + "geo_location": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The Deliver to location.", + "title": "Geo Location" + }, + "parse": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "default": null, + "description": "True will return structured data.", + "title": "Parse" + }, + "parsing_instructions": { + "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Instructions for parsing the results.", + "title": "Parsing Instructions" + }, + "render": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Enables JavaScript rendering.", + "title": "Render" + }, + "user_agent_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Device type and browser.", + "title": "User Agent Type" + } + }, + "title": "OxylabsUniversalScraperConfig", + "type": "object" } }, + "description": "Scrape any website with OxylabsUniversalScraperTool.\n\nGet Oxylabs account:\nhttps://dashboard.oxylabs.io/en\n\nArgs:\n username (str): Oxylabs username.\n password (str): Oxylabs password.\n config: Configuration options. See ``OxylabsUniversalScraperConfig``", "properties": { - "columns": { - "additionalProperties": true, - "default": {}, - "title": "Columns", - "type": "object" - }, - "db_uri": { - "description": "The URI of the database to connect to.", - "title": "Database URI", - "type": "string" + "config": { + "$ref": "#/$defs/OxylabsUniversalScraperConfig" }, - "tables": { - "default": [], - "items": {}, - "title": "Tables", - "type": "array" + "oxylabs_api": { + "title": "Oxylabs Api" } }, "required": [ - "db_uri" + "oxylabs_api", + "config" ], - "title": "NL2SQLTool", + "title": "OxylabsUniversalScraperTool", "type": "object" }, - "name": "NL2SQLTool", - "package_dependencies": [], + "name": "OxylabsUniversalScraperTool", + "package_dependencies": [ + "oxylabs" + ], "run_params_schema": { "properties": { - "sql_query": { - "description": "The SQL query to execute.", - "title": "SQL Query", + "url": { + "description": "Website URL", + "title": "Url", "type": "string" } }, "required": [ - "sql_query" + "url" ], - "title": "NL2SQLToolInput", + "title": "OxylabsUniversalScraperArgs", "type": "object" } }, @@ -4364,7 +5241,14 @@ }, { "description": "A tool to perform to perform a job search in the US with a search_query.", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Serply services", + "name": "SERPLY_API_KEY", + "required": true + } + ], "humanized_name": "Job Search", "init_params_schema": { "$defs": { @@ -4485,7 +5369,14 @@ }, { "description": "A tool to perform News article search with a search_query.", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Serply services", + "name": "SERPLY_API_KEY", + "required": true + } + ], "humanized_name": "News Search", "init_params_schema": { "$defs": { @@ -4592,7 +5483,14 @@ }, { "description": "A tool to perform scholarly literature search with a search_query.", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Serply services", + "name": "SERPLY_API_KEY", + "required": true + } + ], "humanized_name": "Scholar Search", "init_params_schema": { "$defs": { @@ -4850,7 +5748,14 @@ }, { "description": "A tool to perform convert a webpage to markdown to make it easier for LLMs to understand", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for Serply services", + "name": "SERPLY_API_KEY", + "required": true + } + ], "humanized_name": "Webpage to Markdown", "init_params_schema": { "$defs": { @@ -5385,8 +6290,33 @@ } }, { - "description": "Use this tool to control a web browser and interact with websites using natural language.\n \n Capabilities:\n - Navigate to websites and follow links\n - Click buttons, links, and other elements\n - Fill in forms and input fields\n - Search within websites\n - Extract information from web pages\n - Identify and analyze elements on a page\n \n To use this tool, provide a natural language instruction describing what you want to do.\n For different types of tasks, specify the command_type:\n - 'act': For performing actions (default)\n - 'navigate': For navigating to a URL (shorthand for act with navigation)\n - 'extract': For getting data from the page\n - 'observe': For finding and analyzing elements", - "env_vars": [], + "description": "Use this tool to control a web browser and interact with websites using natural language.\n\n Capabilities:\n - Navigate to websites and follow links\n - Click buttons, links, and other elements\n - Fill in forms and input fields\n - Search within websites\n - Extract information from web pages\n - Identify and analyze elements on a page\n\n To use this tool, provide a natural language instruction describing what you want to do.\n For different types of tasks, specify the command_type:\n - 'act': For performing actions (default)\n - 'navigate': For navigating to a URL (shorthand for act with navigation)\n - 'extract': For getting data from the page\n - 'observe': For finding and analyzing elements", + "env_vars": [ + { + "default": null, + "description": "API key for Browserbase", + "name": "BROWSERBASE_API_KEY", + "required": false + }, + { + "default": null, + "description": "Project ID for Browserbase", + "name": "BROWSERBASE_PROJECT_ID", + "required": false + }, + { + "default": null, + "description": "Model API key for OpenAI", + "name": "OPENAI_API_KEY", + "required": false + }, + { + "default": null, + "description": "Model API key for Anthropic", + "name": "ANTHROPIC_API_KEY", + "required": false + } + ], "humanized_name": "Web Automation Tool", "init_params_schema": { "$defs": { @@ -5396,7 +6326,8 @@ "gpt-4o-mini", "claude-3-5-sonnet-latest", "claude-3-7-sonnet-latest", - "computer-use-preview" + "computer-use-preview", + "gemini-2.0-flash" ], "title": "AvailableModel", "type": "string" @@ -5543,7 +6474,7 @@ } ], "default": "act", - "description": "The type of command to execute (choose one): \n - 'act': Perform an action like clicking buttons, filling forms, etc. (default)\n - 'navigate': Specifically navigate to a URL\n - 'extract': Extract structured data from the page \n - 'observe': Identify and analyze elements on the page\n ", + "description": "The type of command to execute (choose one):\n - 'act': Perform an action like clicking buttons, filling forms, etc. (default)\n - 'navigate': Specifically navigate to a URL\n - 'extract': Extract structured data from the page\n - 'observe': Identify and analyze elements on the page\n ", "title": "Command Type" }, "instruction": { @@ -5671,7 +6602,14 @@ }, { "description": "This tool uses OpenAI's Vision API to describe the contents of an image.", - "env_vars": [], + "env_vars": [ + { + "default": null, + "description": "API key for OpenAI services", + "name": "OPENAI_API_KEY", + "required": true + } + ], "humanized_name": "Vision Tool", "init_params_schema": { "$defs": { @@ -5778,36 +6716,6 @@ ], "title": "EnvVar", "type": "object" - }, - "Vectorizers": { - "description": "The available vectorization modules in Weaviate.\n\nThese modules encode binary data into lists of floats called vectors.\nSee the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules) for more details.\n\nAttributes:\n `NONE`\n No vectorizer.\n `TEXT2VEC_AWS`\n Weaviate module backed by AWS text-based embedding models.\n `TEXT2VEC_COHERE`\n Weaviate module backed by Cohere text-based embedding models.\n `TEXT2VEC_CONTEXTIONARY`\n Weaviate module backed by Contextionary text-based embedding models.\n `TEXT2VEC_GPT4ALL`\n Weaviate module backed by GPT-4-All text-based embedding models.\n `TEXT2VEC_HUGGINGFACE`\n Weaviate module backed by HuggingFace text-based embedding models.\n `TEXT2VEC_OPENAI`\n Weaviate module backed by OpenAI and Azure-OpenAI text-based embedding models.\n `TEXT2VEC_PALM`\n Weaviate module backed by PaLM text-based embedding models.\n `TEXT2VEC_TRANSFORMERS`\n Weaviate module backed by Transformers text-based embedding models.\n `TEXT2VEC_JINAAI`\n Weaviate module backed by Jina AI text-based embedding models.\n `TEXT2VEC_VOYAGEAI`\n Weaviate module backed by Voyage AI text-based embedding models.\n `TEXT2VEC_WEAVIATE`\n Weaviate module backed by Weaviate's self-hosted text-based embedding models.\n `IMG2VEC_NEURAL`\n Weaviate module backed by a ResNet-50 neural network for images.\n `MULTI2VEC_CLIP`\n Weaviate module backed by a Sentence-BERT CLIP model for images and text.\n `MULTI2VEC_PALM`\n Weaviate module backed by a palm model for images and text.\n `MULTI2VEC_BIND`\n Weaviate module backed by the ImageBind model for images, text, audio, depth, IMU, thermal, and video.\n `MULTI2VEC_VOYAGEAI`\n Weaviate module backed by a Voyage AI multimodal embedding models.\n `REF2VEC_CENTROID`\n Weaviate module backed by a centroid-based model that calculates an object's vectors from its referenced vectors.", - "enum": [ - "none", - "text2vec-aws", - "text2vec-cohere", - "text2vec-contextionary", - "text2vec-databricks", - "text2vec-gpt4all", - "text2vec-huggingface", - "text2vec-mistral", - "text2vec-ollama", - "text2vec-openai", - "text2vec-palm", - "text2vec-transformers", - "text2vec-jinaai", - "text2vec-voyageai", - "text2vec-weaviate", - "img2vec-neural", - "multi2vec-clip", - "multi2vec-cohere", - "multi2vec-jinaai", - "multi2vec-bind", - "multi2vec-palm", - "multi2vec-voyageai", - "ref2vec-centroid" - ], - "title": "Vectorizers", - "type": "string" } }, "description": "Tool to search the Weaviate database", @@ -5875,14 +6783,13 @@ }, "vectorizer": { "anyOf": [ - { - "$ref": "#/$defs/Vectorizers" - }, + {}, { "type": "null" } ], - "default": null + "default": null, + "title": "Vectorizer" }, "weaviate_api_key": { "description": "The API key for the Weaviate cluster",