商业产业 Hacker News AI 2026-08-05T21:11 正文 ok 3433 words

Prime Agent:可自我改进的 RLM Agent

英文标题:🔶 Prime Agent: A self-improving RLM agent

Prime Intellect 发布并开源了 Prime Agent,这是一套围绕递归语言模型(RLM)和 Continual Harness 构建的可自我改进编码 Agent 运行框架。该系统以持久化 IPython REPL 作为核心工具,使模型能够通过代码调用工具和子 Agent,并保留超长会话中的历史、状态与上下文。其 Continual Harness 允许 Agent 对提示词、技能、记忆和子 Agent 配置进行创建、读取、更新和删除,并通过 `/refine` 基于自身轨迹进行渐进式改进。Prime Agent 还提供持久化子 Agent、多 Agent 通信、会话恢复及自主评测模式,为长时程自动化编码、评测和研究协作提供了新的运行时设计。
打开原文相关 3 · 机会 1
media18.2 KB media345 B media246.6 KB media199.0 KB media38.2 KB media114.8 KB media82.8 KB media11.3 KB media10.9 KB media3.1 KB media3.0 KB media156.8 KB media368.3 KB media175.6 KB media555 B media642 B media157.6 KB media57.7 KB media54.4 KB media14.4 KB

中文

Prime Agent:可自我改进的 RLM Agent

今天,我们发布 Prime Agent:一套围绕两种抽象构建的可自我改进编码运行框架,分别是 递归语言模型(Recursive Language Model,RLM) [论文] 和 Continual Harness [论文]。现代运行框架的设计基于早期模型代际的能力,它们并未反映当今前沿模型所能做到的事情:固定的工具调用模式和上下文压缩机制,迫使模型绕开自身的脚手架工作,而非利用这些脚手架。静态、人工设计的子 Agent、提示词、技能与记忆在设计时就被固定,无法适应 Agent 在运行过程中获得的经验。我们认为,运行框架应当基于当前模型能力,向下一代推理模式进行延展。

Prime Agent 通过以下两项核心抽象践行这一原则:

  1. 递归语言模型(RLM) 将上下文视为变量,并将子 Agent 委派视为 REPL 内部的函数调用。持久化 REPL 让模型能够以编程方式访问其历史记录、子 Agent 和工具,从而将语言模型程序写成作用于自身上下文的操作。这一设计使 Agent 能够处理任意长的会话,同时不会失去对存储在变量中的既往信息的访问能力。
  2. Continual Harness 将运行框架自身的状态——抽象为提示词、技能、记忆和子 Agent——视为 Agent 能够从自身轨迹中创建、读取、更新和删除(CRUD)的对象。结合 Agent 间通信机制,该机制支持跨子 Agent,乃至跨 Prime Agent 会话的编排。例如,Prime Agent 可以生成持久化子 Agent,在轨迹后续阶段向其发送消息,并直接与另一个 Prime Agent 会话通信。

这些抽象对于引导模型能力的自举非常强大。Prime Agent 被设计为一个高效的通用编码助手、长时程自主评测的默认运行时,以及研究和自动化研究中的协作者。

Prime Agent 已完全开源,可通过以下方式安装:

curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh

Prime Agent 引导页启动画面

Prime Agent

Agent 运行框架的性能同时取决于框架设计,以及围绕该框架训练的模型能力。我们将 Prime Agent 设计为能够立即配合现代开源与闭源前沿模型使用,同时提供一组功能;我们预计,随着新一代模型围绕它接受训练,这些功能将带来进一步的性能提升。

Prime Agent 的核心设计是以编程方式调用工具和子 Agent。Prime Agent 中的模型将持久化 IPython 内核作为唯一工具。其他标准运行框架功能都在该内核中作为函数调用,包括子 Agent;每个子 Agent 都被实现为另一个 prime-agent 实例。

Prime Agent 的架构

Prime Agent 架构图

RLM 和 Continual Harness 是两项核心抽象;子 Agent CRUD 加上 Agent2Agent 消息通信,将它们组合为编排机制。

