Build and extend code with a self-improving agent harness
Self-extensible coding agent harness with a unified multi-provider LLM API and a terminal UI library.
0.85.1Add to Favorites
Why it matters
Pi Agent Harness enables developers to automate coding tasks through an interactive CLI agent that can generate, debug, test, and deploy code while managing tool calls, state, and multi-provider LLM integrations across OpenAI, Anthropic, and Google.
Outcomes
What it gets done
Generate and modify code interactively through a terminal UI with differential rendering
Call tools and manage agent state across multiple LLM providers with unified API
Containerize agent execution with Docker, micro-VMs, or sandboxes for permission control
Automate Slack workflows and chat integrations through the companion pi-chat package
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Overview
Pi
Pi Agent Harness is a self-extensible coding agent CLI and a set of reusable packages - a unified multi-provider LLM API, an agent runtime, and a terminal UI library - for building agent tooling. Use it as an interactive multi-provider coding agent, or as component packages for building custom agent tooling, adding your own sandboxing if stronger permission isolation is needed.
What it does
Pi Agent Harness is a monorepo for a self-extensible coding agent and its underlying packages: @earendil-works/pi-coding-agent (an interactive coding agent CLI), @earendil-works/pi-agent-core (an agent runtime with tool calling and state management), and @earendil-works/pi-ai (a unified multi-provider LLM API covering OpenAI, Anthropic, Google, and others). The repository also includes @earendil-works/chord (a standalone application-composition runtime for services, replicated state, RPC, and plugins), @earendil-works/pi-telemetry (vendor-neutral telemetry contracts and conformance tests), and @earendil-works/pi-tui (a terminal UI library with differential rendering). A separate project, pi-chat, handles Slack and chat automation workflows.
When to use - and when NOT to
Use Pi as a coding agent CLI when you want an interactive agent built on a unified LLM API that can switch between providers, or as component packages (agent runtime, LLM API, TUI library) for building your own agent tooling. Pi ships with no built-in permission system for restricting filesystem, process, network, or credential access - by default it runs with the full permissions of the user and process that launched it - so if stronger isolation is needed, it must be containerized or sandboxed separately, via a Gondolin extension (routing built-in tools and ! commands into a local Linux micro-VM while keeping pi and provider auth on the host), plain Docker, or OpenShell (a policy-controlled sandbox).
Inputs and outputs
npm install --ignore-scripts
npm run build
npm run build:offline rebuilds using existing model data without network access; npm run check runs lint, format, and type checking; ./test.sh runs the test suite, skipping LLM-dependent tests when no API keys are set; ./pi-test.sh runs Pi from source from any directory. Standalone binaries can be built from a release's versioned source archive (verified against its SHA256SUMS) with ./scripts/build-binaries.sh --offline-model-data --platform linux-x64 --out "$PWD/out", using the bundled release model data instead of refreshing provider catalogs.
Integrations
Supply-chain hardening treats dependency changes as reviewed code: direct external dependencies are pinned to exact versions via .npmrc's save-exact=true and a min-release-age=2 day buffer, package-lock.json is the dependency ground truth (pre-commit blocks accidental lockfile edits), the published CLI ships an npm-shrinkwrap generated from the root lockfile, and CI runs npm ci --ignore-scripts plus scheduled npm audit and npm audit signatures checks. Users can publish their own coding-agent sessions publicly via the companion tool badlogic/pi-share-hf to a Hugging Face dataset, to help improve coding agents on real-world tasks rather than toy benchmarks. Licensed under MIT.
Who it's for
Developers who want an interactive, multi-provider coding agent CLI, or who are building their own agent tooling and want reusable components for LLM provider abstraction, agent runtime state, or a terminal UI.
Source README
New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See CONTRIBUTING.md.
Pi Agent Harness
This is the home of the Pi agent harness project including our self extensible coding agent.
- @earendil-works/pi-coding-agent: Interactive coding agent CLI
- @earendil-works/pi-agent-core: Agent runtime with tool calling and state management
- @earendil-works/pi-ai: Unified multi-provider LLM API (OpenAI, Anthropic, Google, …)
To learn more about Pi:
- Visit pi.dev, the project website with demos
- Read the documentation, but you can also ask the agent to explain itself
All Packages
| Package | Description |
|---|---|
| @earendil-works/chord | Standalone application-composition runtime for services, replicated state, RPC, and plugins |
| @earendil-works/pi-telemetry | Vendor-neutral telemetry contracts, reference adapter, conformance tests, and typed schemas |
| @earendil-works/pi-ai | Unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.) |
| @earendil-works/pi-agent-core | Agent runtime with tool calling and state management |
| @earendil-works/pi-coding-agent | Interactive coding agent CLI |
| @earendil-works/pi-tui | Terminal UI library with differential rendering |
For Slack/chat automation and workflows see earendil-works/pi-chat.
Permissions & Containerization
Pi does not include a built-in permission system for restricting filesystem, process, network, or credential access. By default, it runs with the permissions of the user and process that launched it.
If you need stronger boundaries, containerize or sandbox Pi. See packages/coding-agent/docs/containerization.md for three patterns:
- Gondolin extension: keep
piand provider auth on the host while routing built-in tools and!commands into a local Linux micro-VM. - Plain Docker: run the whole
piprocess in a local container for simple isolation. - OpenShell: run the whole
piprocess in a policy-controlled sandbox.
Development
npm install --ignore-scripts # Install all dependencies without running lifecycle scripts
npm run build # Refresh model data, then build all packages
npm run build:offline # Rebuild using existing model data without network access
npm run check # Lint, format, and type check
./test.sh # Run tests (skips LLM-dependent tests without API keys)
./pi-test.sh # Run pi from sources (can be run from any directory)
Building standalone binaries from release source
GitHub releases include a versioned source archive covered by the release's SHA256SUMS file. Extract it and run the same build script used for the official standalone binaries:
VERSION="<release-version>"
tar -xzf "pi-${VERSION}-source.tar.gz"
cd "pi-${VERSION}"
./scripts/build-binaries.sh --offline-model-data --platform linux-x64 --out "$PWD/out"
The archive includes release model data and native prebuilds. --offline-model-data uses that model data without refreshing provider catalogs. The script installs dependencies and builds the executable with its runtime assets; pass --skip-install if dependencies are already provided.
Supply-chain hardening
We treat npm dependency changes as reviewed code changes.
- Direct external dependencies are pinned to exact versions. Internal workspace packages remain version-ranged.
.npmrcsetssave-exact=trueandmin-release-age=2to avoid same-day dependency releases during npm resolution.package-lock.jsonis the dependency ground truth. Pre-commit blocks accidental lockfile commits unlessPI_ALLOW_LOCKFILE_CHANGE=1is set.npm run checkverifies pinned direct deps, native TypeScript import compatibility, and the generated coding-agent shrinkwrap.- The published CLI package includes
packages/coding-agent/npm-shrinkwrap.json, generated from the root lockfile, to pin transitive deps for npm users. - Release smoke tests use
npm run release:localto build, pack, and create isolated npm and Bun installs outside the repo before tagging a release. - Local release installs, documented npm installs, and
pi update --selfuse--ignore-scriptswhere supported. - CI installs with
npm ci --ignore-scripts, and a scheduled GitHub workflow runsnpm audit --omit=devplusnpm audit signatures --omit=dev. - Shrinkwrap generation has an explicit allowlist for dependency lifecycle scripts; new lifecycle-script deps fail checks until reviewed.
Share your OSS coding agent sessions
If you use Pi or other coding agents for open source work, please share your sessions.
Public OSS session data helps improve coding agents with real-world tasks, tool use, failures, and fixes instead of toy benchmarks.
For the full explanation, see this post on X.
To publish sessions, use badlogic/pi-share-hf. Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and pi-share-hf.
You can also watch this video, where I show how I publish my pi-mono sessions.
I regularly publish my own pi-mono work sessions here:
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.