Skip to main content

模型

默认情况下,deepagents 使用 "claude-sonnet-4-5-20250929"。您可以通过传递任何 LangChain 模型对象 来自定义此设置。
from langchain.chat_models import init_chat_model
from deepagents import create_deep_agent

model = init_chat_model(
    model="openai:gpt-5",
)
agent = create_deep_agent(
    model=model,
)

系统提示

深度智能体内置了受Claude Code的系统提示灵感的系统提示。默认系统提示包含使用内置规划工具、文件系统工具和子代理的详细说明。 每个针对特定用例定制的深度智能体应包含一个针对该用例的定制系统提示。
from deepagents import create_deep_agent

research_instructions = """\
You are an expert researcher. Your job is to conduct \
thorough research, and then write a polished report. \
"""

agent = create_deep_agent(
    system_prompt=research_instructions,
)

工具

与工具调用智能体一样,深度智能体获得一组它有权访问的顶级工具。
import os
from typing import Literal
from tavily import TavilyClient
from deepagents import create_deep_agent

tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])

def internet_search(
    query: str,
    max_results: int = 5,
    topic: Literal["general", "news", "finance"] = "general",
    include_raw_content: bool = False,
):
    """Run a web search"""
    return tavily_client.search(
        query,
        max_results=max_results,
        include_raw_content=include_raw_content,
        topic=topic,
    )

agent = create_deep_agent(
    tools=[internet_search]
)
除了您提供的任何工具外,深度智能体还可以访问一系列默认工具:
  • write_todos – 更新智能体的待办事项列表
  • ls – 列出智能体文件系统中的所有文件
  • read_file – 从智能体文件系统中读取文件
  • write_file – 在智能体文件系统中创建新文件
  • edit_file – 编辑智能体文件系统中的现有文件
  • task – 启动子智能体以处理特定任务