模型

默认情况下,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="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 – 生成子智能体处理特定任务

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.