3. 编辑 config/config.toml 添加 API 密钥和自定义设置:(注: model和base_url在deepseek充值界面接口文档就可以看到)
# Global LLM configuration [llm] model = "deepseek-chat" base_url = "https://api.deepseek.com" api_key = "sk-8.....9ff89" max_tokens = 4096 temperature = 0.0
# [llm] #AZURE OPENAI: # api_type= 'azure' # model = "YOUR_MODEL_NAME" #"gpt-4o-mini" # base_url = "{YOUR_AZURE_ENDPOINT.rstrip('/')}/openai/deployments/{AZURE_DEPOLYMENT_ID}" # api_key = "AZURE API KEY" # max_tokens = 8096 # temperature = 0.0 # api_version="AZURE API VERSION" #"2024-08-01-preview"
# Optional configuration for specific LLM models [llm.vision] model = "claude-3-5-sonnet" base_url = "https://api.openai.com/v1" api_key = "sk-..."
启动
1
python main.py
输出如下:
1 2 3 4
INFO [browser_use] BrowserUse logging setup complete with level info INFO [root] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information. Enter your prompt (or 'exit'/'quit' to quit): (这里就是发挥创意的地方了)
for result in soup.select('.b_algo'): link = result.find('a', href=True) if link and'href'in link.attrs: links.append(link['href']) iflen(links) >= num_results: return links rst = links[:num_results] return rst
from app.agent.toolcall import ToolCallAgent from app.prompt.manus import NEXT_STEP_PROMPT, SYSTEM_PROMPT from app.tool import Terminate, ToolCollection from app.tool.browser_use_tool import BrowserUseTool from app.tool.file_saver import FileSaver from app.tool.google_search import GoogleSearch # 一定要先引入 from app.tool.bing_search import BingSearch from app.tool.python_execute import PythonExecute
classManus(ToolCallAgent): """ A versatile general-purpose agent that uses planning to solve various tasks. This agent extends PlanningAgent with a comprehensive set of tools and capabilities, including Python execution, web browsing, file operations, and information retrieval to handle a wide range of user requests. """
name: str = "Manus" description: str = ( "A versatile agent that can solve various tasks using multiple tools" )