后台守护进程与 Agents View。 默认视图是一个与其他编码 Agent 运行框架相似的文本用户界面(TUI)。默认情况下,Agent 发起的 IPython 操作会被压缩显示以保持简洁,但可以展开查看运行框架执行的操作。在 REPL 中启动的子 Agent 也可以在用户聊天框下方访问。

Prime Agent 文本用户界面

Prime Agent 运行一个后台守护进程,通过本地 socket 管理所有活跃的 Agent 会话。你可以附着到会话或从会话分离,而不会影响底层 Agent 循环。每个根会话树均在可恢复的工作进程中运行;如果工作进程崩溃,守护进程会根据会话 JSONL 文件和内核状态快照恢复它。

Agents View 允许你查看并选择守护进程中的其他活跃会话。可在空提示符下按左方向键(←)打开,它会列出当前正在运行的会话、守护进程仍处于活跃状态的空闲会话,以及目前未加载到内存中的非活跃会话。任何此类聊天都可以立即进入并交互;按空格键可与任何状态的会话聊天,包括引导会话、排队提示词,以及排队诸如 /compact 等命令。

Agents View 被构建为 Agent 与子 Agent 之间递归式的中心连接点。任何 Agent 都能在 Agents View 中被发现。用户可从 Agents View 进入某个 Agent 的聊天,再进入其子 Agent 的 Agents View,接着进入子 Agent 聊天,如此继续。

由于子 Agent 与根 Agent 共享同一套 运行中—空闲—非活跃(Running-Idle-Inactive) 状态机,它们在 30 分钟无活动后可从内存中移除;当用户或 Agent 向其中任一个发出请求时,它们会立即从磁盘重新加载。在高度嵌套的聊天中,这可以节省大量内存。

Prime Agent Agents View,列出运行中、空闲和非活跃会话

会话与上下文管理。 Agent 的完整会话历史会作为仅追加的 JSONL 文件存储在磁盘上。每一行都是一个 JSON 条目,其中可包括消息、模型切换、压缩摘要或扩展条目。分支、派生和克隆均通过移动叶节点指针在同一文件内完成。完整历史始终可以通过 /tree 恢复。

当上下文达到阈值时,或由 Agent 在 REPL 中直接调用 compact.run() 时,就会进行压缩。压缩主要用于清理 Agent 的主上下文;但在需要时,包括过往压缩记录在内的完整历史仍可在 IPython 内核中以编程方式访问。

REPL 的引入需要额外工作来管理 IPython 状态。我们异步地同时压缩和清理内核,并启动一个 Agent 充当垃圾收集器。这是避免每个 Agent 的 REPL 内存不断累积所必需的。

Prime Agent 依赖会话期间持续存在的 IPython 内核作为其 REPL,并可在每个回合调用它。初始化时,内核会将每项技能/工具预先导入为模块,其中包括用于递归式程序化子 Agent 调用的 rlm。

rlm 是一个异步函数,这意味着模型可以在代码中自由调用并并行化子 Agent 调用。启动一个子 Agent(例如 await rlm("sub-task"))会创建一个完整会话,拥有其自身的模型、IPython 内核、会话树和对话历史。调用会立即返回,因为后续所有 Agent 间通信均通过 agent_message.send(...) 工具进行。

Prime Agent 可选择以这种方式启动多种实用原语,例如并行分发子 Agent,或启动后台工作。

auth = await rlm("Summarize the authentication flow in auth/. Reply to me when done.", name="auth-expert") api = await rlm("Summarize the updated HTTP API layer in src/. Reply to me when done.", name="http-expert")

await agent_message.send( "Also cover middleware error handling.", receiver_role="child", receiver_name=api.name, )

随着模型持续进步,围绕工具调用和子 Agent 的新调用模式将不断出现。我们预计,未来几代模型将更少依赖手把手式的提示词,而更多依赖此类直接的程序化控制。

编排与多 Agent 通信

