deepagents deploy 将你的智能体配置和文件打包在一起,作为 LangSmith 部署进行部署。
LangSmith 部署是水平可扩展的服务器,提供 30 多个端点,包括 MCP、A2A、Agent Protocol、人机协作和记忆 API。基于开放标准构建:
- Open source harness: MIT licensed, available for Python and TypeScript
- AGENTS.md: open standard for agent instructions
- Agent Skills: open standard for agent knowledge and actions
- Any model, any sandbox: no provider lock-in
- Open protocols: MCP, A2A, Agent Protocol
- Self-hostable: LangSmith Deployments can be self-hosted so memory stays in your infrastructure
与 Claude Managed Agents 对比
安装
安装 CLI 或直接使用uvx 运行:
用法
deepagents deploy looks for deepagents.toml in the current directory. Pass --config to use a different path:
deepagents deploy fully rebuils and creates a new revision on every invocation. Use deepagents dev for local iteration.
deepagents init
Scaffold a new agent project:
After init, edit your project files and run
deepagents deploy.
设置
deploy 命令使用以下项目布局。将以下文件放在deepagents.toml 旁边,它们会被自动发现和部署:
配置文件
deepagents.toml 配置智能体的身份和沙箱环境。只有 [agent] 部分是必需的。[sandbox] 部分是可选的,默认不使用沙箱。
[agent]
Configure the core agent identity:
deepagents.toml
[sandbox]
Configure the isolated execution environment where the agent runs code. Sandboxes provide a container with a filesystem and shell access, so untrusted code cannot affect the host. For supported providers and advanced sandbox configuration, see sandboxes.
deepagents.toml
Scope behavior:
"thread"(default): Each conversation gets its own sandbox. Different threads get different sandboxes, but the same thread reuses its sandbox across turns. Use this when each conversation should start with a clean environment."assistant": All conversations share one sandbox. Files, installed packages, and other state persist across conversations. Use this when the agent maintains a long-lived workspace like a cloned repo.
[auth]
Add an [auth] section to configure authentication on the deployed agent. [auth] is required when [frontend].enabled = true; otherwise it is optional (without it, LangSmith Deployment’s default x-api-key requirement applies).
deepagents.toml
Pick one of three providers:
- Clerk (
[auth] provider = "clerk") — per-user real authentication. Each user signs in; threads and memory are scoped per user. - Supabase (
[auth] provider = "supabase") — per-user real authentication. Same per-user scoping as Clerk. - Anonymous (
[auth] provider = "anonymous") — the bundler ships a permissive auth handler that overrides LangSmith Deployment’s defaultx-api-keyrequirement so the frontend can reach/threads, which means anyone with the deploy URL can call the API. The frontend assigns each browser a UUID cookie and filters the thread picker by it (UX-only scoping, not security). The CLI requires an interactivey/Nconfirmation before pushing.
.env alongside your other credentials:
Runtime behavior:
- Unauthenticated requests return
401. - On success, the authenticated user’s identity is injected into
config.configurable.langgraph_auth_user_id. - All resources (threads, runs, store) are automatically scoped per user via
metadata.owner. - LangSmith Studio bypasses auth for local development.
[frontend]
Frontend deployment requires
deepagents-cli>=0.0.43.[frontend] to ship a prebuilt React chat UI alongside your agent on the same deployment. The frontend is mounted at /app on your deployment URL; your LangGraph API stays at the root (/threads, /runs, /assistants). The frontend provides:
- Streaming chat with the agent
- Thread picker with auto-generated titles from the first user message
- Real-time todos, files, and subagent activity panels that reflect your deep agent’s live graph state
- Light/dark theme toggle that follows OS preference on first load and persists after
- (Clerk / Supabase only) Sign-in / sign-up / sign-out flows — Clerk ships its full widget (social logins, password reset); Supabase ships email/password with a built-in password reset flow
[auth]).
deepagents.toml
Environment variables:
The frontend reuses most of what
[auth] already requires. Only Clerk needs one additional browser-facing key.
Post-deploy setup:
After deploying, add your deployment URL to your auth provider’s dashboard so auth redirects land back in the app. This is a one-time step per deployment URL.
- Clerk: Dashboard → your application → Domains → add your deployment host (e.g.
clerk-abc.us.langgraph.app). Clerk development instances auto-whitelist localhost; production deployment URLs need explicit whitelisting. - Supabase: Dashboard → Authentication → URL Configuration → add
https://<your-deployment>/app/**to Redirect URLs. Without this, password-reset and email-confirmation links won’t route back to your app.
环境变量
将.env 文件放在 deepagents.toml 旁边,包含你的 API 密钥:
身份认证
运行时的认证策略取决于[auth]:
[auth] provider = "supabase"or"clerk"— per-user real authentication. Pass the user’s auth-provider token in theAuthorizationheader.[auth] provider = "anonymous"— the bundler ships a permissive auth handler. The API is open to anyone with the deploy URL. No header required. (Required when shipping[frontend]without real per-user auth.)- No
[auth]section — the deploy falls back to LangSmith Deployment’s defaultx-api-keyrequirement. Pass your LangSmith API key in thex-api-keyheader. Only valid when[frontend].enabledisfalseor unset.
[auth] is configured for supabase or clerk, pass the token from your auth provider in the Authorization header:
- curl
- Python (langgraph-sdk)
Each user’s threads and memory are isolated automatically—User B cannot see User A’s threads.
部署端点
部署的服务器暴露以下端点:- MCP: call your agent as a tool from other agents
- A2A: multi-agent orchestration via A2A protocol
- Agent Protocol: standard API for building UIs
- Human-in-the-loop: approval gates for sensitive actions
- Memory: short-term and long-term memory access
用户记忆
用户记忆为每个用户提供自己的可写AGENTS.md,跨对话持久化。要启用它,在项目根目录创建 user/ 目录:
user/ directory exists (even if empty), every user gets their own AGENTS.md at /memories/user/AGENTS.md. If you provide user/AGENTS.md, its contents are used as the initial template; otherwise an empty file is seeded.
At runtime, user memory is scoped per user via custom auth (runtime.server_info.user.identity). The first time a user interacts with the agent, their namespace is seeded with the template. Subsequent interactions reuse the existing file — the agent’s edits persist, and redeployments never overwrite user data.
How it works
- Bundle time — the bundler reads
user/AGENTS.md(or uses an empty string) and includes it in the seed payload. - Runtime (first access) — when the agent sees a
user_idfor the first time, it writes theAGENTS.mdtemplate to the store under that user’s namespace. Existing entries are never overwritten. - Preloaded — the user
AGENTS.mdis passed to the memory middleware, so the agent sees its contents in context at the start of every conversation. - Writable — the agent can update it using the
edit_filetool. The sharedAGENTS.mdfile and skills folder are read-only.
Permissions
User identity
Theuser_id is resolved from custom auth via runtime.user.identity. The platform injects the authenticated user’s identity automatically — no need to pass it through configurable. If no authenticated user is present, user memory features are gracefully skipped for that invocation.
子智能体
子智能体允许主智能体将专门的任务委派给隔离的子智能体。每个子智能体有自己的系统提示词、可选的技能和可选的 MCP 工具。主智能体接收一个task 工具,按名称将工作分派给子智能体。
For background on why subagents are useful and how they work at the SDK level, see Subagents.
Directory structure
Create asubagents/ directory at your project root. Each subdirectory is a subagent:
Each subagent subdirectory may contain:
Subagent configuration
subagents/researcher/deepagents.toml
Inheritance
Subagents inherit some properties from the main agent by default:Memory isolation
Each subagent gets a dedicated, isolated memory namespace at/memories/subagents/<name>/. The subagent’s AGENTS.md and skills are seeded into this namespace at deploy time.
Example
A go-to-market agent that delegates research to a specialized subagent:deepagents.toml
subagents/researcher/deepagents.toml
subagents/researcher/AGENTS.md
限制
- MCP:仅支持 HTTP/SSE。 Stdio 传输在打包时会被拒绝。
- 不支持自定义 Python 工具。 使用 MCP 服务器来暴露自定义工具逻辑。
示例
A content writing agent with per-user preferences that the agent can update:deepagents.toml
deepagents.toml
deepagents.toml
连接这些文档到 Claude、VSCode 等工具,通过 MCP 获取实时答案。

