What is it? Quick Start Concepts Architecture RLM Skills Sessions Providers
v0.7.0 MIT License

Prime Agent

An RLM-native terminal coding and research harness built around a persistent IPython kernel, recursive subagents, and a multi-process local runtime.

1 Built-in Tool
30+ Providers
Session Cap
MIT Open Source
Korean Guide on NotebookLM Prime Agent 한국어 가이드 — NotebookLM 인터랙티브 노트북
Scroll to explore

What is Prime Agent?

Prime Agent is a terminal-based AI coding and research harness that takes a fundamentally different approach: instead of giving the model dozens of separate tools, it gives it one — a persistent IPython kernel — and lets it compose everything as code.

Single-Tool Design

One built-in tool — ipython — replaces dozens of specialized tools. The model reads files, runs commands, edits code, and delegates work all through a persistent Python kernel.

Recursive Language Model

The model can spawn child agents natively via rlm() calls. Each child gets fresh context, inherits capabilities, and runs independently — enabling true parallel work.

Persistent State

Python state survives across turns and compaction. Variables, imports, functions, and parsed data remain available. Sessions persist as tree-structured JSONL files.

Multi-Process Runtime

A daemon-backed architecture isolates each session in its own process. Workers continue running after you close the terminal. Crash recovery is built-in.

Extensible Skills

Add capabilities via Agent Skills (markdown or Python-backed). MCP integrations, extensions, themes, and packages create a rich ecosystem without bloating the tool surface.

Built for Long Sessions

Heartbeats, scheduled prompts, persistent goals, autonomous mode, and automatic compaction make Prime Agent ideal for long-running, multi-step work.

Quick Start

From zero to a working Prime Agent session in under a minute.

1

Install

Install on Linux or macOS with a single command:

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

Authenticate

Use your subscription or set an API key:

bash
# Option A: Subscription login
prime-agent
/login

# Option B: API key
export ANTHROPIC_API_KEY=sk-ant-...
prime-agent
3

Start Working

Run it in your project and just start talking:

bash
cd /path/to/project
prime-agent
> Summarize this repo and tell me how to run its checks

The Python kernel runtime is set up automatically on first invocation. Set PRIME_AGENT_KERNEL_PYTHON to use an existing Python environment with ipykernel.

Core Concepts

The four foundational ideas that make Prime Agent different from every other coding agent.

Execution is Programmatic

Prime Agent's default runtime exposes one built-in model tool: ipython. Reading files, editing code, running commands, transforming data, invoking skills, and delegating work all begin from the persistent kernel — not from dozens of separate tool calls.

This means the model doesn't waste context switching between tools. Everything is Python. The model can inspect its environment, build helper functions, compose operations, and maintain working state — exactly like a human developer would in a notebook.

Model
ipython tool
IPython Kernel
Read files
Run commands
Edit code
Spawn agents
python
from pathlib import Path

# Python state persists across turns
config_files = list(Path(".").rglob("*.toml"))
large_files = [p for p in config_files if p.stat().st_size > 10_000]

# Run project commands
%%bash
npm run check

Subagents are Native RLM Calls

The callable rlm object is preloaded in the kernel. Spawn a child agent with a direct Python call. It returns immediately after task admission — never the child's answer.

The TypeScript host creates a normal child AgentSession with an independent context and session directory. The child inherits the parent's model, providers, skills, tools, and retry policy.

python
# Spawn independent children — end turn, don't await
api_review = await rlm("Review the public API", name="api-reviewer")
test_review = await rlm("Review the test coverage", name="test-reviewer")

# Children reply via agent_message when done
# Results arrive as ordinary messages in later turns

The parent keeps its context focused while children receive only the context needed for their subtasks. This is true parallel fan-out — not sequential tool calls.

State is Designed to Outlive One Turn

The RLM programming model assumes useful work may take many turns — or continue after the terminal UI closes:

  • Automatic compaction summarizes older context while preserving recent messages and kernel state
  • Daemon-backed workers keep sessions running after clients detach
  • Child registries and session artifacts make subagents recoverable
  • Heartbeats and scheduled prompts re-enter a session later
  • Persistent goals continue until the objective is complete
  • Autonomous mode adds bounded continuations with quality gates

Skills Add Programmatic Capability

Prime Agent supports the Agent Skills markdown format and extends it with Python-backed skills. Only skill metadata enters the startup prompt — the full SKILL.md loads on demand when a task matches.

A Python-backed skill installs a package into the kernel environment, so the model can import and call it directly — making Python-backed skills a superset of instruction-only skills.

python
# Call a Python-backed skill directly
report = await release_audit(repository=".", target_version="0.4.0")

Architecture

Prime Agent separates terminal presentation, process coordination, agent execution, model-facing Python, and persisted state. Click each layer to explore.

Client (TUI) Terminal · Print · JSON · RPC Daemon Supervisor routing · attachments · recovery Catalog Process Session Worker one root session tree runtime · scheduler Model Providers AgentSession provider · tools · compaction IPython Kernel model-facing Python Session Storage JSONL + artifacts RLM Child Agents independent sessions + optional kernels · recursive delegation

Click a component above to learn more

Each layer in Prime Agent has clear ownership boundaries. The client owns rendering, the supervisor owns routing, workers own sessions, and IPython is the model's control environment.

RLM Programming Model

Recursive Language Model (RLM) is the programming model at the heart of Prime Agent. The model works inside a persistent Python environment and composes capabilities as code.

IPython
Kernel
1 Parent Model Receives task + working context
2 Inspect & Transform Files · data · shell commands
3 Spawn Children rlm() calls for focused work
4 Compose Answer Synthesize results + continue

The Host Bridge