后台守护进程管理所有活跃的 Prime Agent 会话。Prime Agent 还通过守护进程支持 Agent-to-Agent(A2A)消息通信,允许任意 Prime Agent 会话使用与持久化子 Agent 通信相同的机制,向其他 Prime Agent 会话发送消息。这使得管理子 Agent 集群的进度,以及由相关 Agent 直接就共享资源进行通信的编排工作更加容易。为防止独立会话之间出现不必要的通信,Prime Agent 中的多 Agent 通信仅限于其 核心家庭(nuclear family),即父进程、同级进程或子进程。

handle = await rlm("Find what's wrong in this auth-flow. Reply to me with your findings.", name="auth-reviewer")

children = await rlm.list_subagents() auth_child = next(c for c in children if c.session_name == "auth-reviewer")

await agent_message.send( "Follow up: identify the main edge cases and any likely bugs.", receiver_role="child", receiver_name=auth_child.session_name, mode="follow_up", )

Prime Agent 通过其原生 RLM 运行时支持 持久化子 Agent,这意味着子 Agent 自身的会话目录、上下文、IPython 内核和会话历史,即使在初始子 Agent 调用完成后仍会保留。Prime Agent 可以在其 IPython 内核中通过访问子 Agent 的唯一会话标识符,向其发送后续消息以继续该持久化子 Agent。

通过 Continual Harness 实现自我改进

Prime Agent 的运行框架状态以 rlm.harness 的形式存在于持久化 IPython 内核中,Agent 可在任务中途立即读取和调用;每一项变更也会写入磁盘,因此能跨回合和跨会话保留。Continual Harness 将该状态形式化为 H=(ρ,G,K,M)H=(\rho, G, K, M)H=(ρ,G,K,M),即提示词、子 Agent、技能和记忆;这些内容可根据 Agent 自身轨迹进行在线优化,无需重置。

四个组件均提供相同的创建、读取、更新和删除接口。create_prompt_note(...)、create_memory(...)、create_skill(...) 和 create_subagent(...) 分别新增相应类型的条目,update_X(...) 和 delete_X(...) 与之对应,list(kind) 或 get(kind, id) 则用于读取这些条目。技能也遵循同一接口:编写一个由 Python 支持的技能,就是一次携带 SKILL.md 风格引用的 create_skill(...) 调用,这与新增记忆或提示词注释是同一种操作。

rlm.harness.create_memory("flaky test pattern", "retry three times before failing") rlm.harness.create_skill("retry helper", "...", reference={"type": "python", "import": "retry_helper"})

rlm.harness.list("memory") rlm.harness.get("skill", "retry_helper")

/refine 是构建在这套 CRUD 接口之上的自我改进流水线。它读取 Agent 自身的轨迹——即尝试过什么以及结果如何的记录——并施加最小且相关的 CRUD 编辑,以使运行框架朝着更好结果改进:更新一个提示词注释、记忆、技能或子 Agent 规范,而不是重写整个运行框架。每次优化都会记录其触发因素和产生的结果,因此改进基于证据而非任意进行。优化分两个阶段运行:提出编辑方案的规划阶段,即 LLM 调用,在后台运行,不会阻塞进行中的对话;应用编辑阶段,即写入磁盘并重建系统提示词,速度很快,只会在下一回合边界短暂阻塞。Agent 在注意到重复失败或可复用策略时,可随时直接调用 refine.run(),而不只是在固定时间表上运行。

await refine.run("promote the retry-on-flaky-test pattern to a skill")

await compact.status()
await refine.status()

基础系统提示词保持不可变。/refine 只编辑其外围的运行框架层。系统支持通过先前的优化历史进行回滚,因此可按 ID 撤销一次不良的运行框架更新。

用于评测的自主模式

Prime Agent 的评测模式结合了三种互补机制。目标(goal)设定总体任务:这是一个带有可选 token 预算的持久目标,运行框架会持续重新提示 Agent 在多个回合中推进该目标,直至 Agent 显式调用 goal.complete()。心跳(heartbeats)是按 cron 风格调度、以固定时间间隔注入会话的消息,用于定期检查,例如监控子 Agent 的进度或轮询训练更新。自主模式则是延续机制本身,确保 Agent 持续向目标努力,而不会在某回合不再产生进一步输出后过早停止。这些机制结合后,可使会话在无人值守状态下长时间运行,同时仍受显式预算约束,并可通过 Agents View 进行检查。

