Glean 拾遗
日刊 /2026-11-11 / Router + Worker:把 Agent 做成永远在线的超级智能体

Router + Worker:把 Agent 做成永远在线的超级智能体

原文 x.com 收录 2026-11-11 06:00 阅读 45 min
AI 解读

DeepSeek Harness 团队把计算机系统的经典套路搬进 Agent 架构:Router 层长期在线,只负责人类交互与任务派发,不执行任务;Worker 层上下文隔离、并发跑任务,并直接订阅事件 Thread,后续事件绕过 Router 直通。环境事件以 Trigger 形式驱动,先用代码快路径过滤噪声,再交给模型做语义判断;上下文窗口被当作 cache,用 Inline & Spill 加按 ID 引用图逐跳召回,系统外再挂一个 Watchdog 会话判断 Worker 是否真有进展。合成负载消融实验里,两级架构任务完成 p50 12.4 分钟、p95 15.7 分钟,单会话加 subagent 工具为 20.4/29.5 分钟;去掉 Pass-through 后 Router token 反增 37%。作者也承认负载是合成的、云上 Agent Loop 与端点互信的安全与隐私问题未解。适合做 agent 基础设施与编排的工程师。

原文 45 分钟
原文 x.com ↗
§ 1

By @DeepSeekHarness · 2026-11-01T11:37:54.000Z

The original article is in Chinese. This is a machine translation.

This article discusses architectural ideas. It is not an introduction to existing features of DeepSeek Harness.

作者:@DeepSeekHarness · 2026-11-01T11:37:54.000Z

原文为中文,本文为机器翻译。

本文讨论的是架构设想,并非 DeepSeek Harness 现有功能的介绍。

§ 2

Exploring Super-agent Design: Towards a More Autonomous Agent System

探索 Super-agent 设计:迈向更自主的 agent 系统

§ 3

Over the past year, coding agents and other single-task agents have shown that models can use tools to solve complex problems while needing less and less continuous monitoring and step-by-step intervention from humans. Models have also become better at coordinating multiple agents, which makes it practical to organize and schedule work across sessions. As people take less part in low-level execution, their role is gradually moving up to higher-level decisions and sign-off.

Better models have also enabled new applications. Recently, many personal agents have appeared. They connect directly to everyday messaging, calendar, email, and work platforms, monitor the feeds, and help with tasks. Personal agents are only one application of this always-online, event-driven way of working. This way of working is not specific to personal use and is also valuable in commercial work such as software development.

过去一年,编码 agent 和其他单任务 agent 已经证明,模型可以使用工具解决复杂问题,同时越来越不需要人类持续监控和逐步干预。模型协调多个 agent 的能力也在增强,这使得跨会话组织与调度工作变得可行。随着人越来越少参与底层执行,人的角色正逐渐上移到更高层的决策和签核。

更好的模型也催生了新的应用。最近出现了大量个人 agent,它们直接连接日常通讯、日历、邮件和工作平台,监听信息流并协助完成任务。个人 agent 只是这种常在线、事件驱动工作方式的一种应用。这种方式并不专属于个人用途,在软件开发等商业工作中同样有价值。

§ 4

However, today's mainstream agent designs struggle to support this way of working across many tasks or a whole team. Agents still use a single session as the basic unit of work, and sessions are isolated from one another. A user running several tasks in parallel has to switch between sessions by hand and remember what each one contains. In our experience, a person can usually follow only 3 to 5 active sessions at once. With these designs, a single task is limited by model capability, but multi-tasking is limited by human attention.

Adding CLIs, MCP, or external connectors to an existing local single-session agent lets it receive external messages, but its basic limitations remain. It still runs in one synchronous session that blocks on long operations, contexts from different tasks get mixed together, and everything stops whenever the local device goes offline. Keeping such a setup running takes a lot of manual effort.

然而,当今主流的 agent 设计很难支撑这种跨多任务乃至整个团队的工作方式。Agent 仍以单个会话作为基本工作单元,会话之间彼此隔离。用户并行推进几个任务时,必须手动切换会话,并记住每个会话里有什么。以我们的经验,一个人通常同时只能跟进 3 到 5 个活跃会话。在这种设计下,单个任务受限于模型能力,而多任务受限于人的注意力。

给现有的本地单会话 agent 加上 CLI、MCP 或外部连接器,可以让它接收外部消息,但根本限制仍在。它依然运行在一个同步会话里,遇到长时间操作就会阻塞;不同任务的上下文会混在一起;本地设备一离线,一切都会停止。维持这样的系统运转需要大量人工投入。

§ 5

Getting past these limits means decoupling the agent from any single, manually driven session. Instead, the agent should be one continuous entity that keeps its context across sessions and works on several complex tasks at once, without the tasks interfering with each other. We call this kind of agent and its system architecture a Super-agent.

For example, our internal Super-agent instance, which runs on DeepSeek Harness, can continue the same development task across IM and GitHub. It also monitors feedback in public group chats and, even when no one @-mentions it, finds root causes on its own and opens Pull Requests to fix them:

要突破这些限制,就必须把 agent 与任何单一、手动驱动的会话解耦。Agent 应当是一个连续实体,能够跨会话保留上下文,同时处理多个复杂任务,且任务之间互不干扰。我们把这类 agent 及其系统架构称为 Super-agent。

例如,我们内部运行在 DeepSeek Harness 上的 Super-agent 实例,可以跨 IM 和 GitHub 继续同一个开发任务。它还会监听公开群聊中的反馈;即使没有人 @ 它,它也能自行定位根因并提交 Pull Request 来修复:

§ 6

§ 7

We believe a Super-agent has four basic characteristics:

  • Continuous: Users can interact with it directly where they already work, such as IM chats and GitHub comments, and it always feels like one agent. They never have to wonder whether session X has information Y in its context. For example, if a user asks for Plan A in IM and later switches to Plan B in a GitHub Pull Request comment, the agent understands the change and adjusts what it is doing.

我们认为 Super-agent 有四个基本特征:

  • 持续(Continuous):用户可以直接在自己日常工作的界面中与它交互,比如 IM 聊天和 GitHub 评论,并且始终感觉面对的是同一个 agent。用户不必再去想“X 会话的上下文里到底有没有 Y 信息”。例如,用户在 IM 里要求采用方案 A,后来在 GitHub Pull Request 评论中改为方案 B,agent 能理解这一变化并调整正在做的事。
§ 8
  • Productive: It responds quickly and completes several complex tasks in parallel, each to a high standard. It can take the next instruction before the previous command or task has finished.
  • 高产(Productive):它能快速响应,并行完成多个复杂任务,且每个任务都达到高质量。上一条命令或任务还没结束,它就能接收下一条指令。
§ 9
  • Proactive: It does not wait for step-by-step instructions. It monitors events in its environment, acts on anything worth handling, and stays quiet otherwise.
  • 主动(Proactive):它不等待逐步指令,而是监听环境中的事件,遇到值得处理的事情就行动,否则保持安静。
§ 10
  • Persistent: It is always online, connects directly to the user's real working environments, and recovers automatically from anomalies during long-running operation.
  • 持久(Persistent):它始终在线,直接连接用户真实的工作环境,并在长时间运行中遇到异常时自动恢复。
§ 11

No single ReAct loop can provide all four characteristics at once, so they have to come from the system architecture around it. Similar design constraints tend to produce similar architectures. When the goal is an always-online system that responds to environmental events concurrently, we expect personal agents and agents for commercial work such as software development to end up with similar designs. Building such a system also raises many problems much like those long studied in computer systems, so many classic design ideas from that field apply here too.

Implementations will vary, but we think five modules form the basic framework that supports these characteristics. The two-level architecture (Section 2) provides both continuous interaction and productive concurrency. The event-driven design (Section 3) makes the agent proactive. Full-duplex multi-channel interaction (Section 4) keeps each exchange with users both continuous and productive. Separating compute, state, and environments (Section 5), together with a Watchdog (Section 6), keeps the agent persistently online across devices and lets it recover from anomalies on its own.

The diagram below gives an overview of the Super-agent architecture. The modules labeled [2] through [6] are covered in Sections 2 through 6:

没有任何一个 ReAct 循环能同时提供这四种特征,所以它们必须来自循环外围的系统架构。相似的设计约束往往会催生相似的架构。当目标是构建一个常在线、能并发响应环境事件的系统时,我们认为个人 agent 和软件开发等商业工作中的 agent 最终会走向相似的设计。构建这样的系统还会遇到许多计算机系统领域长期研究过的问题,因此该领域的许多经典设计思想在这里同样适用。

