Pi is a set of open-source agent building blocks for developers who want to own their tooling. Instead of a single monolithic assistant, it gives you a stable core loop plus a collection of swappable peripherals — models, tools, UIs and extensions. You write the tools and the prompt; Pi drives the loop, calls the model, runs your tools, and records everything in a transparent session tree you can replay and audit. The result is an agent you can read, modify, extend and self-host without asking anyone for permission.
Install Pi
Clone, install safely, and run the coding agent locally in about five minutes.
# 1. Get the source git clone https://github.com/earendil-works/pi.git cd pi # 2. Install deps safely (pinned, scripts disabled) npm install --ignore-scripts # 3. Build all packages npm run build # 4. Launch the interactive coding agent ./pi-test.sh
pi-ai — see Model providers.
Want the full steps and a minimal agent loop example? Head to Quick Start.
Why Pi
Not another black-box assistant, but an agent runtime you can read, modify and extend.
Most "AI assistants" hide their internals and lock you into a vendor. Pi inverts that: the loop is small and stable, and everything around it is a replaceable part. That is why a single codebase can power a terminal tool, an SDK and a remote agent at once.
Stable core, mutable peripherals
Models, tools, UIs change — but the agent loop is stable: prepare context → call model → handle tools → write back → continue or stop. You upgrade the outside without rewriting the inside.
Unified multi-vendor LLM
pi-ai hides the differences between OpenAI / Anthropic / Google / Bedrock / Vertex / Copilot. Switch vendors with one line and keep your tooling unchanged.
Tools + state management
pi-agent-core ships tool calling and a session state machine, with a JSONL session tree, branches and resumable runs you can pick up later.
Interactive coding CLI
pi-coding-agent is a pair-programmer in your terminal: read the repo, edit files, run commands, self-correct, and show you a diff before writing.
Differential-render terminal UI
pi-tui only repaints what changed, staying smooth even in very long sessions where a naive terminal would stutter.
Supply-chain hardening
Pinned dependencies, lockfile as source of truth, isolated testing, and runs with the launching user's permissions by default — plus --ignore-scripts installs.
Four core packages
An npm workspaces monorepo — use one package or install the whole thing.
@earendil-works/pi-ai
A unified multi-vendor LLM API with streaming, tool calling and a provider factory. One interface covers OpenAI, Anthropic, Google, Bedrock, Vertex and Copilot, so swapping providers never touches your business code.
Unified LLM@earendil-works/pi-agent-core
The agent runtime with tool calling and state management — the heart of Pi. It owns the session, the tool dispatch and the resumable run loop that everything else builds on.
Agent runtime@earendil-works/pi-coding-agent
An interactive coding-agent command line tool for developers. Point it at a repo and it reads, edits, runs commands and self-corrects like a pair programmer in your terminal.
Coding CLI@earendil-works/pi-tui
A terminal UI library with differential rendering that stays fluid on long output. It repaints only what changed, keeping the interface responsive through very long sessions.
Terminal UIHow a request flows
Clear layer boundaries, so each layer can be replaced and tested independently.
A user or external system submits a prompt through the terminal UI, remote call or SDK.
Expands skills and templates, checks model and auth, hands messages to the Agent Loop, and streams events back to the UI.
The stable loop: call the model, run tools, write back results, until a final answer or stop.
Who is Pi for
Pi fits teams that care about control, cost and longevity.
- Platform & infra engineers who need an agent they can self-host, audit and run inside their own sandbox instead of sending code to a third party.
- Product builders who want to embed a coding agent into their own app via the SDK, swapping the model per customer or per region.
- Researchers & hobbyists who want to experiment with tools and prompts locally, using MockModel so experiments cost nothing.
- Anyone comparing options — read our Pi vs Aider / Claude Code / OpenHands breakdown before committing to a tool.
Up and running in five minutes
Clone, install, launch — details in Quick Start.