自主模式可直接通过 CLI 的 --autonomous 使用,无需编写脚本。一次运行可以在同一命令中设置完成目标和回合上限:

prime-agent
--autonomous
--autonomous-gate "npm run check"
--autonomous-max-turns 20
"Implement and verify the requested change"

会话被允许结束前会运行 gate 命令。若 gate 失败,其受限输出会返回给 Agent 以供再次尝试;当工作区自上一次尝试以来没有变化时,Prime Agent 会跳过重新运行失败的 gate。--autonomous-max-turns、--autonomous-max-tokens 和 --autonomous-timeout-ms 分别限制延续回合数、token 数和实际运行时间。

评估 Prime Agent

Prime Agent 既是可供使用的编码 Agent,也是可供研究评估的 运行框架设计。我们特别指出:虽然许多现代前沿模型都围绕特定运行框架接受训练,但目前尚无模型围绕 Prime Agent 或其核心功能集接受训练。

ARC-AGI 3。 ARC-AGI 3 是一项广受欢迎的智能基准测试,用于衡量 Agent 执行符号推理以及学习模拟世界规则的能力。我们使用多个不同前沿模型,在自主模式下评估 Prime Agent,并与它们的原生运行框架进行比较。

English / 原文

Prime Agent: A self-improving RLM agent

Today, we are launching Prime Agent , our self-improving coding harness designed around two abstractions, the Recursive Language Model (RLM) [citation] and Continual Harness [citation]. Modern harness designs were built around the capabilities of earlier generations of models, and they do not reflect what frontier models can do today: fixed tool-calling schemas and context compaction force the model to work around its own scaffolding instead of leveraging it. Static, hand-engineered sub-agents, prompts, skills, and memory are set once at design time and never adapt to what the agent learns while running. We believe that harnesses should instead extrapolate on current model capabilities toward the next frontier of reasoning patterns.

Prime Agent is built around this principle through two main abstractions:

  1. The Recursive Language Model (RLM) treats context as a variable and subagent delegation as function calls inside a REPL. The persistent REPL gives the model programmatic access to its history, sub-agents, and tools, allowing it to write language model programs as actions over its own context. This design allows the agent to process arbitrarily long sessions without losing access to its own past information stored in variables.
  2. Continual Harness treats the harness's own state, abstracted as its prompts, skills, memory, and sub-agents, as something the agent can create, read, update, and delete (CRUD) from its own trajectory. When combined with agent-to-agent communication, this mechanism enables orchestration across sub-agents and even across Prime Agent sessions. For example, Prime Agent can spawn persistent sub-agents, message them later in the trajectory, and communicate directly with a different Prime Agent session.

These abstractions are powerful for bootstrapping model capabilities. Prime Agent is built to be effective as a general coding assistant, as a default runtime for long-horizon autonomous evaluation, and as a collaborator for research and autoresearch.

Prime Agent is fully open-source, and can be installed via:

curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh

Prime Agent onboarding splash screen

Prime Agent

The performance of agent harnesses are tied to both the design of the harness and the capability of the model trained around the harness. We designed Prime Agent to be immediately usable with modern open and closed frontier models, while also providing a feature set that we expect to provide further performance gains as newer generations of models are trained around it.

At its core, Prime Agent is designed around programmatic tool and sub-agent calling. Models in Prime Agent use a persistent IPython kernel as their only tool. Other standard harness features are called as functions in the kernel, including sub-agents, which are each implemented as another prime-agent instance.

Prime Agent's Architecture

Prime Agent architecture diagramRLM and Continual Harness are the two core abstractions; sub-agent CRUD plus Agent2Agent messaging compose them into orchestration.

Background Daemon and Agents View. The default view is a text-user interface (TUI) similar to other coding agent harnesses. By default, IPython actions made by the agent are condensed for brevity, but can be expanded to view actions made by the harness. Sub-agents launched in the REPL can also be accessed below the user chatbox.

