Overview
The Argent-native runtime is ArgentOS’s replacement for the upstream Pi Mono agent framework (@mariozechner/pi-*). Pi Mono’s creator joined OpenAI, making continued dependency on the upstream packages a strategic risk. The Argent runtime provides equivalent functionality with a cleaner architecture, native SIS lesson injection, and a multi-provider LLM layer.
The runtime consists of two complementary layers:
- argent-agent (
src/argent-agent/) — Agent loop, session management, tool execution, compaction, skills - argent-ai (
src/argent-ai/) — LLM provider implementations, model database, streaming, completion
compat.ts) enables gradual migration by wrapping Argent providers as Pi-compatible streamSimple functions.
argent-agent: Agent Runtime
Agent Class
The core turn executor that orchestrates:- Lesson injection via SIS — injects relevant lessons into the system prompt
- Provider calls — streaming or non-streaming LLM invocations
- Tool execution — processes tool calls from the LLM response
- Episode recording — captures structured episodes for contemplation
- History updates — appends turn results to session history
Session Manager
Append-only JSONL conversation storage with tree structure:- Tree-structured entries — each entry has
idandparentIdfor branching support - Append-only JSONL — durable, crash-safe format
- Built-in index — O(1) entry lookups (Pi rebuilds index on every access)
- Explicit compaction tracking — tracks first-kept-entry for clean compaction
- Format version 3 — session header, messages, thinking level changes, model changes
File Tools
Coding tools factory providing:read_file— Read file contentswrite_file— Write file contentsedit_file— Edit with diffbash— Execute shell commands
Skills
Skills loaded from.md files with YAML frontmatter:
argent-ai: LLM Layer
Provider Registry
Central registry for LLM providers. Each provider implements theProvider interface:
Provider Implementations
Seven providers insrc/argent-ai/providers/:
Models Database
Comprehensive model catalog with pricing, context windows, and capabilities:Compatibility Bridge
The bridge enables gradual migration from Pi to Argent by wrapping Argent providers as Pi-compatible functions.Thinking Level Resolution
Feature Flag
The Argent runtime is activated via theARGENT_RUNTIME=true environment variable:
ArgentSessionManager instead of Pi’s session manager.
SIS Integration
The Argent runtime includes native SIS (Self-Improving System) integration:- Lesson Injection — Selects relevant lessons and injects them into the system prompt before each turn
- Lesson Storage — Persists lessons extracted from agent episodes
- Confidence Scoring — Scores lesson relevance to the current context
Migration Status
The Argent runtime is live in production. Pi code remains in the codebase for fallback but the feature flag routes all traffic through the Argent runtime.
