dcode)是基于 Deep Agents SDK 构建的 open source coding agent。
它可与任何 large language model 配合使用,并支持在 session 中途切换 providers 或 models。
Persistent memory 会在 conversations 之间保留 context,customizable skills 会塑造其行为,approval controls 会管控 code execution。
快速开始
添加 provider credentials
Deep Agents Code 可与任何 tool-calling LLM 配合使用。Models 通过 providers 访问:OpenAI、Anthropic 和 Google 默认随包提供,其他 providers(Ollama、Groq、xAI 等)按需安装。使用
/auth command 设置 API keys。完整列表和 credential details 请参阅 Providers。Web search 使用 Tavily,并需要
TAVILY_API_KEY。请参阅 Enable web search。给 agent 一个 task
启用 tracing(可选)
若要在 LangSmith 中记录 agent operations、tool calls 和 decisions,请将以下内容添加到 更多 details 和 usage 请参阅 Trace with LangSmith。
~/.deepagents/.env,或在 shell 中 export variables:~/.deepagents/.env
Deep Agents Code 尚不正式支持 Windows。Windows users 可以尝试在 Windows Subsystem for Linux (WSL) 下运行。
Capabilities
Deep Agents Code 具有以下 built-in capabilities:- File operations:读取、写入和编辑 disk 上的 files。
- Shell execution:执行 commands 以运行 tests、build projects、管理 dependencies,并与 version control 交互。
- Remote sandboxes:远程运行 agent tools,而不是在 local machine 上运行。
- Web search:搜索 web 以获取 up-to-date information 和 documentation。需要 Tavily API key。
- Task planning and tracking:将 complex tasks 拆分为离散 steps 并跟踪 progress。
- Subagents:将 work 委派给 task-specific subagents。
- Memory storage and retrieval:跨 sessions 存储和检索 information,使 agents 能记住 project conventions 和 learned patterns。
- Context compaction & offloading:summarize 较早的 conversation messages,并将 originals offload 到 storage。
- Human-in-the-loop:对 sensitive tool operations 要求 human approval。
- Skills:用 custom expertise 和 instructions 扩展 agent capabilities。
- MCP tools:从 Model Context Protocol servers 加载 external tools。
- Tracing:在 LangSmith 中 trace agent operations,用于 observability 和 debugging。
Full list of built-in tools
Full list of built-in tools
Built-in tools
Agent 附带以下无需配置即可使用的 built-in tools:| Tool | Description | Human-in-the-Loop |
|---|---|---|
ls | 列出 files 和 directories | - |
read_file | 读取 file 内容;为 images、audio、video 和 PDFs 返回 multimodal blocks | - |
write_file | 创建或覆盖 file | Required1 |
edit_file | 对现有 files 进行 targeted edits | Required1 |
glob | 查找匹配 pattern 的 files | - |
grep | 跨 files 搜索 text patterns | - |
execute | 在本地或 remote sandbox 中执行 shell commands | Required1 |
web_search | 使用 Tavily 搜索 web(请参阅 Enable web search) | Required1 |
fetch_url | Fetch web pages 并转换为 markdown | Required1 |
task | 将 work 委派给 subagents 并行执行3 | Required1 |
ask_user | 向 user 提出 free-form 或 multiple-choice questions | - |
compact_conversation | Summarize 较早 messages、将 originals offload 到 backend storage,并在 context 中用 summary 替换它们 | Mixed2 |
write_todos | 为 complex work 创建并管理 task lists | - |
Non-interactive mode 默认禁用 shell。用
-S/--shell-allow-list(或 DEEPAGENTS_CODE_SHELL_ALLOW_LIST)allowlist commands。使用 recommended 可启用 read-only safe defaults,或使用 all 允许任何 command。请参阅 Non-interactive mode and piping。/conversation_history/{thread_id}.md),在 context 中用 summary 替换它们。如有需要,agent 仍可从 offloaded file 检索完整 history。compact_conversation tool 允许 agent(或你)按需触发 offloading。当它作为 tool 调用时,默认需要 user approval。3:当通过 config.toml 中的 [async_subagents] section 配置 async subagents(请参阅 Async subagents)时,会提供 additional tools:start_async_task、update_async_task 和 cancel_async_task(都受 approval gate 控制),以及 check_async_task 和 list_async_tasks。Command reference
Command-line options
Command-line options
| Option | Description |
|---|---|
-a, --agent NAME | 使用带独立 memory 的 named agent。覆盖 config.toml 中的 [agents].recent。Default:agent(如果设置了 [agents].recent,则使用最近使用过的 agent) |
-M, --model MODEL | 使用特定 model(provider:model) |
--model-params JSON | 作为 JSON string 传给 model 的 extra kwargs(例如 '{"temperature": 0.7}') |
--default-model [MODEL] | 设置 default model |
--clear-default-model | 清除 default model |
-r, --resume [ID] | Resume session:-r 表示最近 session,-r <ID> 表示特定 thread |
-m, --message TEXT | Session 启动时自动提交的 initial prompt(interactive mode) |
--skill NAME | 启动时调用 skill |
--startup-cmd CMD | 启动时、first prompt 前运行的 shell command。Output 会在 transcript 中渲染供你参考,但不会添加到 agent message history。若要将 command output 交给 agent,请改为通过 stdin pipe 传入(例如 git diff | dcode -n "Review these changes")。Non-zero exits 和 timeouts 会 warning 但不会 abort;non-interactive mode 应用 60s timeout。 |
-n, --non-interactive TEXT | Non-interactively 运行单个 task 并退出。除非设置 --shell-allow-list,否则 shell 被禁用 |
--max-turns N | 在 non-interactive mode 中限制 agentic turns。超过时以 code 124 退出。需要 -n 或 piped stdin。请参阅 Cap turn count with --max-turns |
--timeout SECONDS | Non-interactive mode 的 hard wall-clock timeout。超过时以 code 124 退出。需要 -n 或 piped stdin。请参阅 Cap wall-clock time with --timeout |
-q, --quiet | 适合 piping 的 clean output,只有 agent response 会进入 stdout。需要 -n 或 piped stdin |
--no-stream | Buffer full response,并一次性写入 stdout,而不是 streaming。需要 -n 或 piped stdin |
--stdin | 显式从 stdin 读取 input,而不是 auto-detection。当 stdin 不可用或为 TTY 时清晰报错 |
-y, --auto-approve | 无提示 auto-approve 所有 tool calls(禁用 human-in-the-loop)。Interactive session 中可用 Shift+Tab 切换 |
-S, --shell-allow-list LIST | Comma-separated shell commands,用于 auto-approve;'recommended' 表示 safe defaults,'all' 表示允许任何 command。适用于 -n 和 interactive modes |
--json | 从 management subcommands(agents、threads、skills、update)发出 machine-readable JSON。Output envelope:{"schema_version": 1, "command": "...", "data": ...} |
--sandbox TYPE | 用于 code execution 的 remote sandbox:none(default)、langsmith、agentcore、modal、daytona、runloop。LangSmith 已包含;AgentCore/Modal/Daytona/Runloop 需要 extras |
--sandbox-id ID | 复用现有 sandbox(跳过 creation 和 cleanup) |
--sandbox-snapshot-name NAME | 要使用或创建的 sandbox snapshot name(仅 LangSmith) |
--sandbox-setup PATH | Sandbox 创建后要在其中运行的 setup script path |
--mcp-config PATH | 添加 explicit MCP config 作为 highest-precedence source(与 auto-discovered configs merge) |
--no-mcp | 禁用所有 MCP tool loading |
--trust-project-mcp | Trust 带 stdio servers 的 project-level MCP configs(跳过 approval prompt) |
--interpreter | 在 main agent 上启用 JS interpreter(js_eval)middleware。仅 local mode;需要 quickjs optional extra |
--interpreter-tools VALUE | js_eval 的 PTC allowlist:safe、all 或 comma-separated tool names。Default:无 PTC(pure REPL) |
--profile-override JSON | 将 model profile fields 作为 JSON string 覆盖(例如 '{"max_input_tokens": 4096}')。Merge 到 config file profile overrides 之上 |
--acp | 作为 ACP server 通过 stdio 运行,而不是启动 interactive UI |
--update | 检查并安装 updates,然后退出 |
--auto-update | Toggle automatic updates on or off,然后退出 |
-v, --version | 显示 version |
-h, --help | 显示 help |
CLI commands
CLI commands
| Command | Description |
|---|---|
dcode help | Show help |
dcode agents list | List all agents (alias: ls) |
dcode agents reset --agent NAME | Clear agent memory and reset to default. Supports --dry-run |
dcode agents reset --agent NAME --target SOURCE | Copy memory from another agent |
dcode update | Check for and install Deep Agents Code updates |
dcode skills list [--project] | List all skills (alias: ls) |
dcode skills create NAME [--project] | Create a new skill with template SKILL.md. Idempotent—re-creating an existing skill prints an informational message instead of an error |
dcode skills info NAME [--project] | Show detailed information about a skill |
dcode skills delete NAME [--project] [-f] | Delete a skill and its contents. Supports --dry-run |
dcode threads list [--agent NAME] [--limit N] | List sessions (alias: ls). Default limit: 20. -n is a short flag for --limit. Additional flags: --sort {created,updated}, --branch TEXT (filter by git branch), --cwd [PATH] (filter by working directory; bare flag uses current directory), -v/--verbose (show all columns including branch, created time, and initial prompt), -r/--relative (relative timestamps) |
dcode threads delete ID | Delete a session. Supports --dry-run |
dcode mcp login NAME [--mcp-config PATH] | Run the OAuth login flow for an MCP server marked auth: "oauth". See MCP tools |
dcode mcp config | Show MCP config discovery paths |
--json 以输出 machine-readable output。详情请参阅 command-line options。Destructive commands(agents reset、skills delete、threads delete)支持 --dry-run,可在不做更改的情况下 preview 将发生什么。在 JSON mode 中,--dry-run 会返回相同 envelope,并带有 dry_run: true field。Configuration
完整 reference,包括config.toml schema、provider parameters、profile overrides 和 hook configuration,请参阅 Configuration。
Deep Agents Code 将所有 configuration 存储在 ~/.deepagents/ 下。在该 directory 中,每个 agent 都有自己的 subdirectory(default:agent):
| Path | Purpose |
|---|---|
~/.deepagents/config.toml | Model 和 agent defaults、provider settings、constructor params、profile overrides、themes、update settings |
~/.deepagents/.env | Global API keys 和 secrets。请参阅 configuration |
~/.deepagents/hooks.json | Lifecycle event hooks(session start/end、task complete 等) |
~/.deepagents/<agent_name>/ | Per-agent memory、skills 和 conversation threads |
.deepagents/(project root) | Project-specific memory 和 skills,在 git repo 内运行时加载 |
Interactive mode
像在 chat interface 中一样自然输入。 Agent 会使用其 built-in tools、skills 和 memory 来帮助你完成 tasks。Slash commands
Slash commands
在 Deep Agents Code session 中使用这些 commands:
/model:切换 models 或打开 interactive model selector。/agents:在不重新启动的情况下 hot-swap pre-configured agents。详情请参阅 Command reference/auth:管理 model providers 已存储的 API keys。详情请参阅 Provider credentials/remember [context]:Review conversation 并更新 memory 和 skills。可选传入 additional context/skill:<name> [args]:按 name 直接调用 skill。Skill 的SKILL.mdinstructions 会与提供的 arguments 一起注入 prompt/skill-creator [task]:用于创建有效 agent skills 的 guide/offload(alias/compact):通过将 messages offload 到 storage,并用 summary placeholder 替代,释放 context window space。如有需要,agent 可从 offloaded file 检索完整 history/tokens:显示当前 context window token usage breakdown/clear:清除 conversation history 并开始新 thread/copy:将最新 assistant message 复制到 clipboard/threads:浏览并 resume 之前的 conversation threads/mcp [login <server> | reconnect]:显示 active MCP servers 和 tools。login <server>会为 server 运行 OAuth flow;reconnect加载 deferred logins/notifications:配置 startup warning preferences/reload:重新读取.envfiles、刷新 configuration,并在不重启的情况下重新发现 skills。Conversation state 会保留。Override behavior 请参阅DEEPAGENTS_CODE_prefix/theme:打开 interactive theme selector 以切换 color themes。可使用 built-in themes,以及任何 user-defined themes/update:Inline 检查并安装 Deep Agents Code updates。检测 install method(uv、Homebrew、pip),并运行相应 upgrade command/auto-update:Toggle automatic updates on or off/trace:在 LangSmith 中打开当前 thread(需要LANGSMITH_API_KEY)/editor:在 external editor($VISUAL/$EDITOR)中打开当前 prompt。请参阅 External editor/changelog:在 browser 中打开 Deep Agents Code changelog/docs:在 browser 中打开 documentation/feedback:打开 GitHub issues page 以提交 bug report 或 feature request/version:显示已安装的deepagents-code和 SDK versions/help:显示 help 和 available commands/quit:退出 application
Shell commands
Shell commands
输入
! 进入 shell mode,然后输入 command。Keyboard shortcuts
Keyboard shortcuts
General
Prompt 中的 text editingChat input 使用标准 readline-style bindings:
| Shortcut | Action |
|---|---|
Enter | Submit prompt |
Shift+Enter, Ctrl+J, Alt+Enter, or Ctrl+Enter | Insert newline |
@filename | Auto-complete files and inject content |
Shift+Tab or Ctrl+T | Toggle auto-approve |
Ctrl+X | Open prompt in external editor |
Ctrl+N | Review pending notifications |
Ctrl+O | Expand/collapse the most recent tool output |
Escape | Interrupt current operation |
Ctrl+C | Interrupt or quit |
Ctrl+D | Exit |
| Shortcut | Action |
|---|---|
Ctrl+A or Home | Move cursor to start of line |
Ctrl+E or End | Move cursor to end of line |
Ctrl+U | Delete from cursor to start of line |
Ctrl+K | Delete from cursor to end of line |
Ctrl+W or Ctrl+Backspace | Delete word to the left |
Ctrl+Left / Ctrl+Right | Move cursor one word left/right |
macOS
Cmd+Left / Cmd+Right / Cmd+DeleteTerminal emulators 会在 Cmd-modified keys 到达运行中的 application 之前拦截它们,因此 Deep Agents Code 永远不会直接收到这些按键。相反,terminal 会将它们转换为上面的 readline shortcuts。- Ghostty: 开箱可用。
Cmd+Left、Cmd+Right和Cmd+Delete默认会转换为Ctrl+A、Ctrl+E和Ctrl+U。 - iTerm2: 默认未绑定。请在 Settings → Profiles → Keys → Key Mappings 下将以下内容添加为
Send Text with vim special chars:Cmd+Left→\x01(Ctrl+A)Cmd+Right→\x05(Ctrl+E)Cmd+Delete→\x15(Ctrl+U)
- Terminal.app: 没有用于此 remap 的 native UI。请直接使用基于
Ctrl的 shortcuts。
Option+Left / Option+Right)以相同方式处理:terminals 发送 Esc+b / Esc+f,Deep Agents Code 将其解释为 word-left/right。Non-interactive mode 和 piping
使用-n 可在不启动 interactive UI 的情况下运行单个 task:
-n 或 -m 组合使用时,piped content 会先出现,然后才是你传给 flag 的 text。
最大 piped input size 为 10 MiB。
-S/--shell-allow-list 启用特定 commands(例如 -S "pytest,git,make"),使用 recommended 启用 safe defaults,或使用 all 允许任何 command。
Cap turn count
Cap turn count
CI/CD pipelines 中 long-running 或 misbehaving agents 可能无限 loop。
--max-turns N 让 operators 无需接触 SDK internals 即可设置 hard upper bound:N 必须是 positive integer,并会覆盖用于限制 runaway loops 的 internal safety default。超过 budget 时以 code 124(与 GNU timeout 匹配)退出,因此 CI 可以区分 budget hit 和 generic failure。需要 -n 或 piped stdin;否则以 code 2 退出。若要使用 time-based limit 替代(或补充)turn-count limit,请参阅 Cap wall-clock time with --timeout。Cap wall-clock time
Cap wall-clock time
--timeout SECONDS 会对 non-interactive run 强制执行 hard wall-clock limit。它用 time-based budget 补充 --max-turns(turn count),先命中的 limit 会 cancel agent。--max-turns 使用相同 code,因此 CI 可以统一处理两种 budget hits。需要 -n 或 piped stdin;否则以 code 2 退出。Clean output and buffering
Clean output and buffering
使用 在 non-interactive mode 中,agent 会被指示做出合理假设并自主推进,而不是提出 clarifying questions。它还会优先使用 non-interactive command variants(例如
-q 获得适合 pipe 到其他 commands 的 clean output,使用 --no-stream 在写入 stdout 前 buffer full response(而不是 streaming):npm init -y、apt-get install -y)。Shell execution examples
Shell execution examples
使用 LangSmith trace
启用 LangSmith tracing,即可在 LangSmith project 中查看 agent operations、tool calls 和 decisions。 将 tracing keys 添加到~/.deepagents/.env,即可在每个 session 中启用 tracing,而无需 per-shell exports:
~/.deepagents/.env
.env。完整 loading order 请参阅 environment variables。
如果你愿意,也可以将这些设置为 shell environment variables。Shell exports 始终优先于 .env values,因此这是 temporary overrides 或 testing 的好选择:
Separate agent traces from app traces
Separate agent traces from app traces
当从 LangChain application 以编程方式调用 Deep Agents Code(例如作为 non-interactive mode 中的 subprocess)时,你的 app 和 Deep Agents Code 都会生成 LangSmith traces。默认情况下,这些 traces 都会进入同一个 project。若要将 Deep Agents Code traces 发送到 dedicated project,请设置 然后为 parent application traces 配置 这会保持 app-level observability 清爽,同时仍然在独立 project 中捕获 agent internal execution。你也可以使用
DEEPAGENTS_CODE_LANGSMITH_PROJECT:~/.deepagents/.env
LANGSMITH_PROJECT:~/.deepagents/.env
DEEPAGENTS_CODE_ prefix 将 LangSmith credentials 的作用域限定到 Deep Agents Code(例如 DEEPAGENTS_CODE_LANGSMITH_API_KEY)。/trace 打印 URL 并在 browser 中打开。
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