具体实现会有所不同,但我们认为有五个模块构成了支撑这些特征的基本框架。两级架构(第 2 节)同时提供连续交互和高产并发。事件驱动设计(第 3 节)让 agent 变得主动。全双工多通道交互(第 4 节)让每次与用户的交流既连续又高效。将计算、状态和环境分离(第 5 节),再加上 Watchdog(第 6 节),让 agent 能跨设备持续在线并自行从异常中恢复。

下图给出 Super-agent 架构的总览。标为 [2] 到 [6] 的模块分别对应第 2 到第 6 节:

§ 12

§ 13

Supporting both continuous interaction across channels and productive concurrency across tasks forces a fundamental trade-off between continuity and throughput in how the system organizes its sessions.

Routing every event to one session gives the most continuous context, because that session sees everything. But a ReAct loop runs one step at a time, which caps how fast a single session can work: tasks take a long time and throughput stays low. The intermediate details of different tasks also end up interleaved in one context, which degrades the results.

Giving every event its own new session reverses the trade-off. It maximizes concurrent throughput, but when tasks are not fully independent, the lack of a shared global context leaves their results disconnected. Several sessions replying to the user separately also make the interaction confusing.

要同时支持跨通道的连续交互和跨任务的高产并发,系统在组织会话时就不得不在连续性与吞吐之间做根本性取舍。

把所有事件都路由到一个会话,能获得最连续的上下文,因为这个会话能看到一切。但 ReAct 循环一次只走一步,这限制了单个会话的工作速度:任务耗时长,吞吐低。不同任务的中间细节还会交织在同一个上下文里,导致结果变差。

给每个事件都新建一个会话,则把取舍反过来。它能最大化并发吞吐,但当任务并非完全独立时,缺少共享的全局上下文会让各任务的结果彼此割裂。多个会话分别回复用户,也会让交互变得混乱。

§ 14

To get both continuity and throughput, we can split the work between two layers. A long-lived Router layer (Section 2.1) maintains global continuity by handling all human interaction and global coordination, while a context-isolated Worker layer (Section 2.2) runs tasks with high concurrency, as shown below:

要同时获得连续性和吞吐,可以把工作拆到两层。长寿命的 Router 层(第 2.1 节)负责所有人类交互和全局协调,从而维持全局连续性;上下文隔离的 Worker 层(第 2.2 节)则以高并发执行任务,如下图所示:

§ 15

§ 16

With the two-level architecture, the system takes over context management and concurrent execution, so users seldom have to think about sessions and always work with the same Super-agent. Making users manage sessions by hand, then, is largely a design habit carried over from low-level LLM APIs. Sessions should be an implementation detail of the system, not a mental burden on its users.

In existing designs, a session does two jobs: it manages the model's context, and it is the user's unit of project management. Once the product is decoupled from the underlying sessions, project management no longer has to follow session boundaries. What interaction and task management to offer users becomes a separate product question, which we return to later.

The two levels are a logical division of responsibilities. Neither layer has to be implemented as a single session, and each can have its own internal structure. The next two subsections describe the two layers in turn.

在两级架构下,系统接管了上下文管理和并发执行,用户几乎不需要再考虑会话,始终与同一个 Super-agent 打交道。因此,让用户手动管理会话,很大程度上是从底层 LLM API 沿袭下来的设计习惯。会话应当成为系统的实现细节,而不是用户的心理负担。

在现有设计中,会话承担两项职责:管理模型上下文,以及充当用户的项目管理单元。一旦产品与底层会话解耦,项目管理就不必再跟随会话边界。该向用户提供怎样的交互和任务管理,就变成了一个独立的产品问题,我们稍后会回到这一点。

两层只是逻辑上的职责划分。任何一层都不必实现为单个会话,每层都可以有自己的内部结构。接下来两个小节依次介绍这两层。

§ 17

The Router layer is a long-lived global routing layer that receives human interaction from every entry point. All cross-task information and decisions come together there, so it serves as the system's global sequence point, coordination point, and memory. To keep this single global node from becoming a performance bottleneck, the Router layer is designed not to execute tasks itself. It only interacts with humans and dispatches tasks, and it can run without a Bash tool at all.

With one central node dispatching tasks to several execution nodes, this structure looks like a typical Agent Team, but the two focus on different things. An Agent Team usually breaks one complex task into steps and coordinates the roles that work on them. Because those steps tend to be tightly coupled, the Team Lead often has to understand the task in depth, plan subtasks, and coordinate members frequently, which adds up to a heavy reasoning load. In a Super-agent, the Router layer only dispatches tasks and tracks how they relate to each other at a high level. It does not break down individual tasks. Conversely, an Agent Team can also work as a two-level architecture. For that, its prompts must keep the main session from executing tasks itself and limit it to external interaction and to dispatching separate tasks to members, who work on them independently. In our experience, the Router layer's work is often simpler than expected, and a lighter model can usually provide both speed and quality.

Router 层是一个长寿命的全局路由层,接收来自所有入口的人类交互。所有跨任务的信息和决策都在这里汇合,因此它充当系统的全局序列点、协调点和记忆。为了避免这个单一全局节点成为性能瓶颈,Router 层被设计为不自己执行任务。它只与人交互并派发任务,甚至可以完全不配备 Bash 工具。

一个中心节点向多个执行节点派发任务,这种结构看起来像典型的 Agent Team,但两者关注点不同。Agent Team 通常会把一个复杂任务拆成步骤,并协调负责各步骤的角色。由于这些步骤往往紧密耦合,Team Lead 经常需要深入理解任务、规划子任务并频繁协调成员,推理负担很重。在 Super-agent 中,Router 层只负责派发任务,并在高层跟踪任务之间的关系,不拆解单个任务。反过来,Agent Team 也可以采用两级架构。要做到这一点,它的提示必须阻止主会话自己执行任务,只让主会话负责外部交互,并把彼此独立的任务派发给成员,由成员独立完成。以我们的经验,Router 层的工作往往比想象中简单,较轻量的模型通常就能兼顾速度和质量。

§ 18

Internally, the Router layer does not have to be a single session either, and some of its logic may not need an LLM at all. We chose the most direct design, a single long-lived LLM session, and found that it is less likely to become a throughput bottleneck than it might seem. The reason is that environmental events (the Triggers of Section 3) that arrive during one inference turn queue up and are processed together in the next turn. The result is batching, and processing the events together adds little overhead:

  • When external events arrive at a steady rate, Triggers reach the Router Session one at a time, and each response comes back quickly.
  • When events arrive in bursts and start to queue at the Router Session, the Triggers that built up during the previous turn are merged automatically and injected together into the next LLM call. Because the Router Session only does lightweight interaction and dispatch, each step usually has a long input and a short output. Triggers merged into one LLM API call are computed in parallel during Prefill, so the time per request grows much more slowly than the batch size. Up to a point, then, the larger the backlog, the lower the amortized inference time per decision. The limit depends on the context length and on how many Triggers the model can handle accurately in one turn. Section 7.2 quantifies the effect of batching with an experiment. Combined with subscription and pass-through (Section 3.2) and Chain of Recall (Section 3.3), a single long-lived Router Session keeps the context continuous and is already enough for a team of our current size.

If the system grows to the point where one session really cannot keep up, the Router layer can use a multi-stage filtering structure internally, or be split into several sessions by horizontal sharding. Its internal design then comes down to the same trade-off between continuity and throughput. The finer the sharding, the more concurrent throughput the Router layer gets, but the less memory and context the shards share. This trade-off will remain until the global memory problem is solved.

在内部,Router 层也不必是单个会话,其中一些逻辑甚至不需要 LLM。我们选择了最直接的设计——一个长寿命的 LLM 会话——并发现它并没有看起来那么容易成为吞吐瓶颈。原因在于,在一个推理回合中到达的环境事件(第 3 节中的 Trigger)会排队,并在下一回合一起处理。这就形成了批处理,而一起处理这些事件几乎不会增加多少开销:

  • 当外部事件以稳定速率到达时,Trigger 会逐个到达 Router Session,每次响应都能很快返回。
  • 当事件突发到达并在 Router Session 处开始排队时,上一回合期间积累的 Trigger 会被自动合并,并一起注入下一次 LLM 调用。由于 Router Session 只做轻量交互和派发,每一步通常输入长、输出短。合并进同一次 LLM API 调用的 Trigger 会在 Prefill 阶段并行计算,因此单次请求时间的增长远慢于批大小。于是,在一定范围内,积压越多,每次决策分摊的推理时间反而越低。上限取决于上下文长度,以及模型在一回合内能准确处理多少 Trigger。 第 7.2 节用实验量化了批处理的效果。结合订阅直通(第 3.2 节)和 Chain of Recall(第 3.3 节),单个长寿命 Router Session 就能保持上下文连续,已经足够支撑我们当前规模的团队。

