Prime Agent: A self-improving RLM agent

Aug 06, 2026 04:11 AM - 5 hours ago 1

Today, we are launching Prime Agent, our self-improving coding harness designed astir 2 abstractions, the Recursive Language Model (RLM) [citation] and Continual Harness [citation]. Modern harness designs were built astir the capabilities of earlier generations of models, and they do not bespeak what frontier models tin do today: fixed tool-calling schemas and discourse compaction unit the exemplary to activity astir its ain scaffolding alternatively of leveraging it. Static, hand-engineered sub-agents, prompts, skills, and representation are group erstwhile astatine creation clip and ne'er accommodate to what the supplier learns while running. We judge that harnesses should alternatively extrapolate connected existent exemplary capabilities toward the adjacent frontier of reasoning patterns.

Prime Agent is built astir this rule done 2 main abstractions:

  1. The Recursive Language Model (RLM) treats discourse arsenic a adaptable and subagent delegation arsenic usability calls wrong a REPL. The persistent REPL gives the exemplary programmatic entree to its history, sub-agents, and tools, allowing it to constitute connection exemplary programs arsenic actions complete its ain context. This creation allows the supplier to process arbitrarily agelong sessions without losing entree to its ain past accusation stored successful variables.
  2. Continual Harness treats the harness's ain state, abstracted arsenic its prompts, skills, memory, and sub-agents, arsenic thing the supplier tin create, read, update, and delete (CRUD) from its ain trajectory. When mixed pinch agent-to-agent communication, this system enables orchestration crossed sub-agents and moreover crossed Prime Agent sessions. For example, Prime Agent tin spawn persistent sub-agents, connection them later successful the trajectory, and pass straight pinch a different Prime Agent session.

These abstractions are powerful for bootstrapping exemplary capabilities. Prime Agent is built to beryllium effective arsenic a wide coding assistant, arsenic a default runtime for long-horizon autonomous evaluation, and arsenic a collaborator for investigation and autoresearch.

Prime Agent is afloat open-source, and tin beryllium installed via:

curl -fsSL https://app.primeintellect.ai/prime-agent/install.sh | sh
Prime Agent onboarding scatter screen

Prime Agent

The capacity of supplier harnesses are tied to some the creation of the harness and the capacity of the exemplary trained astir the harness. We designed Prime Agent to beryllium instantly usable pinch modern unfastened and closed frontier models, while besides providing a characteristic group that we expect to supply further capacity gains arsenic newer generations of models are trained astir it.

At its core, Prime Agent is designed astir programmatic instrumentality and sub-agent calling. Models successful Prime Agent usage a persistent IPython kernel arsenic their only tool. Other modular harness features are called arsenic functions successful the kernel, including sub-agents, which are each implemented arsenic different prime-agent instance.

Prime Agent's Architecture

Prime Agent architecture diagramRLM and Continual Harness are the 2 halfway abstractions; sub-agent CRUD positive Agent2Agent messaging constitute them into orchestration.

Background Daemon and Agents View. The default position is simply a text-user interface (TUI) akin to different coding supplier harnesses. By default, IPython actions made by the supplier are condensed for brevity, but tin beryllium expanded to position actions made by the harness. Sub-agents launched successful the REPL tin besides beryllium accessed beneath the personification chatbox.

Prime Agent matter personification interface

Prime Agent runs a inheritance daemon that owns each unrecorded supplier sessions complete a section socket. You tin connect and detach from the convention without affecting the underlying supplier loop. Each guidelines convention character runs successful a recoverable worker process; if a worker crashes, the daemon recovers it from the convention JSONL and kernel authorities snapshot.

The Agents View allows you to spot and prime different unrecorded sessions from the daemon. It tin beryllium opened by pressing the Left Arrow cardinal (←) connected an quiet prompt, and lists sessions that are presently running, idle sessions pinch the daemon still active, and inactive sessions that are presently not loaded successful memory. Any of these chats tin instantly beryllium entered and interacted with, and pressing abstraction allows users to chat pinch a convention successful immoderate state, including steering and queuing of prompts and commands specified arsenic /compact.

