pi-mono
pi-mono
Repo: badlogic/pi-mono
Role: The underlying agent library that OpenClaw wraps.
What it is
pi-mono is a TypeScript monorepo by Mario Zechner containing the core agent runtime. The primary package relevant to OpenClaw is @mariozechner/pi-agent (at packages/agent/), which exposes the agentLoop / agentLoopContinue API.
A second package, @mariozechner/pi-ai, provides the LLM streaming primitives (streamSimple, EventStream, Context, Message, etc.) that the agent loop calls.
Key packages
| Package | Path | Purpose |
|---|---|---|
@mariozechner/pi-agent |
packages/agent/ |
Agent loop, tool execution, event emission |
@mariozechner/pi-ai |
packages/ai/ |
LLM streaming, message types, tool validation |
Relationship to OpenClaw
OpenClaw calls runEmbeddedPiAgent, which builds a pi-agent session and calls agentLoop. OpenClaw's plugin hooks (before_tool_call, after_tool_call, transformContext, etc.) map directly to pi-mono's AgentLoopConfig callbacks. Event bridging from pi-mono → OpenClaw streams happens in subscribeEmbeddedPiSession.
Related
- OpenClaw — OpenClaw wraps pi-mono
- pi-mono Agent Loop — concept: the core loop
- Source - Agent Loop (pi-mono) — ingested source