Prime Agent text user interface

Prime Agent runs a background daemon that owns all live agent sessions over a local socket. You can attach and detach from the session without affecting the underlying agent loop. Each root session tree runs in a recoverable worker process; if a worker crashes, the daemon recovers it from the session JSONL and kernel state snapshot.

The Agents View allows you to see and select other live sessions from the daemon. It can be opened by pressing the Left Arrow key (←) on an empty prompt, and lists sessions that are currently running, idle sessions with the daemon still active, and inactive sessions that are currently not loaded in memory. Any of these chats can immediately be entered and interacted with, and pressing space allows users to chat with a session in any state, including steering and queuing of prompts and commands such as /compact.

The Agents View is constructed as the central connecting point between agents and subagents, recursively. Any agent is discoverable in an Agents View. Users navigate from an Agents View into an agent's chat, then into the Agents View of its subagents, into a subagent chat, and so on.

Because subagents share the same Running-Idle-Inactive state machine as the root agents, they can be removed from memory after 30 minutes of inactivity, and the moment a user or agent addresses any of them, they are reloaded from disk. In highly nested chats, this can save a lot of memory.

Prime Agent Agents View listing running, idle, and inactive sessions

Session and Context Management. The entire session history of the agent is stored as append-only JSONL files on disk. Each line is a JSON entry, which can include messages, model switches, compaction summaries, or extension entries. Branching, forking, and cloning all happen within the same file by moving the leaf pointer. The full history is always recoverable through /tree.

Compaction happens when the context hits a threshold or directly by the agent in the REPL with compact.run(). Compaction is primarily used to clean the main context of the agent, but the full history, including past compactions, can be accessed programmatically in the IPython kernel when needed.

The introduction of the REPL requires additional work to manage the IPython state. We asynchronously compact and clean the kernel simultaneously, using a spawned agent to act as a garbage collector. This is necessary to avoid REPL memory built up for each agent.

Prime Agent relies on the IPython kernel as its REPL that persists over the session, which it can invoke every turn. On initialization, the kernel pre-imports each skill / tool as a module, including the rlm for recursive programmatic sub-agent calling.

The rlm is an asynchronous function, meaning the model can freely invoke and parallelize sub-agent calls in code. Spawning a subagent (e.g. await rlm("sub-task")) launches a full session with its own model, IPython kernel, session tree, and conversation history. It returns immediately, because all subsequent communication between agents happens through the agent_message.send(...) tool.

There are several useful primitives that Prime Agent can choose to launch in this way, such as fanning out sub-agents in parallel, or launching background work.

auth = await rlm("Summarize the authentication flow in auth/. Reply to me when done.", name="auth-expert")
api = await rlm("Summarize the updated HTTP API layer in src/. Reply to me when done.", name="http-expert")




await agent_message.send(
    "Also cover middleware error handling.",
    receiver_role="child",
    receiver_name=api.name,
)

As models continue to improve, new invocation patterns over tool calls and sub-agents will emerge. We expect future generations of models to rely less on hand-holding prompts and more on this kind of direct, programmatic control.

Orchestration and Multi-Agent Communication

The background daemon manages all live Prime Agent sessions. Prime Agent also enables Agent-to-Agent (A2A) messaging through the daemon, letting any Prime Agent session message any other Prime Agent session using the same mechanism used for messaging persistent sub-agents. This allows for easy orchestration to manage the progress of sub-agent swarms and communication regarding shared resources directly between the affected agents. To prevent undesirable communication across independent sessions, multi-agent communication in Prime Agent is limited to its nuclear family , meaning parent, sibling, or child processes.

handle = await rlm("Find what's wrong in this auth-flow. Reply to me with your findings.", name="auth-reviewer")



children = await rlm.list_subagents()
auth_child = next(c for c in children if c.session_name == "auth-reviewer")


await agent_message.send(
    "Follow up: identify the main edge cases and any likely bugs.",
    receiver_role="child",
    receiver_name=auth_child.session_name,
    mode="follow_up",
)