如果系统增长到单个会话确实无法支撑,Router 层可以在内部采用多级过滤结构,或者按水平分片拆成多个会话。此时它的内部设计又回到连续性与吞吐之间的同一个取舍。分片越细,Router 层的并发吞吐越高,但分片之间共享的记忆和上下文越少。在全局记忆问题解决之前,这个取舍会一直存在。

§ 19

The Worker layer consists of the sessions that execute tasks. Each Worker has an isolated context and a full set of execution tools, and is dedicated to a single task. Worker Sessions directly determine the result of each task and the quality of its code, so they usually need the most capable models.

Workers never interact with humans directly. Their reasoning process and tool calls stay out of external channels. Instead, each Worker reports its status to the Router layer, which handles all replies to the user. This way, the system keeps both its concurrency and the quality of its output, without the confusion of several sessions replying separately.

When tasks run concurrently, each Worker works on its own task, and peer Workers usually do not need to communicate directly. Conflicts between Workers tend to arise in a shared working environment, such as the same Pull Request. As long as the Workers involved all subscribe to that environment's Thread, they receive the same event notifications (Section 3.2) and have a chance to spot and resolve the conflict on their own. The Router layer relays the few cases that need coordination across tasks.

Like the Router layer, a Worker does not have to be a single session internally. For a complex task, a Worker can create subagents or be an Agent Team itself, and this is transparent to the Router layer above it. The same structure fits code collaboration, where independent tasks such as reproducing issues, reviewing Pull Requests, and developing features can proceed at once without blocking each other. It also fits personal agent scenarios, even though a personal agent usually offers only a single chat page. When a user discusses several topics at once in that chat, the page keeps the conversation continuous. Meanwhile, the backend can dispatch a separate Worker for each topic to work on tasks and draft replies in parallel.

Worker 层由执行任务的会话组成。每个 Worker 都有隔离的上下文和完整的执行工具,并且只专注于一个任务。Worker Session 直接决定每个任务的结果和代码质量,因此通常需要使用能力最强的模型。

Worker 从不直接与人交互。它们的推理过程和工具调用不会进入外部通道。每个 Worker 只向 Router 层报告状态,由 Router 层负责所有面向用户的回复。这样,系统既能保持并发,又能保证输出质量,还不会出现多个会话分别回复造成的混乱。

任务并发运行时,每个 Worker 处理自己的任务,同级 Worker 通常不需要直接通信。Worker 之间的冲突往往出现在共享工作环境中,比如同一个 Pull Request。只要相关 Worker 都订阅了该环境的 Thread,它们就会收到相同的事件通知(第 3.2 节),有机会自行发现并解决冲突。少数需要跨任务协调的情况由 Router 层转达。

和 Router 层一样,Worker 内部也不必是单个会话。对于复杂任务,Worker 可以创建子 agent,或者本身就是一个 Agent Team,而上层 Router 对此无感知。同样的结构也适合代码协作:复现问题、审查 Pull Request、开发功能等独立任务可以同时推进,互不阻塞。它也适合个人 agent 场景,尽管个人 agent 通常只有一个聊天页面。当用户在一个聊天里同时讨论多个话题时,页面保持对话连续;同时,后端可以为每个话题派发独立的 Worker,并行处理任务和起草回复。

§ 20

To make a Super-agent proactive, we first need to change what drives the system. The agent's main input is no longer prompts that a human types into a session one at a time, but semi-structured events from the environment. In a Super-agent, these environmental events, such as group chat messages, emails, calendar reminders, code review comments, and CI results, are called Triggers. Because the agent listens for and responds to Triggers, it no longer has to wait for a human command before each run, as a single-session agent must.

The subsections below follow an environmental event from arrival to processing, in four steps that build on each other. First, two-stage policies that combine code and models filter out the large volume of noise (Section 3.1). Next, the subscription and pass-through mechanism routes events to Workers (Section 3.2). Inline & Spill and Chain of Recall then inject dense context into the model and recall more of it on demand (Section 3.3). Finally, speculative execution lets the agent act ahead in the background based on environmental signals (Section 3.4).

要让 Super-agent 变得主动,首先要改变驱动系统的东西。Agent 的主要输入不再是人类逐条输入会话的提示,而是来自环境的半结构化事件。在 Super-agent 中,这些环境事件被称为 Trigger,例如群聊消息、邮件、日历提醒、代码审查评论和 CI 结果。因为 agent 监听并响应 Trigger,它不再像单会话 agent 那样每次运行前都要等待人类命令。

下面的小节按环境事件从到达至处理的顺序展开,分为四个层层递进的步骤。首先,结合代码和模型的两阶段策略会过滤掉大量噪声(第 3.1 节)。接着,订阅与直通机制把事件路由给 Worker(第 3.2 节)。然后,Inline & Spill 和 Chain of Recall 把高密度上下文注入模型,并按需召回更多内容(第 3.3 节)。最后,投机执行让 agent 根据环境信号在后台提前行动(第 3.4 节)。

§ 21

Once connected to real group chats and code platforms, the system sees a noisy event stream with a low trigger rate: the vast majority of everyday messages need no action from the agent. Having a large model judge every event from scratch would add too much latency and use too much compute. Borrowing the Fast Path / Slow Path idea from computer systems, we treat large-model reasoning as a flexible but expensive Slow Path. Frequent, well-defined, stable judgments can instead become deterministic code, which serves as a low-latency, low-cost Fast Path.

So the system filters every incoming event first. Deterministic policies remove noise before any large model is called, and only candidate events that need semantic understanding go to the model. We use two-stage filtering that combines programmatic policies with a large model:

  • Programmatic policies (Fast Path): Code runs fast admission checks on deterministic conditions such as the event source, the group, and user or bot allowlists. For example, each source can be set to "respond only to explicit requests", "treat as candidate events", or "ignore". These checks drop most irrelevant messages before any model is called.
  • Semantic policies (Slow Path): Candidate events that pass the programmatic checks go to the LLM, which decides whether to act based on the context and on policies written as prompts. The semantic stage also serves as a natural-language extension point, so humans can turn policies on or off, or add new ones, through prompts at any time, as shown below:

一旦接入真实的群聊和代码平台,系统就会面对噪声很大、触发率很低的事件流:绝大多数日常消息都不需要 agent 采取行动。让大模型对每个事件从零判断,延迟和算力开销都太高。借鉴计算机系统中的 Fast Path / Slow Path 思路,我们把大模型推理视为灵活但昂贵的 Slow Path。频繁、定义明确且稳定的判断可以固化成确定性代码,作为低延迟、低成本的 Fast Path。

因此,系统会先过滤每个传入事件。确定性策略在任何大模型调用之前先剔除噪声,只有需要语义理解的候选事件才会进入模型。我们采用结合程序化策略和大模型的两阶段过滤:

  • 程序化策略(Fast Path):代码对事件来源、群组、用户或机器人白名单等确定性条件做快速准入检查。例如,每个来源可以设为“只响应明确请求”“视为候选事件”或“忽略”。这些检查会在调用任何模型之前丢掉大部分无关消息。
  • 语义策略(Slow Path):通过程序化检查的候选事件进入 LLM,由模型根据上下文和以提示形式编写的策略决定是否行动。语义阶段同时也是自然语言扩展点,人们可以随时通过提示开启、关闭或新增策略,如下图所示:
§ 22

§ 23

The global Router layer from Section 2 keeps interaction continuous across channels. But if every follow-up event for an assigned task still had to pass through the Router layer, this single global node would carry a heavy load and slow down responses. So the Fast / Slow Path split also applies to routing filtered events. The Router layer handles only cold starts of new tasks and cross-task coordination, while code sends follow-up events directly to the Worker Session that owns them.

In a real workflow, consecutive events on the same GitHub Pull Request, IM topic, or email chain form an event stream, which we call a Thread:

第 2 节中的全局 Router 层让交互跨通道保持连续。但如果某个已分配任务的每个后续事件仍然要经过 Router 层,这个单一全局节点就会负载过重、响应变慢。因此,Fast / Slow Path 的划分同样适用于过滤后的事件路由。Router 层只处理新任务的冷启动和跨任务协调,后续事件则由代码直接发送给负责它的 Worker Session。

在真实工作流中,同一个 GitHub Pull Request、IM 话题或邮件链上的连续事件会形成一条事件流,我们称之为 Thread:

§ 24

§ 25

When the Router layer creates a Worker Session for the first event in a Thread, that Worker subscribes to the Thread directly. From then on, event routing follows one of the two paths shown below:

  • Subscribed (Fast Path): Code passes follow-up events in the Thread straight through to the subscribed Worker, so the Router layer does not need another tool call to forward them. If a new event falls outside the current task, the Worker can unsubscribe or hand the event back to the Router layer to be dispatched again.
  • Unsubscribed (Slow Path): The Router layer can still see every event, which lets it track global state, but it only evaluates and dispatches new events that have no subscriber yet.

当 Router 层为 Thread 中的第一个事件创建 Worker Session 时,该 Worker 会直接订阅这个 Thread。此后,事件路由走下图两条路径之一:

  • 已订阅(Fast Path):代码把 Thread 中的后续事件直接传给已订阅的 Worker,Router 层无需再发起工具调用转发。如果新事件超出当前任务范围,Worker 可以退订,或把事件交回 Router 层重新派发。
  • 未订阅(Slow Path):Router 层仍能看到每个事件,从而跟踪全局状态,但它只评估和派发还没有订阅者的新事件。
§ 26

Subscriptions between Threads and Workers are many-to-many. A Worker can subscribe to several related Threads, and a Thread can have several subscribed Workers. When Workers overlap in the same working environment or discussion, each new event in the shared Thread passes straight through to all of its subscribers at once. The Workers then have a chance to learn what the others are doing and resolve conflicts themselves, without point-to-point communication. On the output side, Workers still report key conclusions to the Router layer, which handles all replies to the user and keeps global memory in sync.

Thread 与 Worker 之间的订阅是多对多的。一个 Worker 可以订阅多个相关 Thread,一个 Thread 也可以有多个订阅 Worker。当多个 Worker 在同一工作环境或讨论中重叠时,共享 Thread 中的每个新事件都会同时直通所有订阅者。这样 Worker 就有机会了解其他 Worker 在做什么,并自行解决冲突,无需点对点通信。在输出侧,Worker 仍会把关键结论报告给 Router 层,由 Router 层负责所有面向用户的回复,并保持全局记忆同步。

§ 27

After an event has been filtered and routed to its target session, the next question is how much information to put into the model's context window. The input is no longer a limited number of human prompts but semi-structured events that the environment produces continuously, so the design of tool calls and event injection matters more. Inject too much, and the window fills up, diluting the model's attention. Inject too little, and the model has to call tools again and again to read context, which adds execution steps. Wasting the context window is wasting the model's intelligence.

We can therefore treat the limited context window as a cache. In terms borrowed from compiler optimization and computer systems, context injection comes down to two basic operations. Inline puts information likely to be needed soon directly into the current context window, saving extra tool-call round trips. Spill keeps full information outside the window when it exceeds the budget or is rarely used, and leaves only a reference or summary in the window, through which the model can read the full information on demand.

Combined with locality, a classic idea in computer systems design, Inline & Spill can improve event injection and tool calls step by step:

  1. Start with minimal information: At first, give the model only the current object's ID and a summary of its content.
  2. Progressively Inline related information via locality: Inline what the model is likely to need soon. Start with the IDs of closely related objects, then add content that is adjacent in space or time. Examples are the first 50 characters of the content, the IM messages around a message and the one it replies to, and neighboring comments in the same code review discussion.
  3. Spill content over the limit: Set a small length cap for long content that cannot be inlined in full, and Spill the excess outside the window. A simple way to do this is to truncate the content and leave a pointer to where it continues, so the model can call a tool to read the rest when it needs to.

事件经过过滤并路由到目标会话后,下一个问题是往模型上下文窗口里放多少信息。输入不再是有限的人类提示,而是环境持续产生的半结构化事件,因此工具调用和事件注入的设计更加重要。注入太多,窗口会被塞满,稀释模型注意力;注入太少,模型就得反复调用工具读取上下文,增加执行步骤。浪费上下文窗口,就是在浪费模型的智能。

因此,可以把有限的上下文窗口当作缓存。借用编译器优化和计算机系统的术语,上下文注入归结为两个基本操作。Inline 把很可能马上需要的信息直接放进当前上下文窗口,省去额外的工具调用往返。Spill 则在信息超出预算或很少使用时,把完整信息留在窗口外,只在窗口内保留引用或摘要,模型可以按需通过它读取完整信息。

结合计算机系统设计中的经典思想——局部性,Inline & Spill 可以逐步改进事件注入和工具调用:

  1. 从最小信息开始:起初只给模型当前对象的 ID 和内容摘要。
  2. 按局部性逐步 Inline 相关信息:把模型很可能马上需要的内容内联进来。先放紧密相关对象的 ID,再补充空间或时间上相邻的内容。例如内容前 50 个字符、某条消息及其所回复消息前后的 IM 消息,以及同一代码审查讨论中的相邻评论。
  3. 超出限制的内容 Spill:对无法完整内联的长内容设置较小的长度上限,把超出部分外溢到窗口外。简单做法是截断内容并留下指向后续内容的指针,这样模型需要时可以调用工具读取剩余部分。
§ 28

The Router layer has a context problem of its own. Many follow-up events pass straight through to Workers, and past tasks build up over long-running operation, so the Router layer cannot keep every task's full history in its context window. Yet when a user brings up an old task in another channel, the Router layer still has to recover that task's context. Applying Inline & Spill consistently to every kind of object in the system gives an on-demand, multi-hop retrieval mechanism: Chain of Recall. It reduces how much earlier information the Router layer loses over long runs, as shown below:

Router 层也有自己的上下文问题。许多后续事件直通 Worker,过去任务会在长时间运行中不断积累,因此 Router 层无法把每个任务的完整历史都放在上下文窗口里。然而,当用户在另一个通道提起旧任务时,Router 层仍然必须恢复该任务的上下文。把 Inline & Spill 一致地应用到系统中每一种对象上,就得到一种按需、多跳的检索机制:Chain of Recall。它减少了 Router 层在长时间运行中丢失早期信息的程度,如下图所示:

§ 29

§ 30

The system gives objects such as Triggers, Threads, and Worker Sessions unique IDs, and inlines the IDs of closely related objects when it injects one. These IDs link the objects into a reference graph. Each object recalled through a tool call also follows Inline & Spill, so the returned result inlines the summaries and IDs of the next-hop objects. Starting from the current event, the model can then follow these references and recall context hop by hop, as far as it needs.

For example, the model can start from the current message's Thread, follow an inlined ID to a related Worker Session, and then find another code review Thread linked to that Worker.

系统会为 Trigger、Thread、Worker Session 等对象分配唯一 ID,并在注入某个对象时内联紧密相关对象的 ID。这些 ID 把对象连接成一张引用图。通过工具调用召回的每个对象同样遵循 Inline & Spill,因此返回结果会内联下一跳对象的摘要和 ID。从当前事件出发,模型就可以沿着这些引用逐跳召回上下文,需要多远就走多远。

例如,模型可以从当前消息所在的 Thread 出发,沿着内联的 ID 找到相关的 Worker Session,再找到与该 Worker 相连的另一个代码审查 Thread。

§ 31

We also borrow speculative execution from computer systems. Based on environmental signals, the agent starts work in the background before it knows whether the result will be used. It uses extra background compute so that people wait less and need to step in less often. Results that turn out to be useful are delivered, and the rest are discarded.

In personal agent scenarios, when a meeting invitation email or a to-do message arrives, the agent can check for calendar conflicts, gather background information, and draft a reply in the background. The user then only needs to look over the draft and send it. The same approach works for R&D collaboration. In our internal DeepSeek Harness user group, for example, we configured a "silently reproduce and fix" policy. When someone reports an issue or discusses a proposed change, the agent first tries to reproduce the issue and find a fix in the background. It delivers a result only after it has confirmed the issue and found a simple fix. Otherwise, it stays quiet the whole time.

