feat: add browse toolkit in examples

This commit is contained in:
Yuhang Zhou
2026-02-14 17:11:25 +08:00
parent 1b52388b53
commit ab9e829718
5 changed files with 132 additions and 19 deletions

View File

@@ -33,6 +33,7 @@ from camel.toolkits import (
ImageAnalysisToolkit,
SearchToolkit,
VideoAnalysisToolkit,
BrowserToolkit,
FileToolkit,
)
from camel.types import ModelPlatformType, ModelType
@@ -79,12 +80,29 @@ def construct_agent_list() -> List[Dict[str, Any]]:
model_config_dict={"temperature": 0},
)
browsing_model = ModelFactory.create(
model_platform=ModelPlatformType.ANTHROPIC,
model_type=ModelType.CLAUDE_3_7_SONNET,
model_config_dict={"temperature": 0},
)
planning_model = ModelFactory.create(
model_platform=ModelPlatformType.ANTHROPIC,
model_type=ModelType.CLAUDE_3_7_SONNET,
model_config_dict={"temperature": 0},
)
search_toolkit = SearchToolkit()
document_processing_toolkit = DocumentProcessingToolkit(model=document_processing_model)
image_analysis_toolkit = ImageAnalysisToolkit(model=image_analysis_model)
code_runner_toolkit = CodeExecutionToolkit(sandbox="subprocess", verbose=True)
file_toolkit = FileToolkit()
excel_toolkit = ExcelToolkit()
browser_toolkit = BrowserToolkit(
headless=False, # Set to True for headless mode (e.g., on remote servers)
web_agent_model=browsing_model,
planning_agent_model=planning_model,
)
web_agent = ChatAgent(
"""You are a helpful assistant that can search the web, extract webpage content, simulate browser actions, and provide relevant information to solve the given task.
@@ -110,6 +128,7 @@ Here are some tips that help you perform web search:
FunctionTool(search_toolkit.search_duckduckgo),
FunctionTool(search_toolkit.search_wiki),
FunctionTool(document_processing_toolkit.extract_document_content),
*browser_toolkit.get_tools(),
]
)