The Agents View is constructed arsenic the cardinal connecting constituent betwixt agents and subagents, recursively. Any supplier is discoverable successful an Agents View. Users navigate from an Agents View into an agent's chat, past into the Agents View of its subagents, into a subagent chat, and truthful on.

Because subagents stock the aforesaid Running-Idle-Inactive authorities instrumentality arsenic the guidelines agents, they tin beryllium removed from representation aft 30 minutes of inactivity, and the infinitesimal a personification aliases supplier addresses immoderate of them, they are reloaded from disk. In highly nested chats, this tin prevention a batch of memory.

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

Session and Context Management. The full convention history of the supplier is stored arsenic append-only JSONL files connected disk. Each statement is simply a JSON entry, which tin see messages, exemplary switches, compaction summaries, aliases hold entries. Branching, forking, and cloning each hap wrong the aforesaid record by moving the leafage pointer. The afloat history is ever recoverable done /tree.

Compaction happens erstwhile the discourse hits a period aliases straight by the supplier successful the REPL pinch compact.run(). Compaction is chiefly utilized to cleanable the main discourse of the agent, but the afloat history, including past compactions, tin beryllium accessed programmatically successful the IPython kernel erstwhile needed.

The preamble of the REPL requires further activity to negociate the IPython state. We asynchronously compact and cleanable the kernel simultaneously, utilizing a spawned supplier to enactment arsenic a garbage collector. This is basal to debar REPL representation built up for each agent.

RLM and Programmatic Tool-Calling (PTC)

Prime Agent relies connected the IPython kernel arsenic its REPL that persists complete the session, which it tin invoke each turn. On initialization, the kernel pre-imports each accomplishment / instrumentality arsenic a module, including the rlm for recursive programmatic sub-agent calling.

The rlm is an asynchronous function, meaning the exemplary tin freely invoke and parallelize sub-agent calls successful code. Spawning a subagent (e.g. await rlm("sub-task")) launches a afloat convention pinch its ain model, IPython kernel, convention tree, and speech history. It returns immediately, because each consequent connection betwixt agents happens done the agent_message.send(...) tool.

There are respective useful primitives that Prime Agent tin take to motorboat successful this way, specified arsenic fanning retired sub-agents successful parallel, aliases launching inheritance work.

auth = await rlm("Summarize the authentication travel successful auth/. Reply to maine erstwhile done.", name="auth-expert") api = await rlm("Summarize the updated HTTP API furniture successful src/. Reply to maine erstwhile done.", name="http-expert") await agent_message.send( "Also screen middleware correction handling.", receiver_role="child", receiver_name=api.name, )

As models proceed to improve, caller invocation patterns complete instrumentality calls and sub-agents will emerge. We expect early generations of models to trust little connected hand-holding prompts and much connected this benignant of direct, programmatic control.

Orchestration and Multi-Agent Communication

The inheritance daemon manages each unrecorded Prime Agent sessions. Prime Agent besides enables Agent-to-Agent (A2A) messaging done the daemon, letting immoderate Prime Agent convention connection immoderate different Prime Agent convention utilizing the aforesaid system utilized for messaging persistent sub-agents. This allows for easy orchestration to negociate the advancement of sub-agent swarms and connection regarding shared resources straight betwixt the affected agents. To forestall undesirable connection crossed independent sessions, multi-agent connection successful Prime Agent is constricted to its nuclear family, meaning parent, sibling, aliases kid processes.

handle = await rlm("Find what's incorrect successful this auth-flow. Reply to maine pinch 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: place the main separator cases and immoderate apt bugs.", receiver_role="child", receiver_name=auth_child.session_name, mode="follow_up", )

Prime Agent supports persistent sub-agents done its RLM-native runtime, meaning a sub-agent's ain convention directory, context, IPython kernel, and convention history persist moreover aft the first sub-agent telephone has finished. Prime Agent tin nonstop further messages to proceed a persistent sub-agent by accessing its unsocial convention identifier, each from its IPython kernel.