我们还借鉴了计算机系统中的投机执行。Agent 会根据环境信号,在还不知道结果是否会被使用的情况下,先在后台开始工作。它用额外的后台算力减少人的等待和介入次数。最终有用的结果会交付,其余结果则丢弃。

在个人 agent 场景中,当收到会议邀请邮件或待办消息时,agent 可以在后台检查日历冲突、收集背景信息并起草回复。用户只需过目草稿并发送。同样的方法也适用于研发协作。例如,在我们内部的 DeepSeek Harness 用户群里,我们配置了一条“静默复现并修复”策略。当有人报告问题或讨论一个改动提案时,agent 会先在后台尝试复现问题并寻找修复。只有在确认问题并找到简单修复后,它才交付结果;否则全程保持安静。

§ 32

§ 33

The two-level architecture in Section 2 keeps interaction continuous across channels at the level of context. But to make day-to-day interaction both continuous and productive, two more problems need solving: how the interaction works and where it happens. The first is to keep time-consuming background operations from blocking the foreground conversation. An asynchronous ReAct loop solves this, so the session can accept new instructions at any time without waiting for a previous command or task to finish (Section 4.1). The second is to tailor the content and level of detail of the agent's responses to each communication channel and how people communicate there (Section 4.2).

In a classic ReAct loop, when the model makes a synchronous run() tool call, the loop blocks until the tool finishes and returns its final result. Until then, the session cannot respond to anything new from the user. To remove this blocking, the conversation has to move from a turn-based, half-duplex mode to a full-duplex one, as shown below:

第 2 节的两级架构在上下文层面让交互跨通道保持连续。但要让日常交互既连续又高效,还需要解决两个问题:交互如何运作,以及交互发生在哪里。第一,要避免耗时的后台操作阻塞前台对话。异步 ReAct 循环可以解决这一点,让会话随时接收新指令,而不必等待上一条命令或任务完成(第 4.1 节)。第二,要针对每个沟通渠道以及人们在其中的沟通方式,调整 agent 回复的内容和详细程度(第 4.2 节)。

在经典 ReAct 循环中,当模型发起同步的 run() 工具调用时,循环会阻塞,直到工具结束并返回最终结果。在此之前,会话无法响应用户的任何新输入。要消除这种阻塞,对话必须从基于轮次的半双工模式转向全双工模式,如下图所示:

§ 34

§ 35

To do this, we replace time-consuming command and tool calls with asynchronous start() and stop() calls, turning the loop into an asynchronous ReAct loop. A call to start() returns "Started" immediately, and the loop does not wait for the tool. When the tool finishes in the background, the system delivers its final result to the session as a new event message. Based on the context, the model can also call stop() to end a background command that runs too long.

With the foreground conversation decoupled from background tasks, the agent can respond to people while time-consuming tasks run in the background. New input is handled as soon as the current inference step ends, rather than after background tools finish.

DeepSeek Harness already implements this asynchronous task mechanism, but it is not yet enabled by default.

People communicate differently in group chats, email, and GitHub discussions. The agent needs to adjust both the level of detail and the way it responds to suit each channel. Detailed reasoning and tool-call logs may suit a single-user terminal, but posting them unchanged in a group chat can overwhelm participants with information.

In a Super-agent, the two-level architecture already solves part of this problem. Each task's verbose reasoning process and frequent tool calls stay inside its Worker Session and never go straight to an external channel, while the Router layer handles all external interaction. Beyond that, the system needs to connect to the working environments users rely on every day and use prompts to set interaction norms for each channel:

  • IM and other instant messaging channels: Keep communication light and interrupt people as little as possible. Like a human colleague, notify people only when a decision or sign-off is needed, ask only direct questions, and give short conclusions. One simple, effective hard rule we have verified is a cap of 100 words per reply.
  • Asynchronous channels such as GitHub, email, and documents: Deliver structured, information-dense output. For example, when creating or updating a Pull Request, write out the full problem background, the change description, and the verification results according to the project's conventions. In personal agent scenarios, draft structured emails and document summaries directly.

为此,我们把耗时的命令和工具调用替换为异步的 start() 和 stop() 调用,将循环变成异步 ReAct 循环。调用 start() 会立即返回“Started”,循环不再等待工具。工具在后台完成后,系统会把最终结果作为一条新事件消息投递给会话。模型还可以根据上下文调用 stop(),结束运行过久的后台命令。

前台对话与后台任务解耦后,agent 可以在耗时任务于后台运行时继续回应人。新输入会在当前推理步骤结束后立即处理,而不是等后台工具完成。

DeepSeek Harness 已经实现了这套异步任务机制,但尚未默认启用。

人们在群聊、邮件和 GitHub 讨论中的沟通方式不同。Agent 需要调整详细程度和回复方式,以适应每个渠道。详细的推理和工具调用日志可能适合单人终端,但原样发到群聊里会让参与者被信息淹没。

在 Super-agent 中,两级架构已经解决了部分问题。每个任务冗长的推理过程和频繁的工具调用都留在它的 Worker Session 内,不会直接进入外部通道,所有外部交互由 Router 层处理。除此之外,系统还需要连接用户日常依赖的工作环境,并用提示为每个渠道设定交互规范:

  • IM 等即时通讯渠道:保持轻量沟通,尽量少打扰人。像人类同事一样,只在需要决策或签核时通知,只问直接的问题,给出简短结论。我们验证过的一条简单有效的硬规则是:每条回复不超过 100 词。
  • GitHub、邮件、文档等异步渠道:交付结构化、信息密度高的输出。例如,在创建或更新 Pull Request 时,按照项目惯例写清完整的问题背景、改动说明和验证结果。在个人 agent 场景中,直接起草结构化邮件和文档摘要。
§ 36

By default, local agents tie three things to one device: the compute that runs the Agent Loop, the session state that must persist, and the execution environment, such as code repositories and local toolchains. The agent stops whenever the device sleeps or goes offline, and it cannot reach environments on other devices. To keep a Super-agent persistently online and connected to the real working environments its tasks need, we borrow compute-storage separation from computer systems and decouple the three in two steps. First, we separate compute from session state, which frees the agent from the lifecycle of any single machine and keeps it persistently online in the cloud (Section 5.1). Second, we decouple the cloud-hosted Agent Loop from state-heavy execution environments, which can then stay where they are while the agent reaches them across devices (Section 5.2).

The compute that runs the Agent Loop can be stateless, and only the session state has to persist. So the first level of decoupling runs this compute in stateless, elastic cloud containers and keeps sessions and other persistent state in a database. The containers can scale out, restart, or be replaced, while persistent storage preserves the continuity of sessions and tasks. A local device that sleeps or goes offline no longer stops the agent, which stays persistently online in the cloud.

Once the Agent Loop and session state are in the cloud, the next question is how the agent reaches the execution environments its tasks need. Much of the context a model works with comes from tool calls against code repositories, local files, dependent services, and other execution environments. Broadly defined, then, context includes the execution environment itself.

There are two common approaches. The first starts a sandbox in the cloud, pulls the code, and tries to rebuild and sync the environment. But real working environments often include uncommitted local changes, private credentials, dependencies on intranet services, and specific hardware or toolchains. Syncing all of that is expensive, and it is easy to miss something. The second asks users to give up their local environments and move their work to the cloud, a migration that is too costly for many users.

Since the hard part to copy and sync is the environment itself, there is no need to move it to the cloud along with the Agent Loop. The second level of decoupling runs the Agent Loop in the cloud and leaves state-heavy execution environments where they are. Each endpoint needs only a lightweight daemon, which keeps no session state and does nothing but execute commands and return results. The execution environment stays outside the cloud, and the agent reads context from it on demand.

Anthropic's "Decoupling the brain from the hands" takes the same approach: the harness stays stateless, session logs are stored outside it, and execution environments are connected on demand through a unified interface. The difference is the target scenario. Anthropic's article describes a managed service and mainly discusses sandboxes created on demand and resources inside customer VPCs. We first need to connect the personal machines people use every day, which hold uncommitted changes and local credentials and may be online only intermittently. Our design therefore supports BYOM (Bring Your Own Machine), which connects a user's own development machine or personal computer to the cloud agent. It also supports cloud-hosted machines and compute environments created on demand.

As a result, an agent is no longer tied to one machine. It can switch between execution devices, running commands and reading context in whichever environment a task needs. It can even work with devices that are only intermittently online: when a user's personal device reconnects, the cloud agent automatically starts and completes the tasks that need to run on that device. The diagram below shows the resulting structure, with compute, persistent state, and execution environments decoupled at two levels:

