Files
deepseek-harness/docs/user/guide/quickstart.zh.md
T

2.0 KiB

快速开始

English | 中文

本指南带你在 5 分钟内跑起一个 Agent。

环境准备

  • Node.js ^22.19 或 >= 24
  • pnpm 11(建议通过 Corepack 使用仓库固定的版本)
# Check versions
node -v   # v22.19.x, or v24.x and newer
corepack enable
pnpm -v   # 11.x

第一步:运行 echo-agent

echo-agent 不需要 API key,装好依赖就能跑。

# Clone the repository
git clone https://github.com/deepseek-harness/deepseek-harness.git
cd deepseek-harness

# Install dependencies
pnpm install

# Start echo-agent
pnpm run demo:echo

启动后你会看到:

echo-agent ready. Type a message ("echo <text>" triggers the tool).
>

试着输入:

> echo hello world

你会看到模型发起了一次 tool call(工具调用),echo 工具将文本转为大写并返回:

[tool call] echo({"text":"hello world"})
[tool result] ECHO: HELLO WORLD

恭喜!环境没问题。

第二步:使用真实模型调用

接下来接入真实的 DeepSeek 模型,跑一个完整的命令行 Agent。

获取 API Key

前往 DeepSeek Platform 获取你的 API key。

配置环境变量

在仓库根目录创建 .env 文件(已被 gitignore):

DEEPSEEK_API_KEY=sk-your-key-here

启动 coding-agent

pnpm run demo:repl
agent REPL ready. Give it a coding task.
>

这就是一个完整的编程助手,它能读写文件、跑命令、拆分子任务。

试着给它一个任务:

> Create hello.js in the current directory, print "Hello from Harness!", and run it

回头看

echo-agent 和 coding-agent 用的是同一个应用框架(@deepseek-ai/dsh-stdio-agent),区别只在 cordis.yml——换了哪些插件、填了什么配置。你以后定制自己的 Agent 也是同样的方式。

下一步