Self-Improvement via the Continual Harness

Prime Agent's harness authorities lives successful the persistent IPython kernel arsenic rlm.harness, instantly readable and callable by the supplier mid-task, and each alteration is besides written to disk, truthful it survives crossed turns and crossed sessions. Continual Harness formalizes this authorities arsenic H=(ρ,G,K,M)H=(\rho, G, K, M), prompt, sub-agents, skills, and memory, refined online from the agent's ain trajectory without resets.

Each of the 4 components exposes the aforesaid create, read, update, delete surface. create_prompt_note(...), create_memory(...), create_skill(...), and create_subagent(...) each adhd an introduction of that kind, update_X(...) and delete_X(...) reflector them, and list(kind) aliases get(kind, id) publication them back. Skills travel this aforesaid surface: authoring a Python-backed accomplishment is simply a create_skill(...) telephone carrying a SKILL.md-style reference, the aforesaid cognition arsenic adding a representation aliases a punctual note.

rlm.harness.create_memory("flaky trial pattern", "retry 3 times earlier 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 connected apical of this CRUD surface. It sounds the agent's ain trajectory, the grounds of what was tried and what happened, and applies the smallest applicable CRUD edit that improves the harness toward amended outcomes: updating a punctual note, memory, skill, aliases sub-agent spec, alternatively than rewriting the full harness. Each refinement records its trigger and the result it produced, truthful betterment is evidence-backed alternatively than arbitrary. Refinement runs successful 2 phases. Planning, the LLM telephone that proposes the edit, runs successful the inheritance and does not artifact the ongoing conversation. Applying the edit, penning to disk and rebuilding the strategy prompt, is accelerated and only concisely blocks astatine the adjacent move boundary. The supplier tin telephone refine.run() straight whenever it notices a repeated nonaccomplishment aliases a reusable tactic, not only connected a fixed schedule.

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

The guidelines strategy punctual remains immutable. /refine only edits the harness furniture astir it. Rollback is supported done anterior refinement history, allowing a bad harness update to beryllium reverted by ID.

Autonomous Mode for Evals

Prime Agent's eval mode combines 3 complementary mechanisms. A extremity sets the wide objective: a persistent nonsubjective pinch an optional token fund that the harness keeps re-prompting the supplier to prosecute crossed turns, tracked until the supplier explicitly calls goal.complete(). Heartbeats are scheduled cron-style messages injected into the convention connected a fixed interval, utilized for regular checks specified arsenic monitoring a sub-agent's advancement aliases polling for a training update. Autonomous mode is the continuation system itself, ensuring the supplier keeps moving toward the extremity alternatively of stopping early erstwhile a move produces nary further output. Together, these fto a convention tally unattended for extended periods while remaining bounded by an definitive fund and inspectable done the Agents View.

Autonomous mode is disposable straight from the CLI pinch --autonomous, nary scripting required. A tally tin group a completion extremity and a move limit successful the aforesaid command:

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

The gross bid runs earlier the convention is allowed to finish. A grounded gross returns its bounded output to the supplier for different attempt, and Prime Agent skips rerunning a grounded gross erstwhile the workspace has not changed since the past attempt. --autonomous-max-turns, --autonomous-max-tokens, and --autonomous-timeout-ms bound continuations, tokens, and wall-clock clip respectively.

Evaluating Prime Agent

Prime Agent serves arsenic some a coding supplier to beryllium used, and a harness creation to beryllium evaluated for research. We make typical statement that while galore modern frontier models are trained astir a circumstantial harness, presently nary exemplary has been trained astir Prime Agent aliases its halfway characteristic set.

ARC-AGI 3. ARC-AGI 3 is simply a celebrated intelligence benchmark that measures the expertise of an supplier to execute symbolic reasoning and study the rules of simulated worlds. We measure Prime Agent pinch autonomous mode complete respective different frontier models, and comparison to their autochthonal harnesses. Prime Agent was developed arsenic a CLI coding agent, truthful the only ARC AGI 3 circumstantial changes are to the task prompt, inspired by the modular punctual setup utilized successful PRO-LONG.

Our champion results usage Opus 5 successful Prime Agent to execute 95.5% RHAE Best@1, which surpasses the ARC reported quality master baseline of 95.4%. Across 3 runs, we find that Prime Agent consistently performs good [95.0, 95.2, 95.5] and 99.97% Best@3 pinch each 183/183 levels complete. Our median people paper action replay (95.2%) for ARC-AGI-3 tin beryllium recovered here.

 people vs. output tokens per game people vs. estimated API cost

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

In summation to achieving a higher maximum people complete each model's autochthonal harness, we find that Prime Agent besides does truthful astatine a little wide token usage. Prime Agent saves tokens by programmatically moving functions complete information alternatively than spending tokens reference information utilizing tools.

Finally, we statement that we evaluated Opus 5 and GPT-5.6 Sol pinch Claude Code and Codex respectively, and recovered worse wide capacity comparative to the charismatic results, truthful we output to their charismatic reported numbers instead.

Long discourse and long-running tasks

Many difficult tasks successful the chaotic trim to agelong discourse tasks. Our extremity is to show that Prime-Agent pinch open-weights models are a competitory replacement to closed models and harnesses, some arsenic a wide supplier to beryllium used, and arsenic a baseline harness to beryllium evaluated.

Below, we prime a suite of communal long-context benchmarks crossed coding, retrieval, and wide agelong reasoning tasks, and comparison Prime Agent to respective different celebrated harnesses. We offload the main discourse successful each harness to a record successful representation to start. For closed exemplary harnesses, we usage their associated models (i.e., Codex pinch GPT, Claude Code pinch Opus) while for Prime-Agent and Pi-mono (with sub-agents), we take an open-weights exemplary successful GLM-5.2.

GLM-5.2 (high)Opus 5 (high)GPT-5.6 Sol (high)EvalPrime-AgentPi-mono (w/ sub-agents)Prime-AgentClaude CodePrime-AgentCodex
OOLONG (yahoo, 128k)
long context
0.7000.4200.9000.9200.9400.500
OOLONG-Pairs
long output
0.8740.5560.9290.9220.9110.895
OBLIQ-Bench (math)
long ranking [ndcg@10]
0.6690.6350.8020.7950.6120.646
LongBenchPro (English)
long comprehension
0.7770.7680.8040.7900.7940.790
LongBenchv2
expert annotated agelong tasks
0.6800.6960.7440.7460.7140.704
ManyIH Coding
long instructions
0.4240.3860.5360.5220.4990.454
ManyIH IF
long instructions
0.2090.1640.2250.1750.2160.232
LongCot-Mini
long reasoning
0.6380.6130.7220.5580.6710.681
EmulatorBench
long coding
0.2080.0000.047*0.062*0.2750.228

We mostly find Prime Agent to beryllium competitory crossed a wide scope of agelong tasks, particularly against the harness that did not usage a exemplary trained astir it. Prime Agent particularly excels astatine long-running aliases long-context tasks, and tin competitively tally connected its ain arsenic an autonomous agent. We see a group of focused lawsuit studies and experiments connected agelong settings wherever Prime Agent excels.

Creating emulators from scratch. An emulator is package that reproduces different machine system's observable behavior. We measure Prime Agent connected EmulatorBench, a preview benchmark that tasks agents pinch constructing emulators successful Rust for a assortment of crippled systems. Agents are fixed a specification of the emulator and a group of diagnostic tests successful the shape of a verifier.

The correctness of an emulator is fixed from its expertise to mimic the behaviour of the target machine. This is measured by human-generated diagnostic programs that inspect the emulator's behavior, specified arsenic the CPU flags, PPU timing, and different components. In an effort to minimize the effects of information contamination, we require the supplier to build the emulator from scratch successful Rust, sandboxed without immoderate reference implementation. We study preliminary results connected this long-context coding benchmark averaged complete 16 emulator reconstructions, arsenic good arsenic 2 emulators, the SEGA Genesis and Nintendo Game Boy Color, that Prime Agent successfully reproduces. For Opus, our runs amazingly grounded to lick the tasks contempt successful tool-call responses.

 people vs. costs connected creating a Sega Genesis emulator people vs. costs connected creating a Game Boy Color emulator

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

Writing GPU kernels. Writing performant GPU kernels is an iterative process that requires many times verifying, profiling, and tweaking codification to get correct. We measure Prime Agent arsenic a harness for GPU kernel penning connected the precocious released PMPP-Hard benchmark, a suite of tasks wherever agents must constitute performant GPU kernels that walk a suite of correctness checks against KernelGuard, the verification instrumentality utilized for the charismatic GPU MODE kernel leaderboard.

PMPP-Hard benchmark results for Prime Agent

A long-horizon lawsuit study connected games

Autonomously playing video games has go an absorbing lawsuit study for models and harnesses successful really they grip long-horizon determination making. Games often require harnesses to equilibrium accusation and discourse crossed millions of tokens, while besides leveraging this accusation to efficiently return actions and debar catastrophic states.

Factorio. Factorio is simply a 2D mill simulation crippled wherever agents must excavation resources, investigation technology, and build automated factories to summation the accumulation of these resources. The Factorio Learning Environment (FLE) is an interface for simplifying the study and action abstraction of an LLM playing Factorio, which we usage to link Prime Agent to the game.

The action and study abstraction of FLE is simply a module successful Python that is accessed programmatically astatine each turn. This integrates straight into Prime Agent's IPython kernel. To leverage PTC for sub-agents, we motorboat 4 controllable characters successful the game.

Prime Agent playing Factorio pinch 4 controllable charactersPrime Agent utilizing subagents and programmatic instrumentality calling to cheat connected Factorio by teleporting resources straight into machines.

The superior metric successful FLE is accumulation score, which is simply a weighted mean of each materials the supplier produces. Prime Agent successfully leveraged /refine to move failures and successes into memories and skills, respectively. It utilized its ain accumulated acquisition to creation progressively businesslike instrumentality layouts, raising the accumulation people tally complete run. This allowed Prime Agent to efficiently people successful the 100K+ scope successful accumulation people successful a matter of hours.

However, we besides observed instances of reward hacking by Prime Agent successful FLE. Prime Agent discovered it could bypass Factorio's rules wholly by spawning successful resources straight into its assembly machines done RCON commands, moreover pinch an definitive heartbeat punctual to punctual Prime Agent not to cheat successful Factorio. Once it recovered this exploit, the aforesaid refinement loop that had been building morganatic skills turned to building businesslike cheating skills instead.

MazeBench. MazeBench is an open-world 3D spatial reasoning situation wherever the subordinate controls a 3D cube and must lick puzzle rooms wrong a world maze, while collecting gems. Frontier models are shown to greatly struggle connected this task, expending billions of tokens to lick only a fraction of the wide world. We comparison Opus 5 and GPT-5.6 Sol pinch Prime Agent versus their autochthonal harnesses, arsenic good arsenic GLM-5.2 pinch Claude Code. Following the benchmark metrics, we study the unsocial number of rooms they find, the unsocial number of states, and the full number of gems, each arsenic a usability of their wide token spend.

 rooms, states, and gems arsenic a usability of token spend

Next Steps

Prime Agent is simply a caller paradigm connected the creation of supplier harnesses. Despite beardown results complete different harnesses, we still announcement clash erstwhile moving Prime Agent pinch models. This implies that location are immense capacity gains still disposable from training pinch Prime Agent straight astir this harness paradigm, aliases moreover the individual RLM and Continual Harness components.

We powerfully judge that model-harness co-learning is the ascendant paradigm to unlock caller capabilities. Many features of Prime Agent are not afloat utilized without a trained model, and we judge location are immense capacity gains still disposable from training pinch the harness directly. We are excited to bring you these caller capabilities, each successful the open.

We will person a afloat method study pinch further specifications soon.

Acknowledgements

Prime Agent is built connected apical of pi. We convey 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} }
More