不只是又一个 Agent 框架:DeepSeek Harness 如何重新定义“可组合”

目录

    • 引言
    • [一、DeepSeek Harness 是什么](#一、DeepSeek Harness 是什么)
      • [1.1 核心定位](#1.1 核心定位)
      • [1.2 核心设计理念:一切皆插件](#1.2 核心设计理念:一切皆插件)
      • [1.3 四种预设运行模式](#1.3 四种预设运行模式)
    • [二、DeepSeek Harness 的原理](#二、DeepSeek Harness 的原理)
      • [2.1 Cordis 元框架](#2.1 Cordis 元框架)
      • [2.2 架构分层](#2.2 架构分层)
      • [2.3 核心代码展示](#2.3 核心代码展示)
        • [2.3.1 最小插件结构](#2.3.1 最小插件结构)
        • [2.3.2 带日志输出的插件](#2.3.2 带日志输出的插件)
        • [2.3.3 带自动清理的插件](#2.3.3 带自动清理的插件)
        • [2.3.4 声明依赖的插件](#2.3.4 声明依赖的插件)
        • [2.3.5 插件的对象形式](#2.3.5 插件的对象形式)
        • [2.3.6 插件的类形式(即服务提供者)](#2.3.6 插件的类形式(即服务提供者))
        • [2.3.7 服务的提供与消费](#2.3.7 服务的提供与消费)
        • [2.3.8 插件配置(Schema 验证)](#2.3.8 插件配置(Schema 验证))
        • [2.3.9 服务隔离(Service Isolation)](#2.3.9 服务隔离(Service Isolation))
        • [2.3.10 插件的完整生命周期](#2.3.10 插件的完整生命周期)
    • [三、DeepSeek Harness 的使用方法](#三、DeepSeek Harness 的使用方法)
      • [3.1 快速启动](#3.1 快速启动)
      • [3.2 Python SDK 使用](#3.2 Python SDK 使用)
        • [3.2.1 安装 SDK](#3.2.1 安装 SDK)
        • [3.2.2 设置环境变量](#3.2.2 设置环境变量)
        • [3.2.3 运行内置示例](#3.2.3 运行内置示例)
        • [3.2.4 在自己的程序中使用 SDK](#3.2.4 在自己的程序中使用 SDK)
        • [3.2.5 复用会话](#3.2.5 复用会话)
      • [3.3 插件开发与加载](#3.3 插件开发与加载)
        • [3.3.1 创建插件文件](#3.3.1 创建插件文件)
        • [3.3.2 在 cordis.yml 中配置插件参数](#3.3.2 在 cordis.yml 中配置插件参数)
        • [3.3.3 加载多个插件](#3.3.3 加载多个插件)
        • [3.3.4 使用覆盖层启动](#3.3.4 使用覆盖层启动)
        • [3.3.5 创建带工具(Tool)的插件------完整版](#3.3.5 创建带工具(Tool)的插件——完整版)
        • [3.3.6 使用 ctx.effect() 管理外部资源(HTTP 服务器示例)](#3.3.6 使用 ctx.effect() 管理外部资源(HTTP 服务器示例))
        • [3.3.7 监听会话事件](#3.3.7 监听会话事件)
        • [3.3.8 使用 Markdown 技能(Skill)](#3.3.8 使用 Markdown 技能(Skill))
        • [3.3.9 查看当前配置树](#3.3.9 查看当前配置树)
        • [3.3.10 插件管理命令](#3.3.10 插件管理命令)
        • [3.3.11 npm 包形式的插件结构](#3.3.11 npm 包形式的插件结构)
    • [四、DeepSeek Harness 与 Harness Engineering 的区别](#四、DeepSeek Harness 与 Harness Engineering 的区别)
      • [4.1 概念层面的区别](#4.1 概念层面的区别)
      • [4.2 详细解释](#4.2 详细解释)
      • [4.3 类比理解](#4.3 类比理解)
      • [4.4 行业背景](#4.4 行业背景)
    • [五、DeepSeek Harness 与 deepagents 的区别](#五、DeepSeek Harness 与 deepagents 的区别)
      • [5.1 deepagents 是什么](#5.1 deepagents 是什么)
      • [5.2 核心特性对比](#5.2 核心特性对比)
      • [5.3 架构哲学的本质差异](#5.3 架构哲学的本质差异)
      • [5.4 使用方式的差异](#5.4 使用方式的差异)
      • [5.5 应用场景对比](#5.5 应用场景对比)
      • [5.6 性能与成本对比](#5.6 性能与成本对比)
      • [5.7 deepagents 总结](#5.7 deepagents 总结)
    • 六、总结

引言

Agent 下半场拼什么?DeepSeek 用"一切皆插件"给出了答案。

从去年起小马就开始研究Harness Engineering的工程实践和方法论沉淀,也是小有见解,可以参看小马之前的文章系列《Harness Engineering 落地实践方法论》,再到后续的Loop Engineering、Graph Engineering,似乎也玩得不亦乐乎。这两天DeepSeek 把之前计划研究的DeepSeek Harness 正式发布开源了,这就更好玩了,他这个起名多少有点蹭Harness热度的嫌疑,但咱们没有证据。很多人建议换个名字,哈哈哈。

那我们回来说说,DeepSeek Harness、Harness Engineering的区别,他们是一个东西吗?以及像deepagents这样的框架与DeepSeek Harness的区别又是什么?很多人甚至说,DeepSeek Harness‌主要内部对标的是 Anthropic 的 Claude Code‌,而非 OpenAI 的 Codex;但在产品定位上同时覆盖两者赛道。‌‌

乘着DeepSeek Harness 还热乎,小马也想和大家一起来简单探讨一下。

一、DeepSeek Harness 是什么

1.1 核心定位

DeepSeek Harness(简称 dsh)是 DeepSeek 于 2026年8月13日推出的开源 Agent 框架,以 MIT 协议在 GitHub 上开源。官方用一句简洁的公式概括其定位:

Agent = Model + Harness

如果把 DeepSeek 的模型比作大脑,Harness 就是它的身体和工作台------让模型能够使用工具、执行任务、与开发者协作的整套基础设施。它不是一个新的基础模型或 API 客户端,而是负责把模型接入文件系统、终端、网页、代码工具和其他 Agent,并组织上下文、工具调用和任务执行的一整套 Agent 运行框架。

1.2 核心设计理念:一切皆插件

DeepSeek Harness 最核心的设计理念是 "一切皆插件"(Everything is a Plugin)。模型、工具、技能、会话、沙箱、存储、循环、调度、UI 等所有 Agent 能力,都由插件组合而成,可自由替换、灵活重组。

开发者无需修改源码即可在配置层面自由拼装。正如官方文档所言:产品的每一部分都是插件,包括模型适配器、工具注册表、会话日志,以及 agent loop(智能体循环)本身,因此每一部分都可以从配置替换。

项目主页:https://deepseek.com/harness/

仓库地址:https://github.com/deepseek-ai/deepseek-harness

1.3 四种预设运行模式

Harness 预置了四种运行模式,每种加载不同的插件集合:

模式 说明
标准模式 搭载全套工具,满足通用开发需求
PTC模式 程序化工具调用,模型生成代码并编排多轮工具链,大幅降低 Token 消耗
极简模式 仅保留 Shell 与文件编辑两大工具,用于最小环境基准测试
创造模式 支持查看运行时状态、内存内调试插件并自定义全新运行模式

二、DeepSeek Harness 的原理

2.1 Cordis 元框架

DeepSeek Harness 基于名为 Cordis 的插件系统构建。Cordis 元框架仅负责插件的加载、卸载与依赖关系管理,Agent Harness 的所有具体组件均以独立插件形式存在,通过 Cordis 服务与事件彼此协作。

Cordis 的两个核心特性:

  • 时间可组合性(Temporal Composability) :一个插件卸载后,它之前产生的副作用能够被完整撤销
  • 空间可组合性(Spatial Composability) :一个插件如果依赖其他插件,当其他插件出现、消失或改变时,它能动态地重新处理自己的依赖

2.2 架构分层

dsh 的架构由以下几个核心层次构成:

  1. Cordis 内核:插件的加载、卸载与依赖管理
  2. Profile 与组合包:运行中的 dsh 是一棵插件树,由启动时按序叠加的各层组合而成
  3. 仅追加的 SessionEvent 日志 :模型看到的历史不是单独存的,而是用 deriveMessages() 从事件日志投影出来的
  4. Turn / Step 轮次step = 一次模型请求 + 它触发的工具调用;turn = 零或多个 step
  5. 能力 Seam:一个可替换能力 = interface + implementation + consumer 三角色

2.3 核心代码展示

2.3.1 最小插件结构

在 Harness 中,插件是一个导出 apply 函数的 TypeScript 模块。框架在加载时调用 apply,传入一个 ctx(上下文对象),通过 ctx 注册能力:

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export const name = 'my-plugin'

export function apply(ctx: Context) {
    // Register capabilities here.
}
2.3.2 带日志输出的插件
typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export const name = 'hello-plugin'

export function apply(ctx: Context) {
    // Required dependencies are ready before apply runs.
    console.log('[hello-plugin] plugin loaded!')
}
2.3.3 带自动清理的插件

通过 ctx.effect() 告诉框架如何清理资源:

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export function apply(ctx: Context) {
    ctx.effect(() => {
        const timer = setInterval(() => {
            console.log('heartbeat')
        }, 5000)

        // The returned function runs when the plugin unloads.
        return () => clearInterval(timer)
    })
}
2.3.4 声明依赖的插件

如果插件需要使用其他服务(如 toolsllm),需要声明 inject

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export const name = 'my-tool-plugin'
export const inject = ['tools']

export function apply(ctx: Context) {
    // ctx.tools is ready here.
    ctx.tools.register(/* ... */)
}
2.3.5 插件的对象形式
typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export default {
    name: 'my-plugin',
    inject: ['tools'],
    apply(ctx: Context) {
        // ...
    },
}
2.3.6 插件的类形式(即服务提供者)
typescript 复制代码
import { Service, type Context } from '@deepseek-ai/cordis'

export default class MyService extends Service {
    static inject = ['tools']

    constructor(ctx: Context) {
        super(ctx, 'myService')
        // ...
    }
}
2.3.7 服务的提供与消费

在 Harness 中,toolsllmagents 都是服务(Service)。插件既可以消费已有服务,也可以提供新服务供其他插件使用:

提供服务------继承 Service 类:

typescript 复制代码
import { Service, type Context } from '@deepseek-ai/cordis'

export default class MetricsService extends Service {
    static inject = ['llm']  // 服务可以依赖其他服务

    constructor(ctx: Context) {
        super(ctx, 'metrics')  // 'metrics' 是服务名称
    }

    // 公开的服务方法
    record(event: string, value: number) {
        console.log(`[Metrics] ${event}: ${value}`)
    }
}

消费服务------通过 inject 声明依赖:

typescript 复制代码
export const inject = ['metrics']

export function apply(ctx: Context) {
    ctx.metrics.record('tool_call', 1)
}

为服务声明 TypeScript 类型:

typescript 复制代码
import { Service, type Context } from '@deepseek-ai/cordis'

declare module '@deepseek-ai/cordis' {
    interface Context {
        metrics: MetricsService
    }
}

export default class MetricsService extends Service {
    constructor(ctx: Context) {
        super(ctx, 'metrics')
    }
    record(event: string, value: number) { /* ... */ }
}

可选依赖(不阻塞加载):

typescript 复制代码
export function apply(ctx: Context) {
    // 使用 ctx.get() 查询可选服务,不阻塞插件加载
    const metrics = ctx.get('metrics')
    metrics?.record('plugin_loaded', 1)
}
2.3.8 插件配置(Schema 验证)

插件可以通过 Schema 定义配置结构,Cordis 在加载时会自动验证并填充默认值:

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'
import Schema from '@deepseek-ai/schemastery'

export const name = 'configurable-plugin'

export const schema = Schema.object({
    greeting: Schema.string().default('Hello').description('Greeting message'),
    timeout: Schema.number().min(1000).max(60000).default(5000),
})

export function apply(ctx: Context, config: typeof schema.infer) {
    console.log(config.greeting)  // 用户配置值或 schema 默认值
}
2.3.9 服务隔离(Service Isolation)

Cordis 支持服务隔离,不同插件组可以看到独立的服务实例:

yaml 复制代码
- id: group-a
  name: '@deepseek-ai/cordis-plugin-group'
  group: true
  isolate:
    shell: true
  config:
    - name: '@deepseek-ai/dsh-bash-local'
      config:
        timeoutMs: 5000
    - name: './src/plugin-a.ts'

- id: group-b
  name: '@deepseek-ai/cordis-plugin-group'
  group: true
  isolate:
    shell: true
  config:
    - name: '@deepseek-ai/dsh-bash-local'
      config:
        timeoutMs: 60000
    - name: './src/plugin-b.ts'

plugin-aplugin-b 各自看到独立的 Bash 实例,互不影响。

2.3.10 插件的完整生命周期

以下是一个包含依赖声明、配置、资源清理的完整插件:

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'
import Schema from '@deepseek-ai/schemastery'

export const name = 'lifecycle-demo'
export const inject = ['tools', 'llm']
export const schema = Schema.object({
    interval: Schema.number().default(10000),
})

export function apply(ctx: Context, config: typeof schema.infer) {
    console.log('[lifecycle-demo] plugin loading...')

    // 注册工具
    ctx.tools.register(/* ... */)

    // 注册事件监听(自动清理)
    ctx.on('session/start', () => {
        console.log('Session started')
    })

    // 需要手动清理的资源使用 ctx.effect()
    ctx.effect(() => {
        const timer = setInterval(() => {
            console.log('[lifecycle-demo] heartbeat')
        }, config.interval)

        // 插件卸载时自动执行清理
        return () => clearInterval(timer)
    })

    console.log('[lifecycle-demo] plugin loaded!')
}

三、DeepSeek Harness 的使用方法

3.1 快速启动

方式一:通过 npm 一键启动(推荐)

安装 Node.js 后,直接运行:

bash 复制代码
npx @deepseek-ai/dsh web

默认在 http://127.0.0.1:3080 启动 Web UI。

方式二:从源码运行
bash 复制代码
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
pnpm install
pnpm run build
pnpm dsh web

3.2 Python SDK 使用

3.2.1 安装 SDK
bash 复制代码
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
python -m venv .venv
. .venv/bin/activate
python -m pip install deepseek-harness-sdk
3.2.2 设置环境变量
bash 复制代码
export DEEPSEEK_API_KEY=sk-your-key-here
export DEEPSEEK_BASE_URL=http://127.0.0.1:8000/v1
export DSH_MODEL=deepseek-v4-flash
export DSH_SYSTEM_PROMPT='You are a helpful software engineer assistant.'
3.2.3 运行内置示例
bash 复制代码
python examples/jsonrpc-agent/minimal.py \
    --workspace /absolute/path/to/workspace \
    --session-root /absolute/path/to/sessions \
    --session-id example-001 \
    "Inspect the repository and fix the failing tests."
3.2.4 在自己的程序中使用 SDK
python 复制代码
from pathlib import Path
from deepseek_harness import DeepSeekHarness

config = Path("examples/jsonrpc-agent/minimal.cordis.yml").resolve()
workspace = Path("/absolute/path/to/workspace").resolve()
sessions = Path("/absolute/path/to/sessions").resolve()

with DeepSeekHarness(
    provider="deepseek-official",
    model="deepseek-v4-flash",
    max_tokens=49_152,
    cwd=str(workspace),
    session_root=str(sessions),
    cordis=str(config),
) as harness:
    result = harness.run(
        "Inspect the repository and fix the failing tests.",
        session_id="example-001",
    )
    print(result.final_response)

注意DeepSeekHarness 会延迟启动内置运行时,并持续复用,直至退出上下文管理器。

3.2.5 复用会话

复用同一个 harnesssession id 会保留该会话拥有的 Bash 进程,包括工作目录、已导出的变量与 shell 函数:

python 复制代码
from pathlib import Path
from deepseek_harness import DeepSeekHarness

config = Path("examples/jsonrpc-agent/minimal.cordis.yml").resolve()
workspace = Path("/absolute/path/to/workspace").resolve()
sessions = Path("/absolute/path/to/sessions").resolve()

with DeepSeekHarness(
    provider="deepseek-official",
    model="deepseek-v4-flash",
    max_tokens=49_152,
    cwd=str(workspace),
    session_root=str(sessions),
    cordis=str(config),
) as harness:
    # 第一次调用
    result1 = harness.run(
        "List all Python files in the workspace.",
        session_id="example-001",
    )
    print(result1.final_response)

    # 第二次调用------复用同一会话,保留上下文
    result2 = harness.run(
        "Now run the tests on those files.",
        session_id="example-001",  # 同一个 session id
    )
    print(result2.final_response)

独立任务应使用新的 session id;只有需要延续同一段持久化对话时,才复用原有 id。

3.3 插件开发与加载

3.3.1 创建插件文件

创建 scratch-plugin/src/my-plugin.ts

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export const name = 'hello-plugin'

export function apply(ctx: Context) {
    console.log('[hello-plugin] plugin loaded!')
}
3.3.2 在 cordis.yml 中配置插件参数
yaml 复制代码
- insert:
    - id: greet-tool
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/greet-tool.ts'
      config:
        greeting: '你好,{name}!'
        timeout: 3000
3.3.3 加载多个插件
yaml 复制代码
- insert:
    - id: hello
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/hello.ts'
    - id: greet-tool
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/greet-tool.ts'
      config:
        greeting: 'Hello, {name}!'
    - id: metrics
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/metrics.ts'
3.3.4 使用覆盖层启动
bash 复制代码
pnpm dsh web --patch ./scratch-plugin/cordis.yml

加载多个覆盖层(按顺序叠加):

bash 复制代码
pnpm dsh web --patch ./scratch-plugin/cordis.yml --patch ./another-plugin/cordis.yml
3.3.5 创建带工具(Tool)的插件------完整版

这是一个从文件读取内容的工具,展示了完整的参数定义、输出渲染和执行逻辑:

typescript 复制代码
import { readFile } from 'node:fs/promises'
import type { Context } from '@deepseek-ai/cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'

export const name = 'read-file-tool'
export const inject = ['tools']

export function apply(ctx: Context) {
    ctx.tools.register(defineTool({
        name: 'read_file',
        description: 'Read a file from disk.',

        // 参数定义------模型看到的内容
        parameters: {
            path: {
                type: 'string',
                required: true,
                description: 'Absolute path to the file',
            },
            limit: {
                type: 'number',
                description: 'Maximum bytes to read (optional)',
            },
        },

        // 输出定义
        output: {
            schema: { type: 'string' },
            render: (_args, value) => [{ type: 'text', text: value }],
        },

        // 执行逻辑
        async execute(args, exec) {
            // args 根据 schema 自动获得类型:{ path: string; limit?: number }
            // exec.signal 用于取消操作
            return readFile(args.path, {
                encoding: 'utf8',
                signal: exec.signal,
            })
        },
    }))
}
3.3.6 使用 ctx.effect() 管理外部资源(HTTP 服务器示例)
typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'
import { createServer } from 'node:http'

export const name = 'http-server-plugin'

export function apply(ctx: Context) {
    ctx.effect(() => {
        const server = createServer((req, res) => {
            res.writeHead(200)
            res.end('Hello from Harness plugin!')
        })

        server.listen(3000, () => {
            console.log('[http-server] listening on port 3000')
        })

        // 插件卸载时自动关闭服务器
        return () => {
            server.close()
            console.log('[http-server] closed')
        }
    })
}
3.3.7 监听会话事件

通过 ctx.on() 监听 Harness 的内置事件:

typescript 复制代码
import type { Context } from '@deepseek-ai/cordis'

export const name = 'session-logger'

export function apply(ctx: Context) {
    // 监听会话开始事件
    ctx.on('session/start', (session) => {
        console.log(`[session-logger] Session started: ${session.id}`)
    })

    // 监听轮次结束事件
    ctx.on('turn/end', (turn) => {
        console.log(`[session-logger] Turn ended, steps: ${turn.steps.length}`)
        console.log(`  Tokens used: ${turn.tokenUsage?.totalTokens || 0}`)
    })

    // 监听工具调用事件
    ctx.on('tool/call', (toolCall) => {
        console.log(`[session-logger] Tool called: ${toolCall.name}`)
        console.log(`  Args: ${JSON.stringify(toolCall.args)}`)
    })

    // 监听错误事件
    ctx.on('error', (error) => {
        console.error(`[session-logger] Error: ${error.message}`)
    })
}
3.3.8 使用 Markdown 技能(Skill)

除了 TypeScript 插件,Harness 还支持通过 Markdown 文件定义技能(Skill):

markdown 复制代码
---
name: code-review
description: Review code for quality and security issues
---

You are a code review expert. When the user asks you to review code:

1. Read the code files in the workspace
2. Check for:
   - Security vulnerabilities
   - Code style violations
   - Performance issues
   - Potential bugs
3. Provide a structured report with:
   - Summary of findings
   - Severity level for each issue
   - Suggested fixes

Use the following tools as needed:
- `read_file` to examine code
- `grep` to search for patterns
- `bash` to run tests or linters

规则:能用 Markdown 解释清楚的能力,优先走 Markdown 路线

3.3.9 查看当前配置树
bash 复制代码
# 查看 Web profile 的完整配置树
dsh --profile web --dump-config

# 查看特定 profile 的配置
dsh --profile ptc --dump-config

这会打印出当前机器实际启动的配置树,其中任何条目都可以由你自己的 patch 替换。

3.3.10 插件管理命令
bash 复制代码
# 安装插件到 Web profile
dsh plugin --profile web add <包名>

# 卸载插件
dsh plugin --profile web remove <包名>

# 更新所有插件
dsh plugin --profile web update

# 查看已安装插件列表
dsh plugin --profile web list
3.3.11 npm 包形式的插件结构

一个完整的 npm 插件包需要在 package.json 中声明 dsh.bundle.patch

json 复制代码
{
  "name": "@my-org/dsh-my-plugin",
  "version": "1.0.0",
  "main": "lib/index.js",
  "dsh": {
    "bundle": {
      "patch": "./cordis.patch.yml"
    },
    "client": {
      "entry": "./lib/client.js",
      "platform": "web"
    }
  }
}

对应的 cordis.patch.yml

yaml 复制代码
- insert:
    - id: my-plugin
      name: '@my-org/dsh-my-plugin'
      config:
        greeting: 'Hello from npm plugin!'

四、DeepSeek Harness 与 Harness Engineering 的区别

4.1 概念层面的区别

维度 DeepSeek Harness Harness Engineering
本质 一个具体的开源软件产品/框架 一个工程领域/技术方向
范畴 DeepSeek 开发的 Agent 框架代码 为 AI 模型构建整套辅助系统的工程方法论
形态 可下载、可安装、可运行的代码仓库 抽象的能力体系和技术栈
归属 DeepSeek 公司的开源项目 整个 AI 行业的通用概念

4.2 详细解释

DeepSeek Harness 是 DeepSeek 内部专门组建的代码智能体工程团队开发的具体产品,其核心公式是 Model + Harness = Agent。它是一个以 MIT 协议开源的、可下载运行的 Agent 框架。

Harness Engineering(驾驭工程)则是一个更宏观的概念。在人工智能领域,Harness 指"为 AI 模型构建的整套辅助系统"。Harness Engineering 决定了模型能调用哪些工具、能访问哪些资源、信息如何在不同子 Agent 之间流动、何时终止执行等。

简单来说:

  • Harness Engineering 是"造 Harness 的方法论"------它是让模型具备工具调用、上下文管理、任务执行能力的整套工程体系
  • DeepSeek Harness 是 DeepSeek 用这套方法论造出来的"具体产品"

4.3 类比理解

如果把 Harness Engineering 比作汽车工程学 (研究如何设计、制造汽车的理论和方法),那么 DeepSeek Harness 就是一辆具体的车(DeepSeek 造出来的、你可以直接开走的成品)。

你用的 Claude Code、Codex、Workbuddy 这些,本质上都是不同的 Harness 实现。DeepSeek Harness 只是其中的一个------而且是目前唯一一个采用"一切皆插件"架构的、完全开源的具体实现。

4.4 行业背景

进入 2026 年,Harness 成为 AI 圈的热门话题。网易副总裁阮良曾表示,当下 AI 大厂们不只在卷 Skill,更关键的是还在比拼 Harness Engineering 能力。Harness Engineering 最核心的是可信,延展开来可以概括为可预测、可控制、可管理

DeepSeek 正是通过开源 DeepSeek Harness 这个具体产品,将其 Harness Engineering 的能力开放给全球开发者,同时也在持续招聘 Harness 研究员、Harness 工程师和 Harness 产品经理来加强这一领域的布局。

五、DeepSeek Harness 与 deepagents 的区别

5.1 deepagents 是什么

deepagents (全称 Deep Agents)是 LangChain 团队推出的开源 Agent 框架,自称 "The batteries-included agent harness" ------即"开箱即用的 Agent 驾驭工具"。它于 2025 年首次发布,同时提供 Python 和 JavaScript/TypeScript 两个版本。

deepagents 的核心定位是解决传统 Agent"浅层"(shallow)的问题------即模型在长周期、多步骤的复杂任务中缺乏规划和执行能力。受到 Claude Code 等产品的启发,deepagents 通过内置四大机制来克服这一局限:

  1. 规划工具(planning tool) ------ 让 Agent 能够拆解复杂任务
  2. 子 Agent(sub agents) ------ 将任务委派给拥有独立上下文窗口的子 Agent 执行
  3. 文件系统访问(file system) ------ 用于上下文管理和结果持久化
  4. 详细提示词(detailed prompt) ------ 引导模型行为

在 LangChain 的生态体系中,deepagents 处于中间层:LangGraph 是 Agent 运行时(runtime),LangChain 是 Agent 框架(framework),而 deepagents 是 Agent 驾驭工具(harness)。deepagents 本质上是在 LangChain 最小化 Agent 循环之上,打包了一系列上下文管理的最佳实践。

5.2 核心特性对比

维度 DeepSeek Harness deepagents (LangChain)
开发者 DeepSeek LangChain 团队
首次发布 2026年8月13日 2025年(约)
开源协议 MIT MIT
语言支持 TypeScript(插件开发)+ Python SDK Python + JavaScript/TypeScript
核心定位 Agent 能力运行时,"一切皆插件"的操作系统 "开箱即用"的 Agent 驾驭工具
架构基础 Cordis 元框架(插件系统) LangChain + LangGraph
插件化程度 极致:模型、工具、会话、循环、UI 全部是插件,无"核心" 可扩展:可覆盖或替换任何组件,但核心 Agent 循环相对固定
设计哲学 可逆效应 + 反应式余效应(形式化理论支撑) 意见性默认 + 可扩展
内置能力 通过插件组合按需加载 文件系统、子 Agent、上下文管理、Shell、持久化记忆、人机协同、Skills
模型适配 默认支持近 40 种大模型 模型无关,支持任何支持工具调用的 LLM
运行模式 四种预设 Profile(标准/PTC/极简/创造) 单一 Agent 模式,通过配置扩展
典型使用场景 生产环境长期运行的 Agent 系统 快速构建复杂任务的 Agent 应用

5.3 架构哲学的本质差异

两者最根本的差异在于对"核心"的定义不同

deepagents 的架构是典型的"核心 + 扩展"模式:

复制代码
核心(Agent 循环 + 上下文管理 + 执行器)
    └── 外挂扩展:工具、子 Agent、Skills、记忆(可加可改,但核心动不了)

deepagents 虽然宣称"Extend, override, or replace any piece",但其 override 和 replace 的范围是在 LangChain 的 Agent 循环框架内进行的,核心的 Agent 循环逻辑由 LangGraph 运行时支撑,无法被彻底替换。

DeepSeek Harness 的架构则是"无核心"模式:

复制代码
一层 Cordis 运行时(ctx:上下文、事件、生命周期)
    ├── 模型适配器 ← 插件
    ├── 工具注册表 ← 插件
    ├── 会话/存储 ← 插件
    ├── 沙箱/权限 ← 插件
    ├── Agent 循环 ← 插件
    ├── 调度/任务 ← 插件
    ├── UI(web/tui)← 插件
    └── 你写的任何新东西 ← 插件

在 DeepSeek Harness 中,没有"核心" ------甚至连 Agent 循环本身也是一个可以替换的插件。想换 Agent 循环?换插件。想换存储?换插件。想要终端界面?装个 TUI 插件。这背后的理论支撑是 Cordis 论文中定义的时间可组合性 (可逆效应)和空间可组合性(反应式余效应)------插件的可替换、可回滚、可重组是有形式化证明的。

5.4 使用方式的差异

deepagents 的使用方式 ------通过 create_deep_agent 一行代码创建 Agent:

python 复制代码
from deepagents import create_deep_agent

def get_weather(city: str) -> str:
    return f"It's always sunny in {city}!"

agent = create_deep_agent(
    model="openai:gpt-5.5",
    tools=[get_weather],
    system_prompt="You are a helpful assistant",
)

result = agent.invoke({"messages": [{"role": "user", "content": "what is the weather in sf"}]})

deepagents 也提供 CLI 工具 deepagents-cli,是一个类似 Claude Code 的终端编码 Agent。

DeepSeek Harness 的使用方式------通过插件组合和 Profile 配置:

bash 复制代码
# 一键启动 Web UI
npx @deepseek-ai/dsh web

# 或通过 Python SDK
with DeepSeekHarness(
    provider="deepseek-official",
    model="deepseek-v4-flash",
    cordis=str(config),
) as harness:
    result = harness.run("Your task here", session_id="example-001")

两者的核心差异在于:deepagents 提供的是一个开箱即用的 Agent ,你只需要传入模型和工具即可运行;而 DeepSeek Harness 提供的是一个Agent 的操作系统,你需要在配置层面组装自己的 Agent。

5.5 应用场景对比

两者虽然有重叠,但侧重点和核心适用场景有显著区别。

DeepSeek Harness 的应用场景------构建 Agent 的操作系统

DeepSeek Harness 的核心是提供一个高度可定制、可插拔的 Agent 运行环境 。它的目标用户是那些希望从底层构建和掌控自己 Agent 的开发者。其应用场景非常广泛,核心在于"可组装":

  • 通用编程助手:代码编写、仓库分析、Bug 修复等基础功能
  • 全栈应用开发:从零构建完整应用(网页、3D游戏、AI应用)的复杂任务
  • 特定场景定制 :通过安装不同插件快速改造为专用工具
    • 设计交付工具 :安装 DSH-OpenPencil 插件后,可直接在对话中预览设计稿
    • 多模型协同 :通过 dsh-plan-execute 插件,用高性价比模型执行任务,用高性能模型做规划
    • 多模态 Agent :通过 dsh-vision 插件,让纯文本模型也能"看懂"图片
  • 平台/框架开发:其"创造模式"允许开发者在 Harness 之上构建全新的 Agent 预设或模式

DeepSeek Harness 更适合需要深度定制、构建自有 Agent 平台或探索新范式的开发者。

deepagents 的应用场景------复杂长周期任务的专家

deepagents 的目标是让 Agent 能够稳定、可控地处理需要多步推理和协调的复杂任务 。它就像一个"项目经理",擅长将大目标拆解并分配给不同专家(子Agent)。其核心应用场景聚焦于需要长周期、多步骤、高可靠性的任务:

  • 系统性研究:企业尽职调查、深度研究(Deep Research)等,需要从多个维度收集、交叉验证信息并生成报告
  • 复杂软件开发:处理需要长期规划、上下文管理的大型代码库任务
  • RAG 应用:构建高级的检索增强生成系统,利用文件系统和子Agent进行更复杂的索引和问答
  • 多智能体编排:作为"指挥官",将任务分解并委派给多个拥有独立上下文的子Agent执行

deepagents 适合那些任务本身高度复杂、步骤繁多,且对流程可控性要求高的场景。它是在 LangChain 生态内解决长周期任务难题的"官方最佳实践"。

核心区别总结:

维度 DeepSeek Harness deepagents
核心定位 "Agent 的操作系统" "复杂长周期任务的专家"
设计哲学 "一切皆插件",极致的可组装性 "内置最佳实践",开箱即用的解决方案
核心能力 通过插件组合实现任何能力,从UI到核心循环均可替换 内置规划、文件系统、子Agent委托三大机制
典型用例 构建自定义 Agent 平台、开发新工具、快速原型 企业尽调、深度研究、复杂软件开发
目标用户 希望深度掌控和定制的 Harness 工程师、平台开发者 希望快速解决复杂任务的 AI 应用开发者

两者的关系可以类比为:DeepSeek Harness 是一套可以让你自由搭建房屋的"乐高积木" ,而 deepagents 则是其中一款专门用于建造"复杂摩天大楼"的"官方套件"

5.6 性能与成本对比

根据第三方测试机构 Composio 在 2026年8月的对比测试------将同一个 DeepSeek V4-Flash 模型接入八种不同的 Harness,各自完成 30 个真实应用场景(包括 Gmail、Google Calendar、GitHub、Slack)的多步骤任务------结果差异显著:最好的 Harness 通过了 20 个任务,最差的只通过了 14 个;在全部 240 次运行中,仅 129 次成功;30 个任务中只有 6 个被全部八个 Harness 完成。

在成本方面,Claude Code、Codex 和 deepagents 各自完成 16 个任务时,每个成功任务的平均成本分别约为 0.195、0.081 和 0.045 美元------同样的模型,成本差异高达四倍。这一数据说明:不同的 Harness 实现,即便使用完全相同的模型,在任务成功率和执行成本上也可能存在巨大差异。

5.7 deepagents 总结

对比维度 DeepSeek Harness deepagents
一句话概括 Agent 的操作系统,一切皆插件 开箱即用的 Agent 驾驭工具
适合谁 需要深度定制、生产级长期运行的 Agent 系统开发者 希望快速构建复杂任务 Agent 的应用开发者
上手难度 较高(需理解插件系统和 Cordis) 较低(一行代码创建 Agent)
定制深度 极深(可替换任何组件,包括 Agent 循环) 中等(可扩展工具、子 Agent、Skills,但核心循环固定)
理论支撑 Cordis 形式化理论(可逆效应 + 反应式余效应) LangChain/LangGraph 工程实践
典型用户 Harness 工程师、平台开发者 AI 应用开发者、LangChain 生态用户

简单来说:deepagents 是"拿到就能用的 Agent 工具包",DeepSeek Harness 是"你自己造 Agent 的操作系统"。两者都叫"Harness",但一个重在"开箱即用",一个重在"一切可换"------这代表了当前 Agent 框架领域两种截然不同的设计哲学。

六、总结

DeepSeek Harness 是一个基于 Cordis 元框架、以"一切皆插件"为核心设计理念的开源 Agent 框架。它的价值在于:

  1. 极致的可组合性:所有组件都是插件,可以自由替换和重组
  2. 极薄的内核:Cordis 只负责插件的加载、卸载和依赖管理
  3. 四种预设模式:覆盖不同使用场景
  4. 多语言支持:提供 TypeScript 插件开发和 Python SDK 两种使用方式

而 Harness Engineering 则是更宏大的工程领域,DeepSeek Harness 只是这个领域中的一个具体实现------但它的"一切皆插件"架构和开源策略,正在重新定义 Agent 的构建方式。

在与 deepagents 的对比中,DeepSeek Harness 走的是"操作系统"路线,追求极致的可组装性和无核心架构;而 deepagents 走的是"开箱即用"路线,为 LangChain 生态提供处理复杂长周期任务的最佳实践。两者各有侧重,共同丰富了 Agent 框架的生态图谱。

相关推荐
蓝速科技1 小时前
蓝速科技 3D 全息舱 AI 数字人一体机全尺寸选型实测指南
人工智能·科技·3d
lifallen1 小时前
DeepSeek Harness:把 Agent 做成可替换的运行时插件树
人工智能·学习·ai·开源软件·ai编程
刀锋00011 小时前
从0到1手搓生产级 AI Agent:LangGraph 1.2 + LangChain 1.3 保姆级实战(全部代码已跑通)
人工智能·python·langchain·ai agent·langgraph
水如烟1 小时前
孤能子视角:因果论——方向、锁定与必然感:关系场中归因链的生成语法
人工智能
老兵发新帖1 小时前
OSD和视频流接口随机出现net::ERR_CONNECTION_RESET问题分析总结
人工智能
海兰1 小时前
【开源工具】BlueKing Lite —— AI 原生的轻量运维平台(二)
运维·人工智能·开源
自学机械人的小白ing2 小时前
深度学习系统学习
人工智能·深度学习·学习
HyperAI超神经2 小时前
128K长上下文+智能体强化训练!LFM2.5-2.6B解锁端侧大模型高效部署;DETR用Transformer斩断NMS与Anchor,重塑目标检测
人工智能·深度学习·目标检测·计算机视觉·数据集·transformer
cyadyx2 小时前
DeepSeek Harness(DSH)
deepseek·harness·dsh