默认情况下,本地 agent 把三样东西绑定在一台设备上:运行 Agent Loop 的计算、必须持久化的会话状态,以及执行环境(如代码仓库和本地工具链)。设备一旦休眠或离线,agent 就停止,也无法访问其他设备上的环境。为了让 Super-agent 持续在线并连接任务所需的真实工作环境,我们借鉴计算机系统的计算存储分离,分两步解耦这三者。第一步,把计算与会话状态分离,使 agent 摆脱任何单台机器的生命周期,在云端持续在线(第 5.1 节)。第二步,把云端托管的 Agent Loop 与状态密集的执行环境解耦,让环境留在原地,agent 跨设备访问它们(第 5.2 节)。

运行 Agent Loop 的计算可以无状态,只有会话状态需要持久化。因此,第一层解耦把计算放在无状态、弹性的云容器中,把会话和其他持久状态放在数据库里。容器可以扩容、重启或被替换,持久存储则保留会话和任务的连续性。本地设备休眠或离线不再导致 agent 停止,agent 会在云端持续在线。

一旦 Agent Loop 和会话状态进入云端,下一个问题是 agent 如何访问任务所需的执行环境。模型使用的许多上下文来自对代码仓库、本地文件、依赖服务和其他执行环境的工具调用。广义上说,上下文也包括执行环境本身。

常见做法有两种。第一种是在云端启动沙箱,拉取代码,并尝试重建和同步环境。但真实工作环境往往包含未提交的本地改动、私有凭证、对内部服务的依赖,以及特定硬件或工具链。全部同步代价很高,还容易漏掉东西。第二种做法要求用户放弃本地环境,把工作迁移到云端,这对许多用户来说成本太高。

既然难复制、难同步的正是环境本身,就没必要把它和 Agent Loop 一起搬到云端。第二层解耦让 Agent Loop 运行在云端,把状态密集的执行环境留在原地。每个端点只需要一个轻量 daemon,它不保存会话状态,只执行命令并返回结果。执行环境留在云端之外,agent 按需从中读取上下文。

Anthropic 的“Decoupling the brain from the hands”采用了相同思路:harness 保持无状态,会话日志存放在外部,执行环境通过统一接口按需连接。区别在于目标场景。Anthropic 的文章描述的是托管服务,主要讨论按需创建的沙箱和客户 VPC 内的资源。我们首先要连接的是人们日常使用的个人机器,这些机器上有未提交改动和本地凭证,而且可能只是间歇在线。因此,我们的设计支持 BYOM(Bring Your Own Machine),即把用户自己的开发机或个人电脑连接到云端 agent。它也支持云主机和按需创建的计算环境。

这样一来,agent 不再绑定到一台机器。它可以在执行设备之间切换,在任务需要的任何环境中运行命令、读取上下文。它甚至可以与只是间歇在线的设备协作:当用户的个人设备重新连接时,云端 agent 会自动开始并完成需要在该设备上运行的任务。下图展示了最终结构,计算、持久状态和执行环境在两个层面上完成解耦:

§ 37

§ 38

Staying persistently online takes more than the compute-storage separation in Section 5: the system must also recover from anomalies automatically during long-running operation. A persistently online distributed system rarely stays reliable for long if it relies only on its internal logic. It needs an independent Control Loop outside the main system.

Agent systems also need more than traditional process liveness probes or monitoring scripts. Many anomalies are not crashes: the process is still running, but the model is stuck in an unproductive loop or has drifted from its goal. A long-running agent system therefore has to monitor task progress as well as infrastructure liveness.

Our external Control Loop is an independent Watchdog Session that runs outside the main system and is driven by scheduled messages. The Watchdog handles infrastructure failures such as API errors and failed state recovery. It also uses the model to judge whether each Worker is making substantive progress or drifting from the overall goal. It fixes anomalies promptly and keeps rechecking transient external failures until they are resolved.

Because the Watchdog is itself an agent session with a full set of tools, maintainers can ask it in natural language why something failed. They can also have it correct the main system's behavior while the system runs, for example by adding or removing prompts or adjusting trigger rules.

要持续在线,仅靠第 5 节的计算存储分离还不够:系统还必须在长时间运行中自动从异常中恢复。一个持续在线的分布式系统如果只依赖内部逻辑,很难长期保持可靠。它需要在主系统之外有一个独立的 Control Loop。

Agent 系统需要的也不只是传统进程存活探针或监控脚本。许多异常并不是崩溃:进程还在运行,但模型卡在无效循环里,或者偏离了目标。因此,长时间运行的 agent 系统既要监控基础设施存活,也要监控任务进展。

我们的外部 Control Loop 是一个独立的 Watchdog Session,运行在主系统之外,由定时消息驱动。Watchdog 处理 API 错误、状态恢复失败等基础设施故障。它还会用模型判断每个 Worker 是否在取得实质性进展,或是否偏离总体目标。它及时修复异常,并持续复查暂时性的外部故障,直到问题解决。

由于 Watchdog 本身就是一个拥有全套工具的 agent 会话,维护者可以用自然语言问它某个失败的原因。他们还可以让它在系统运行期间纠正主系统行为,例如增加或删除提示、调整触发规则。

§ 39

We ran preliminary experiments on the core scheduling and routing designs at two levels: the whole system, and the Router layer on its own. The end-to-end experiment compares the two-level architecture with single-session designs and measures the effect of the subscription and pass-through mechanism (Section 7.1). The second experiment tests batching in the Router layer (Section 7.2). The experiments use synthetic workloads and simplified environments, and parts of the setup could be more rigorous, so the results below are indicative only.

Four end-to-end designs ran at the same time, driven by a stream of group chat and GitHub CI messages. Each run had about 300 messages, of which about 20 were work requests. The rest were casual chat, follow-ups, cancellations, and CI messages. Coding work was simulated by a tool that simply consumes time, so the experiment measures the system's scheduling and coordination, not its ability to execute individual tasks. Each design was run 5 times.

The four designs are Super-agent, Super-agent without Pass-through, and two versions of Single Session with Subagent tool that use different prompts.

The neutral prompt reads "Use a subagent for a piece of work when appropriate...".

The delegation-first prompt reads "Every message of the chat reaches you, so work you run yourself keeps stopping for new messages. Prefer handing each piece of work to a subagent of its own, and do only small things yourself...".

我们在两个层面对核心调度与路由设计做了初步实验:整个系统,以及单独的 Router 层。端到端实验比较两级架构与单会话设计,并衡量订阅直通机制的效果(第 7.1 节)。第二个实验测试 Router 层中的批处理(第 7.2 节)。实验使用合成负载和简化环境,部分设置还可以更严谨,因此下面的结果仅供参考。

四个端到端设计同时运行,由群聊和 GitHub CI 消息流驱动。每次运行约有 300 条消息,其中约 20 条是工作请求,其余是闲聊、跟进、取消和 CI 消息。编码工作由一个只消耗时间的工具模拟,因此实验衡量的是系统的调度与协调,而不是执行单个任务的能力。每个设计运行 5 次。

四个设计分别是:Super-agent、去掉直通的 Super-agent,以及两个使用不同提示的 Single Session with Subagent tool。

中性提示为:“Use a subagent for a piece of work when appropriate...”。

委派优先提示为:“Every message of the chat reaches you, so work you run yourself keeps stopping for new messages. Prefer handing each piece of work to a subagent of its own, and do only small things yourself...”。

§ 40

§ 41
Design Task completion time p50 / p95 (min) Cache-read tokens per run (all sessions)
Super-agent 12.4/15.7 23.2M
Super-agent without Pass-through 12.6/15.5 31.8M
Single Session with Subagent tool, neutral prompt 20.4/29.5 6.1M
Single Session with Subagent tool, delegation prompt 13.8/29.0 10.8M

Note: each design was run 5 times. Task completion time is measured from a work request to its result message.

Super-agent completes tasks in 12.4 minutes at p50 and 15.7 minutes at p95, markedly faster than Single Session with Subagent tool. The single-session design is slower because, in this experiment, it depends heavily on its prompt: the main session often decides to do the work itself, which makes completion times long and unstable. With the neutral prompt, the model did not call a subagent in any of the 5 runs. All work ran in the main session, new messages kept interrupting it, and p95 reached 29.5 minutes. With the delegation-first prompt, the model delegated in 4 of the 5 runs. Completion times dropped somewhat, but overall they were still longer than Super-agent's. In the remaining run, the model judged the work "small" and did it itself, which produced the purple long tail in the figure. A single session has to rely on prompt engineering and the model's on-the-spot judgment to decide whether to delegate. The two-level architecture mitigates this problem at the system level instead: the Router does not execute work itself, and each Worker receives only messages from the Threads it subscribes to.

