Prerequisites
开始前,请确保你已有 model provider(例如 Gemini、Anthropic、OpenAI)的 API key。Deep Agents 需要支持 tool calling 的 model。请参阅 customization 了解如何配置 model。
Step 1: Install dependencies
本指南使用 Tavily 作为示例 search provider,但你可以替换为任何 search API(例如 DuckDuckGo、SerpAPI、Brave Search)。
Step 2: Set up your API keys
- Google
- OpenAI
- Anthropic
- OpenRouter
- Fireworks
- Baseten
- Ollama
- Other
Step 3: Create a search tool
Step 4: Create a deep agent
传入provider:model 格式的 model string,或传入 initialized model instance。请参阅 supported models 查看所有 providers,并参阅 suggested models 查看经过测试的推荐 models。
Step 5: Run the agent
How does it work?
你的 deep agent 会自动:- 规划方法:使用 built-in
write_todostool 拆解 research task。 - 开展研究:调用
internet_searchtool 收集信息。 - 管理 context:使用 file system tools(
write_file、read_file)卸载大型 search results。 - 生成 subagents:按需将复杂 subtasks 委派给 specialized subagents。
- 综合报告:将 findings 汇总为连贯的 response。
Examples
有关可以用 Deep Agents 构建的 agents、patterns 和 applications,请参阅 Examples。Streaming
Deep Agents 具有 built-in streaming,可通过 LangGraph 获取 agent execution 的 real-time updates。 这让你可以逐步观察 output,并 review 和 debug agent 与 subagent 的工作,例如 tool calls、tool results 和 LLM responses。Next steps
现在你已经构建了第一个 deep agent:- Customize your agent:了解 customization options,包括 custom system prompts、tools 和 subagents。
- Add long-term memory:跨 conversations 启用 persistent memory。
- Deploy to production:使用 Managed Deep Agents 在 LangSmith 中创建、运行和运营 deep agents。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