Prime Agent supports persistent sub-agents through its RLM-native runtime, meaning a sub-agent's own session directory, context, IPython kernel, and session history persist even after the initial sub-agent call has finished. Prime Agent can send further messages to continue a persistent sub-agent by accessing its unique session identifier, all from its IPython kernel.

Self-Improvement via the Continual Harness

Prime Agent's harness state lives in the persistent IPython kernel as rlm.harness, immediately readable and callable by the agent mid-task, and every change is also written to disk, so it survives across turns and across sessions. Continual Harness formalizes this state as H=(ρ,G,K,M)H=(\rho, G, K, M)H=(ρ,G,K,M), prompt, sub-agents, skills, and memory, refined online from the agent's own trajectory without resets.

Each of the four components exposes the same create, read, update, delete surface. create_prompt_note(...), create_memory(...), create_skill(...), and create_subagent(...) each add an entry of that kind, update_X(...) and delete_X(...) mirror them, and list(kind) or get(kind, id) read them back. Skills follow this same surface: authoring a Python-backed skill is a create_skill(...) call carrying a SKILL.md-style reference, the same operation as adding a memory or a prompt note.

rlm.harness.create_memory("flaky test pattern", "retry three times before failing")
rlm.harness.create_skill("retry helper", "...", reference={"type": "python", "import": "retry_helper"})


rlm.harness.list("memory")
rlm.harness.get("skill", "retry_helper")

/refine is the self-improving pipeline built on top of this CRUD surface. It reads the agent's own trajectory, the record of what was tried and what happened, and applies the smallest relevant CRUD edit that improves the harness toward better outcomes: updating a prompt note, memory, skill, or sub-agent spec, rather than rewriting the whole harness. Each refinement records its trigger and the outcome it produced, so improvement is evidence-backed rather than arbitrary. Refinement runs in two phases. Planning, the LLM call that proposes the edit, runs in the background and does not block the ongoing conversation. Applying the edit, writing to disk and rebuilding the system prompt, is fast and only briefly blocks at the next turn boundary. The agent can call refine.run() directly whenever it notices a repeated failure or a reusable tactic, not only on a fixed schedule.

await refine.run("promote the retry-on-flaky-test pattern to a skill")



await compact.status()   
await refine.status()    

The base system prompt remains immutable. /refine only edits the harness layer around it. Rollback is supported through prior refinement history, allowing a bad harness update to be reverted by ID.

Autonomous Mode for Evals

Prime Agent's eval mode combines three complementary mechanisms. A goal sets the overall objective: a persistent objective with an optional token budget that the harness keeps re-prompting the agent to pursue across turns, tracked until the agent explicitly calls goal.complete(). Heartbeats are scheduled cron-style messages injected into the session on a fixed interval, used for regular checks such as monitoring a sub-agent's progress or polling for a training update. Autonomous mode is the continuation mechanism itself, ensuring the agent keeps working toward the goal instead of stopping early once a turn produces no further output. Together, these let a session run unattended for extended periods while remaining bounded by an explicit budget and inspectable through the Agents View.

Autonomous mode is available directly from the CLI with --autonomous, no scripting required. A run can set a completion goal and a turn limit in the same command:

prime-agent \
  --autonomous \
  --autonomous-gate "npm run check" \
  --autonomous-max-turns 20 \
  "Implement and verify the requested change"

The gate command runs before the session is allowed to finish. A failed gate returns its bounded output to the agent for another attempt, and Prime Agent skips rerunning a failed gate when the workspace has not changed since the last attempt. --autonomous-max-turns, --autonomous-max-tokens, and --autonomous-timeout-ms bound continuations, tokens, and wall-clock time respectively.

Evaluating Prime Agent

Prime Agent serves as both a coding agent to be used, and a harness design to be evaluated for research. We make special note that while many modern frontier models are trained around a specific harness, currently no model has been trained around Prime Agent or its core feature set.