Python skills use typed host requests for capabilities whose authoritative state belongs outside the kernel. Provider calls, session persistence, child lifecycles, scheduling, and safety policy remain in the TypeScript host. IPython is purely the model-facing programming surface.

Python (Kernel)

  • rlm() — spawn child agents
  • goal — create/complete objectives
  • agent_message — family messaging
  • compact — context management
  • Working state & variables
host.request

TypeScript (Host)

  • Provider calls & streaming
  • Session persistence (JSONL)
  • Child lifecycle & depth limits
  • Usage & cost attribution
  • Credential management

Delegation Flow

When the model delegates work via await rlm("subtask"), the call travels through a Jupyter comm target to the TypeScript host, which creates a real child AgentSession.

1

Model calls rlm("subtask") in IPython

2

Python shim sends host.request via Jupyter comm

3

AgentSession checks depth, resolves model, admits child

4

Returns spawn handle immediately — never the answer

5

Child runs independently, replies via agent_message

Skills, Extensions & MCP

Prime Agent's extension model keeps the tool surface minimal while enabling unlimited capabilities through skills, extensions, and MCP integrations.

Markdown

Agent Skills

Self-contained capability packages following the Agent Skills standard. Each skill provides a SKILL.md with on-demand instructions, setup steps, and reference docs.

SKILL.md
---
name: my-skill
description: Use this skill when the user asks about X.
---

# My Skill
## Steps
1. Do this
2. Then that
Python

Python-Backed Skills

A superset of markdown skills with a Python package installed into the kernel. The model can import and call documented functions directly — typed callables, scripts, and dependencies included.

python
# Model calls it directly:
result = await my_skill.run(
    param="value"
)
help(my_skill)  # inspect API
TypeScript

Extensions

TypeScript modules that add custom tools, commands, keyboard shortcuts, event handlers, UI components, permission gates, custom compaction, and more.

typescript
export default function(api) {
  api.registerTool({
    name: "deploy",
    ...
  });
}
MCP

MCP Integrations

Connect external services (Linear, Notion, ...) over the Model Context Protocol. Each integration is a Python skill — not a new model tool — keeping the single-tool design intact.

python
import linear
issues = await linear.list_issues(
    team="Engineering"
)

Skill Discovery Locations

Global ~/.prime/agent/skills/ · ~/.agents/skills/
Project .prime/agent/skills/ · .agents/skills/
Package skills/ directories in Prime Agent packages
Built-in Shipped with prime-agent (lowest precedence)

Sessions & Branching

Prime Agent saves conversations as tree-structured JSONL files with in-place branching, compaction, and recovery.

Tree-Structured Sessions

Every entry has an id and parentId. Navigate to any previous point, continue from there, and switch between branches — all in a single file. No data is lost.

User: "Hello, can you help..."
AI: "Of course! I can..."
User: "Let's try approach A..."
AI: "For approach A..."
User: "What about approach B?"
AI: "Approach B is..."

Context Compaction

When conversations grow too long, compaction summarizes older messages while preserving recent work. The kernel state persists through compaction.

msg 1
msg 2
msg 3
[summary]
msg 4
msg 5
msg 6
Summarized Summary Retained

Session Commands

Powerful slash commands for managing your work:

/tree Navigate session tree
/fork Branch from any point
/clone Duplicate active branch
/compact Summarize old context
/resume Browse past sessions
/share Upload as gist

Long-Running Agents

Prime Agent combines daemon-backed workers with persistent state, scheduled prompts, direct messaging, goals, and bounded autonomous continuations.

Daemon-Backed Workers

Closing the terminal detaches the client — it doesn't stop the worker. Sessions continue running. Reconnect anytime with prime-agent attach.

Heartbeats

Recurring instructions that re-enter a session on a schedule. User-owned /heartbeat or agent-managed rlm_heartbeat.

Persistent Goals

Durable objectives that persist across turns until complete. Track token usage, elapsed time, and continuation count.

Autonomous Mode

Bounded host policy for unattended runs. Continues until quality gates pass or limits (turns, tokens, time) are reached.

Agent Messaging

The daemon routes messages between active sessions. Send from CLI: prime-agent send, or from kernel: agent_message.send().

Scheduled Prompts

One-time or cron-based prompts for any agent. Persisted per session, continue while detached. prime-agent schedule.

Providers & Models

Prime Agent supports 30+ providers through subscription login or API keys. Use any model from any supported provider.

Anthropic Claude Pro/Max
OpenAI ChatGPT Plus/Pro
GitHub Copilot
Anthropic
OpenAI
Prime Inference
Azure OpenAI
DeepSeek
Google Gemini
Google Vertex
Amazon Bedrock
Mistral
Groq
Cerebras
Cloudflare AI
xAI
OpenRouter
Vercel AI Gateway
ZAI
Hugging Face
Fireworks
Kimi
MiniMax
Xiaomi MiMo
+ more

CLI Quick Reference

Essential commands for working with Prime Agent.

Session Management

prime-agent Start interactive session
prime-agent -c Continue most recent
prime-agent -r [id] Resume or browse sessions
prime-agent -p "prompt" Print mode (one-shot)

Agent Control

prime-agent list List active agents
prime-agent attach <agent> Attach to agent
prime-agent stop <agent> Stop one agent
prime-agent shutdown Stop all agents

Model Options

--provider <name> Select provider
--model <pattern> Select model
--thinking <level> off/minimal/low/medium/high
/model Switch models interactively

Autonomous

--autonomous Enable autonomous mode
--autonomous-gate Quality gate command
--autonomous-max-turns Turn limit
/autonomous on Toggle interactively

Korean Resources

Prime Agent를 한국어로 더 깊이 알아볼 수 있는 추가 자료입니다.