Because Super-agent maintains several independent sessions, it uses more cache-read tokens per run than the single-session designs, trading tokens for shorter and more stable completion times. Super-agent without Pass-through finishes tasks in about the same time as Super-agent, but its Router makes about 30% more decisions per run, and total cache-read tokens rise from 23.2M to 31.8M, about 37% more. So under this workload, pass-through does not make tasks finish faster or better, but it substantially cuts the Router Session's token use and inference overhead.

设计 任务完成时间 p50 / p95(分钟) 每次运行缓存读取 token(所有会话)
Super-agent 12.4/15.7 23.2M
去掉直通的 Super-agent 12.6/15.5 31.8M
Single Session with Subagent tool,中性提示 20.4/29.5 6.1M
Single Session with Subagent tool,委派提示 13.8/29.0 10.8M

注:每个设计运行 5 次。任务完成时间从工作请求发出算到结果消息返回。

Super-agent 的 p50 完成时间为 12.4 分钟,p95 为 15.7 分钟,明显快于 Single Session with Subagent tool。单会话设计更慢,是因为在这个实验里它高度依赖提示:主会话经常决定自己干活,导致完成时间又长又不稳定。使用中性提示时,模型在 5 次运行中没有一次调用子 agent。所有工作都在主会话中运行,新消息不断打断它,p95 达到 29.5 分钟。使用委派优先提示时,模型在 5 次运行中有 4 次进行了委派,完成时间有所下降,但总体仍长于 Super-agent。剩下那次运行中,模型认为工作“很小”而自己做了,于是产生了图中的紫色长尾。单会话只能靠提示工程和模型的临场判断来决定是否委派。两级架构则在系统层面缓解了这个问题:Router 不自己执行工作,每个 Worker 只接收它订阅的 Thread 中的消息。

由于 Super-agent 维护多个独立会话,它每次运行使用的缓存读取 token 多于单会话设计,用 token 换取更短、更稳定的完成时间。去掉直通的 Super-agent 完成任务的时间与 Super-agent 大致相同,但它的 Router 每次运行多做了约 30% 的决策,总缓存读取 token 从 23.2M 升到 31.8M,多了约 37%。因此,在这种负载下,直通不会让任务完成得更快或更好,但会大幅降低 Router Session 的 token 使用和推理开销。

§ 42

To find out how much load a single long-lived Router Session can handle with the batching described in Section 2.1, we stress-tested the Router layer on its own. The Router called a real model, while the Workers used mock models. Step by step, we raised the arrival rate of Triggers that need a decision from about 1 to about 40 per minute. At each rate we measured the average batch size, the time per request, and the amortized inference time per decision. A decision can span several LLM requests, because the Router may reason over several steps or recall context through tool calls before it dispatches, so the time per decision can exceed the time per request.

为了弄清单个长寿命 Router Session 在第 2.1 节所述批处理下能承受多大负载,我们单独对 Router 层做了压测。Router 调用真实模型,Worker 使用 mock 模型。我们逐步把需要决策的 Trigger 到达率从约每分钟 1 个提高到约每分钟 40 个。在每个速率下,我们测量平均批大小、单次请求时间,以及每次决策分摊的推理时间。一次决策可能跨越多个 LLM 请求,因为 Router 在派发前可能要进行多步推理或通过工具调用召回上下文,所以每次决策的时间可能超过单次请求时间。

§ 43

§ 44

As the figure above shows, when the arrival rate of Triggers that need a decision rises from about 1 to about 40 per minute, the average batch size increases from 1.0 to 2.8. The time per request grows only from 2.5 s to 3.9 s, more slowly than the batch size, so the amortized inference time per decision falls from 6.4 s to 1.6 s. In other words, when external events arrive in bursts, the Router layer raises its effective throughput by automatically merging the events that have piled up. Batching also explains the result in Section 7.1: removing pass-through raised the Router's peak load, yet a single Router still did not reach its throughput limit. So at our current team size, there is no need to shard the Router layer prematurely at the cost of global context continuity.

如上图所示,当需要决策的 Trigger 到达率从约每分钟 1 个升到约每分钟 40 个时,平均批大小从 1.0 增至 2.8。单次请求时间只从 2.5 秒增至 3.9 秒,增长慢于批大小,因此每次决策分摊的推理时间从 6.4 秒降到 1.6 秒。换句话说,当外部事件突发到达时,Router 层通过自动合并积压事件提高了有效吞吐。批处理也解释了第 7.1 节的结果:去掉直通提高了 Router 的峰值负载,但单个 Router 仍未达到吞吐上限。因此,在我们当前团队规模下,没有必要以牺牲全局上下文连续性为代价过早分片 Router 层。

§ 45

Sections 2 through 6 describe the five modules that form the basic architecture of a Super-agent. The experiments in Section 7 show that its core scheduling and routing mechanisms work when many tasks run concurrently. The system can stay relatively simple largely because, at this stage, we have simplified both the engineering design and the scenarios we support. Beyond those simplifications, problems remain open in four areas: scaling the two-level architecture (Section 8.1), working with an agent without sessions (Section 8.2), context boundaries and agent-to-agent (A2A) communication (Section 8.3), and security and privacy (Section 8.4).

So far, a simple combination has covered most of our daily tasks at low engineering cost: a single long-lived Router Session, subscription and pass-through, and no direct communication between Workers. Once tasks grow larger and more tightly coupled than one Router Session can handle, the right structure for each layer is not yet settled. We still need to test more scenarios to find out when the Router layer should be sharded and how finely, and when peer Workers should communicate directly and in what collaboration topology. Co-designing the system and the model is another direction worth exploring. Training the model specifically for Router-layer work, such as judging events, dispatching in batches, and recalling context, may further improve the Router layer's throughput and decision quality.

Memory also limits how far the system can scale. The long-lived Router layer, together with Chain of Recall over the reference graph, mainly handles on-demand retrieval of recent tasks and session history. Once the system has run for months or longer, long-term memory becomes the main bottleneck.

第 2 到第 6 节描述了构成 Super-agent 基本架构的五个模块。第 7 节的实验表明,其核心调度与路由机制在多任务并发时能够工作。系统之所以能保持相对简单,很大程度上是因为现阶段我们同时简化了工程设计和所支持场景。在这些简化之外,仍有四个领域的问题有待解决:扩展两级架构(第 8.1 节)、在没有会话的情况下使用 agent(第 8.2 节)、上下文边界与 agent 间(A2A)通信(第 8.3 节),以及安全与隐私(第 8.4 节)。

到目前为止,一个简单的组合以较低的工程成本覆盖了我们大多数日常任务:单个长寿命 Router Session、订阅直通,以及 Worker 之间不直接通信。一旦任务变得更大、更紧耦合,超出单个 Router Session 的处理能力,每一层该采用什么结构还没有定论。我们仍需测试更多场景,弄清 Router 层应在何时分片、分得多细,以及同级 Worker 应在何时直接通信、采用什么协作拓扑。系统与模型协同设计是另一个值得探索的方向。专门针对 Router 层工作训练模型,例如判断事件、批量派发和召回上下文,可能进一步提升 Router 层的吞吐和决策质量。

记忆也限制了系统的扩展上限。长寿命 Router 层加上引用图上的 Chain of Recall,主要解决近期任务和会话历史的按需检索。一旦系统运行数月甚至更久,长期记忆就会成为主要瓶颈。

§ 46

Because the two-level architecture hides multi-session management from users, sessions stop being the main concern of product design. But once the execution sessions underneath no longer map directly to conversations in the interface, a new question arises: how to present tasks to users, and what forms of interaction and project management feel natural. We think the chat window became the center of interaction partly through path dependence. More interaction may move into domain-specific interfaces, as with our Super-agent instance, which works directly in GitHub Issues and Pull Requests. Sessions can also remain in the interface because users are used to them, but one conversation the user sees need not correspond to one underlying session.

The earlier sections mostly cover human interaction at the start of a task and at sign-off. But during this transition, while models are improving quickly, many tasks still need a person partway through. It is also worth exploring how product design can let users intervene step by step on key details without losing the efficiency of autonomous background work. For example, users could step in, take over, or work with the agent in real time at any point during background execution.