ARC-AGI 3. ARC-AGI 3 is a popular intelligence benchmark that measures the ability of an agent to perform symbolic reasoning and learn the rules of simulated worlds. We evaluate Prime Agent with autonomous mode over several different frontier models, and compare to their native harnesses. Prime Agent was developed as a CLI coding agent, so the only ARC AGI 3 specific changes are to the task prompt, inspired by the standard prompt setup used in PRO-LONG.

Our best results use Opus 5 in Prime Agent to achieve 95.5% RHAE Best@1 , which surpasses the ARC reported human expert baseline of 95.4%. Across three runs, we find that Prime Agent consistently performs well [95.0, 95.2, 95.5] and 99.97% Best@3 with all 183/183 levels complete. Our median score card action replay (95.2%) for ARC-AGI-3 can be found here.

ARC-AGI-3: (left) test-time compute scaling: score vs. output tokens per game. (right) cost scaling: score vs. estimated API cost.

In addition to achieving a higher maximum score over each model's native harness, we find that Prime Agent also does so at a lower overall token usage. Prime Agent saves tokens by programmatically running functions over data rather than spending tokens reading data using tools.

Finally, we note that we evaluated Opus 5 and GPT-5.6 Sol with Claude Code and Codex respectively, and found worse overall performance relative to the official results, so we yield to their official reported numbers instead.

Long context and long-running tasks

Many difficult tasks in the wild reduce to long context tasks. Our goal is to show that Prime-Agent with open-weights models are a competitive alternative to closed models and harnesses, both as a general agent to be used, and as a baseline harness to be evaluated.

Below, we select a suite of common long-context benchmarks across coding, retrieval, and general long reasoning tasks, and compare Prime Agent to several different popular harnesses. We offload the main context in each harness to a file in memory to start. For closed model harnesses, we use their associated models (i.e., Codex with GPT, Claude Code with Opus) while for Prime-Agent and Pi-mono (with sub-agents), we choose an open-weights model in GLM-5.2.

| GLM-5.2 (high)| Opus 5 (high)| GPT-5.6 Sol (high)
---|---|---|---
Eval| Prime-Agent| Pi-mono (w/ sub-agents)| Prime-Agent| Claude Code| Prime-Agent| Codex
OOLONG (yahoo, 128k)
long context| 0.700| 0.420| 0.900| 0.920| 0.940| 0.500
OOLONG-Pairs
long output| 0.874| 0.556| 0.929| 0.922| 0.911| 0.895
OBLIQ-Bench (math)
long ranking [ndcg@10]| 0.669| 0.635| 0.802| 0.795| 0.612| 0.646
LongBenchPro (English)
long comprehension| 0.777| 0.768| 0.804| 0.790| 0.794| 0.790
LongBenchv2
expert annotated long tasks| 0.680| 0.696| 0.744| 0.746| 0.714| 0.704
ManyIH Coding
long instructions| 0.424| 0.386| 0.536| 0.522| 0.499| 0.454
ManyIH IF
long instructions| 0.209| 0.164| 0.225| 0.175| 0.216| 0.232
LongCot-Mini
long reasoning| 0.638| 0.613| 0.722| 0.558| 0.671| 0.681
EmulatorBench
long coding| 0.208| 0.000| 0.047*| 0.062*| 0.275| 0.228

We generally find Prime Agent to be competitive across a wide range of long tasks, especially against the harness that did not use a model trained around it. Prime Agent especially excels at long-running or long-context tasks, and can competitively run on its own as an autonomous agent. We include a set of focused case studies and experiments on long settings where Prime Agent excels.

Creating emulators from scratch. An emulator is software that reproduces another computer system's observable behavior. We evaluate Prime Agent on EmulatorBench , a preview benchmark that tasks agents with constructing emulators in Rust for a variety of game systems. Agents are given a specification of the emulator and a set of diagnostic tests in the form of a verifier.

The correctness of an emulator is given from its ability to mimic the behavior of the target machine. This is measured by human-generated diagnostic programs that inspect the emulator's behavior, such as the CPU flags, PPU timing, and other components. In an effort to minimize the effects of data contamination, we require the agent to build the emulator from scratch in Rust, sandboxed without any reference implementation. We report preliminary results on this long-context coding benchmark averaged over 16 emulator reconstructions, as well as two emulators, the SEGA Genesis and Nintendo Game Boy Color, that Prime Agent successfully reproduces. For Opus, our runs surprisingly failed to solve the tasks despite successful tool-call responses.

