🔶 长程 Agent 成本降至一半
英文标题:🔶 Long-horizon agents at half the cost
Unreal Labs 为 Unreal Agent 推出上下文压缩机制,在 SWE-Marathon 基准上以比 Codex 低 48% 的推理成本取得相同成绩。两者均使用 GPT-6.1 Sol 的 xhigh 推理配置,在 20 个任务、每个任务 8 次尝试中均达到 43.125% 的 pooled pass@1。Unreal Agent 的总推理成本为 445.75 美元,Codex 为 850.52 美元。该更新还带来终端用户界面(TUI),并通过 Anthropic 原生 Messages API 支持 Claude 模型,不过需针对异步工具调用结果进行额外处理。
2.9 MB
2.2 MB
284.5 KB
中文
Agent 处理长时间运行任务的能力,取决于多个部分的协同:能力足够强的语言模型、harness(编排框架)以及执行环境。今天,我们分享对 harness 的一项改进:上下文压缩(context compaction),现已在 Unreal Agent 中提供。
借助新的压缩机制,Unreal Agent 在 SWE-Marathon 上以低 48% 的成本取得了与 Codex 相同的分数。两个 Agent 均使用 GPT-6.1 Sol,并启用 xhigh 推理。


在设计压缩机制时,我们希望保留 Unreal Agent 的非阻塞异步架构,避免在执行压缩前等待所有工具调用完成而导致“暂停整个世界”(stop-the-world)。
Unreal Agent 的上下文压缩机制如下:
当 Unreal Agent 的上下文大小达到设定阈值时,它会提交请求,对会话上下文的中间部分进行总结,同时保留原始系统指令和最近的若干轮对话。
Unreal Agent 不会中断压缩开始时仍在运行的任何工具调用。这些调用最初的工具调用块会被追加在压缩后上下文中摘要消息的后面。待这些工具调用完成后,其结果会进入压缩后的上下文。
两个 harness 均使用 GPT-6.1 Sol,xhigh,并在 20 个任务 × 每个任务 8 次尝试 上进行评估。分数采用汇总的 pass@1。
我们遵循 SWE-Marathon 论文所述的评分方法。
| Harness | 通过数 | 分数 ±1 SE | 推理总成本(美元) | 预期重复运行成本(美元),95% CI | Harbor |
|---|---|---|---|---|---|
| Unreal Agent | 69/160 | 43.125% ±3.92 个百分点 | $445.75 | $419.82–$472.65 | Harbor job |
| Codex | 69/160 | 43.125% ±3.92 个百分点 | $850.52 | $781.60–$920.40 | Harbor job |
我们还为 Unreal Agent 发布了终端界面(TUI),让用户无需深入研究 SDK 即可轻松试用。这款 TUI 是我们献给 Borland Turbo Vision 的情书——这是团队许多成员最初学习编程时接触的经典用户界面。
使用 Homebrew 安装,然后启动 TUI:
% brew install unreallabsai/tap/unreal-agent
% unreal-agent
Unreal Agent 现已通过 Anthropic 原生的 Messages API 支持 Claude 模型。与 OpenAI 的 Responses API 相比,该 API 对消息和内容块的顺序提出了更严格的要求。在我们的 harness 中,这意味着需要对异步工具结果进行自定义处理。
不同于 Responses API,Messages API 要求工具结果紧跟在其对应的工具调用之后。对于在下一轮模型调用之后才完成的工具调用,其结果将作为合成的用户内容块(synthetic user-content blocks)交付。
English / 原文
An agentâs ability to tackle long-running tasks depends on several pieces working together: a capable language model, a harness, and an execution environment. Today, weâre sharing an improvement to our harness: context compaction, now available in Unreal Agent.
With the new compaction mechanism, Unreal Agent achieves the same score as Codex at 48% lower cost on SWE-Marathon. Both agents used GPT-6.1 Sol with xhigh reasoning.


When designing the compaction mechanism, we wanted to preserve Unreal Agentâs non-blocking async architecture and avoid a âstop-the-worldâ pause waiting for all tool calls to finish before performing compaction.
Hereâs how Unreal Agentâs compaction works:
When Unreal Agentâs context size reaches a configured threshold, it submits a request to summarise the middle portion of the session context, keeping the original system instructions and a few recent turns intact.
Unreal Agent doesnât interrupt any tool calls that are running when compaction begins. Their initial tool call blocks are appended after the summarised message in the compacted context. Once those tool calls complete, their results enter the compacted context.
Both harnesses use GPT-6.1 Sol, xhigh , evaluated on 20 tasks à 8 attempts. Scores are pooled pass@1.
We follow the scoring methodology described in the SWE-Marathon paper.
| Harness | Passes | Score ±1 SE | Total inference cost (USD) | Expected repeat-run cost (USD), 95% CI | Harbor |
|---|---|---|---|---|---|
| Unreal Agent | 69/160 | 43.125% ±3.92 pp | $445.75 | $419.82â$472.65 | Harbor job |
| Codex | 69/160 | 43.125% ±3.92 pp | $850.52 | $781.60â$920.40 | Harbor job |
Weâre also shipping a terminal interface (TUI) for Unreal Agent â an easy way to try it out without diving deep into the SDK. This TUI is our love letter to Borland Turbo Vision â the OG user interface many of our team members learned to program with.
Install it with Homebrew, then launch the TUI:
% brew install unreallabsai/tap/unreal-agent
% unreal-agent
Unreal Agent now supports Claude models through Anthropicâs native Messages API. Compared with OpenAIâs Responses API, it imposes stricter requirements on the ordering of messages and content blocks. In our harness, this requires custom handling of asynchronous tool results.
Unlike Responses, Messages API expects tool results immediately after their corresponding tool calls. Results from tool calls that finish after the next model turn are delivered as synthetic user-content blocks.