Overall, the project management and interaction that users need depend heavily on their work domain and personal style, so the final design is likely to be highly customized. DeepSeek Harness has an open architecture, which makes such customization easier to support.

由于两级架构把多会话管理对用户隐藏起来,会话不再是产品设计的中心。但一旦底层的执行会话不再直接对应界面中的对话,就会出现新问题:如何向用户呈现任务,什么样的交互和项目管理方式才自然。我们认为聊天窗口成为交互中心,部分原因是路径依赖。更多交互可能会转移到领域专用界面中,例如我们的 Super-agent 实例直接在 GitHub Issues 和 Pull Requests 中工作。会话也可以因为用户习惯而保留在界面里,但用户看到的一个对话不必对应底层的一个会话。

前面几节主要讨论任务开始和签核时的人类交互。但在模型快速进步的过渡期,许多任务仍然需要人在中途参与。产品设计如何让用户在关键细节上逐步介入,同时不牺牲自主后台工作的效率,也值得探索。例如,用户可以在后台执行的任意时刻介入、接管,或与 agent 实时协作。

总的来说,用户需要的项目管理和交互方式高度依赖其工作领域和个人风格,因此最终设计很可能是高度定制的。DeepSeek Harness 具有开放架构,更容易支持这类定制。

§ 47

So far we have discussed the design of a single Super-agent instance and assumed that all information within its scope is gathered in one global context. As use grows from individuals and small teams to larger organizations, deciding how to provision Super-agents becomes, in effect, deciding which context is shared and which is isolated. Parts of an organization that need shared context share one instance, and parts that need isolation each get their own.

Once isolated instances exist within or across organizations, collaboration across their boundaries is A2A communication, for example between each member's personal agent and the team's shared Super-agent. Here A2A means agent-to-agent communication in general, not a specific protocol. We still need to work out how agents that share no underlying context and each represent a different permission boundary can communicate and collaborate securely and reliably.

到目前为止,我们讨论的是单个 Super-agent 实例的设计,并假设其范围内的所有信息都汇聚在一个全局上下文中。当使用范围从个人和小团队扩展到更大的组织时,如何配置 Super-agent 实际上就变成了决定哪些上下文共享、哪些上下文隔离。组织中需要共享上下文的部分共用一个实例,需要隔离的部分则各自拥有实例。

一旦组织内部或组织之间出现隔离实例,跨边界的协作就是 A2A 通信,例如每个成员的个人 agent 与团队共享 Super-agent 之间的通信。这里的 A2A 泛指 agent 与 agent 之间的通信,而非某种特定协议。我们仍需解决:不共享底层上下文、各自代表不同权限边界的 agent,如何安全可靠地通信与协作。

§ 48

The event-driven design in Section 3 lets a wider range of environments drive the agent, but it also exposes the agent to more untrusted input. Unless security and privacy are handled well, a Super-agent can only work within a very small, trusted scope.

For example, the design in Section 5 runs the Agent Loop in the cloud and installs lightweight daemons on execution devices. It implicitly assumes that the cloud and the endpoints trust each other. But the cloud-hosted Agent Loop keeps taking in external events, while endpoint devices hold private code, sensitive data, and local credentials. Connecting the two creates significant security and privacy risks. If a server-side intrusion or a prompt injection compromises the Agent Loop, every endpoint device connected to it could be taken over.

Credentials can leak even if the cloud is never compromised. As long as credentials on an endpoint can enter the model's context, normal execution can expose them. The agent therefore needs a way to use credentials without ever seeing them. For this architecture to be used more widely, it has to solve these security and privacy problems while keeping its ability to recall context from many different environments.

第 3 节的事件驱动设计让更多环境可以驱动 agent,但也让 agent 暴露在更多不可信输入之下。除非安全和隐私处理得当,否则 Super-agent 只能在非常小的可信范围内工作。

例如,第 5 节的设计把 Agent Loop 放在云端,并在执行设备上安装轻量 daemon。它隐含假设云端和端点彼此信任。但云端托管的 Agent Loop 持续接收外部事件,而端点设备保存着私有代码、敏感数据和本地凭证。把两者连接起来会带来重大的安全与隐私风险。如果服务端入侵或提示注入攻破了 Agent Loop,所有连接到它的端点设备都可能被接管。

即使云端从未被攻破,凭证也可能泄露。只要端点上的凭证能够进入模型上下文,正常执行就可能暴露它们。因此,agent 需要一种使用凭证却永远看不到凭证的方法。要让这种架构得到更广泛使用,就必须在解决这些安全与隐私问题的同时,保留从多种不同环境召回上下文的能力。

§ 49

Rather than proposing new theory, this design applies classic engineering ideas from computer systems to building agent systems. Specific implementations will change as the technology develops, but we believe the system design ideas behind them will remain useful for longer. Our internal Super-agent instance, built on these ideas and on DeepSeek Harness, is already running continuously. It helps every day with reproducing and fixing issues, responding to code reviews, and developing DeepSeek Harness itself.

As we noted at the start, large models need less and less human intervention on individual tasks, so the bottleneck to further productivity gains is shifting to human attention. Together, the two-level architecture, event-driven design, asynchronous multi-channel interaction, compute-storage separation, and an external Watchdog let the system take over the tedious work of managing sessions and syncing context. People can then move further up, from execution details to higher-level decisions and sign-off.

Built this way, an agent is no longer only a chat window that waits for instructions. It becomes an autonomous collaborator that stays online in the digital environments people use. For individuals, it can be a personal agent that helps with daily tasks across devices. For teams, it becomes part of the R&D workflow, taking on tasks and moving them forward. We believe that as models and system architectures evolve together, this more autonomous way of working could become the norm in human-agent collaboration.

本文的设计并非提出新理论,而是把计算机系统中的经典工程思想应用到 agent 系统构建中。具体实现会随技术发展而变化,但我们相信其背后的系统设计思想会在更长时间内保持价值。我们内部基于这些思想和 DeepSeek Harness 构建的 Super-agent 实例已经在持续运行。它每天都在帮助复现和修复问题、响应代码审查,以及开发 DeepSeek Harness 本身。

正如开头所说,大模型在单个任务上需要的人类干预越来越少,因此进一步提升生产力的瓶颈正在转向人的注意力。两级架构、事件驱动设计、异步多通道交互、计算存储分离和外部 Watchdog 共同让系统接管了管理会话、同步上下文这些繁琐工作。人于是可以进一步上移,从执行细节转向更高层的决策和签核。

这样构建出来的 agent 不再只是一个等待指令的聊天窗口。它成为驻留在人们使用的数字环境中的自主协作者。对个人而言,它可以是跨设备帮助处理日常任务的个人 agent;对团队而言,它成为研发工作流的一部分,承接任务并推动其前进。我们相信,随着模型和系统架构共同演进,这种更自主的工作方式可能成为人机协作的常态。

§ 50

Parts of the design in this article are implemented in dsh-superagent-prototype. This plugin is only a prototype for validating the technical approach, not an official DeepSeek product.

Author & Acknowledgements

This article is based on shared work by the DeepSeek Harness team. Yujia Qiao implemented the system and wrote the article. Huanqi Cao, Zui Chen, Xieting Chu, Tianyi Cui, Shiyuan Feng, Yudong Han, Kexin Liu, Shichun Liu, Gesi Luo, Yifan Shi, Tongrui Xiong, Hanxiang Xu, C.C. Yu, Ziya Zhang, F. Zhou, and others took part in reviews and discussions and gave feedback. Both the system and this article owe much to the team's daily exchanges and the experience it has built up.

本文的部分设计实现在 dsh-superagent-prototype 中。该插件只是用于验证技术路线的原型,并非 DeepSeek 官方产品。

作者与致谢

本文基于 DeepSeek Harness 团队的共同工作。Yujia Qiao 实现了系统并撰写本文。Huanqi Cao、Zui Chen、Xieting Chu、Tianyi Cui、Shiyuan Feng、Yudong Han、Kexin Liu、Shichun Liu、Gesi Luo、Yifan Shi、Tongrui Xiong、Hanxiang Xu、C.C. Yu、Ziya Zhang、F. Zhou 等人参与了评审和讨论并提供了反馈。系统和本文都很大程度上受益于团队的日常交流及其积累的经验。

打开原文 ↗