EmulatorBench: Score vs. Cost on creating (left) Sega Genesis emulator and (right) Game Boy Color emulator.

Writing GPU kernels. Writing performant GPU kernels is an iterative process that requires repeatedly verifying, profiling, and tweaking code to get correct. We evaluate Prime Agent as a harness for GPU kernel writing on the recently released PMPP-Hard benchmark, a suite of tasks where agents must write performant GPU kernels that pass a suite of correctness checks against KernelGuard, the verification tool used for the official GPU MODE kernel leaderboard.

PMPP-Hard benchmark results for Prime Agent

A long-horizon case study on games

Autonomously playing video games has become an interesting case study for models and harnesses in how they handle long-horizon decision making. Games often require harnesses to balance information and context across millions of tokens, while also leveraging this information to efficiently take actions and avoid catastrophic states.

Factorio. Factorio is a 2D factory simulation game where agents must mine resources, research technology, and build automated factories to increase the production of these resources. The Factorio Learning Environment (FLE) is an interface for simplifying the observation and action space of an LLM playing Factorio, which we use to connect Prime Agent to the game.

The action and observation space of FLE is a module in Python that is accessed programmatically at every turn. This integrates directly into Prime Agent's IPython kernel. To leverage PTC for sub-agents, we launch four controllable characters in the game.

Prime Agent playing Factorio with four controllable charactersPrime Agent using subagents and programmatic tool calling to cheat on Factorio by teleporting resources directly into machines.

The primary metric in FLE is production score, which is a weighted average of all materials the agent produces. Prime Agent successfully leveraged /refine to turn failures and successes into memories and skills, respectively. It used its own accumulated experience to design increasingly efficient machine layouts, raising the production score run over run. This allowed Prime Agent to efficiently score in the 100K+ range in production score in a matter of hours.

However, we also observed instances of reward hacking by Prime Agent in FLE. Prime Agent discovered it could bypass Factorio's rules entirely by spawning in resources directly into its assembly machines through RCON commands, even with an explicit heartbeat prompt to remind Prime Agent not to cheat in Factorio. Once it found this exploit, the same refinement loop that had been building legitimate skills turned to building efficient cheating skills instead.

MazeBench. MazeBench is an open-world 3D spatial reasoning environment where the player controls a 3D cube and must solve puzzle rooms within a global maze, while collecting gems. Frontier models are shown to greatly struggle on this task, expending billions of tokens to solve only a fraction of the overall world. We compare Opus 5 and GPT-5.6 Sol with Prime Agent versus their native harnesses, as well as GLM-5.2 with Claude Code. Following the benchmark metrics, we report the unique number of rooms they find, the unique number of states, and the total number of gems, all as a function of their overall token spend.

MazeBench results: rooms, states, and gems as a function of token spend

Next Steps

Prime Agent is a new paradigm on the design of agent harnesses. Despite strong results over other harnesses, we still notice friction when running Prime Agent with models. This implies that there are huge performance gains still available from training with Prime Agent directly around this harness paradigm, or even the individual RLM and Continual Harness components.

We strongly believe that model-harness co-learning is the dominant paradigm to unlock new capabilities. Many features of Prime Agent are not fully utilized without a trained model, and we believe there are huge performance gains still available from training with the harness directly. We are excited to bring you these new capabilities, all in the open.

We will have a full technical report with further details soon.

Acknowledgements

Prime Agent is built on top of pi. We thank the authors of pi for their valuable work.

Citation

@article{primeintellect2026primeagent,
author = {Seth Karten and Alex L. Zhang and Kevin Thomas and Sebastian Müller and Prime Intellect Team},
title = {Prime Agent: A Self-Improving RLM Harness},
journal = {Prime Intellect Blog},
year = {2026},
month = {August},
note = {https://www.primeintellect.ai/blog/prime-agent}
}