The Problem
Teams building AI agents face two recurring problems: every LLM provider has its own API shape, and every agent loop reinvents tool calling, session state, and prompt management. Pi consolidates both into a single TypeScript monorepo—one unified provider layer, one agent runtime, and one coding-agent CLI that is itself extensible via plugins.
What This Does
The repo is a monorepo of five npm packages under packages/. packages/ai is a multi-provider LLM client (OpenAI, Anthropic, Google, Bedrock, Mistral, OpenRouter, and others) with OAuth flows, credential storage, and model catalogs. packages/agent provides the agent runtime: a session harness, tool-calling loop, compaction, and JSONL session persistence. packages/coding-agent is the interactive TUI/CLI that ties it together, with packages/tui handling terminal rendering and packages/telemetry providing vendor-neutral event schemas.
The README is explicit that Pi has no built-in permission system—it runs with the launching user's privileges. The repo documents three containerization patterns (Gondolin micro-VM, plain Docker, OpenShell sandbox) rather than baking sandboxing into the core.
How It Is Wired
Execution starts at the CLI entry point in packages/coding-agent/src/index.ts, which routes through packages/coding-agent/src/modes/interactive/interactive-mode.ts (the main loop). That mode delegates to packages/coding-agent/src/core/session-manager.ts for session lifecycle and packages/coding-agent/src/core/settings-manager.ts for configuration. The agent loop itself lives in packages/agent/src/agent-loop.ts, which calls the packages/ai provider layer. Network effects are concentrated in packages/ai/src/api/*.ts (one file per provider) and packages/ai/src/auth/oauth/*.ts for credential flows; filesystem effects go through packages/agent/src/harness/tools/{read,write,edit,bash}.ts.
The import graph is healthy overall: 1,180 internal modules, 3,191 edges, and only 75 modules inside circular dependencies. The hub is packages/ai/src/types.ts (167 modules depend on it), followed by packages/coding-agent/src/modes/interactive/theme/theme.ts (97 dependents). The critical cycle is packages/ai/src/types.ts ↔ packages/ai/src/models.ts; breaking it requires extracting shared types. The interactive-mode.ts file is in a cycle too and has high instability (0.76), meaning changes there ripple widely.
How To Use It
Setup: npm install --ignore-scripts then npm run build (per the README). The repo uses npm workspaces; there is no Dockerfile.
Configuration: Provider keys go through the OAuth flows in packages/ai/src/auth/ or environment variables handled by packages/ai/src/env-api-keys.ts. No central config file is present; settings are managed at runtime by settings-manager.ts.
Running it: ./pi-test.sh runs from source. For standalone binaries, extract the release source archive and run ./scripts/build-binaries.sh --offline-model-data --platform linux-x64 --out "$PWD/out" (both commands verbatim from the README).
Real-World Use
A team standardizing on Pi can write one agent loop and swap providers per environment: packages/ai/src/api/openai-responses.ts for OpenAI in CI, packages/ai/src/api/bedrock-converse-stream.ts for Bedrock in production, and packages/ai/src/api/google-vertex.ts for GCP. The coding agent's extension mechanism (see packages/coding-agent/examples/extensions/) lets a team add a custom provider or sandbox without forking the core.
Code Health & Issues
Static analysis found 603 findings (205 high, 396 medium). The high-severity clusters: 14 import-cycle members (notably packages/ai/src/types.ts, packages/ai/src/models.ts), 13 oversized files (largest is packages/ai/src/types.ts at 611 lines), 17 deep-nesting cases (max depth 9 in packages/ai/src/models.ts), and 13 hub modules with high blast radius. These are real maintenance costs, not style nits.
The security audit found one critical issue: .github/workflows/publish-model-catalog.yml has R2 credentials in a workflow that can be triggered by fork PRs—move secret-using steps into a workflow_run job. Medium issues: no permissions: declaration in ci.yml, no Dependabot/Renovate, and persist-credentials: false missing on checkout. Low: no job timeouts in build-binaries.yml. The repo has 552 test files, CI, a license, and a lockfile; no committed secrets found.
The Bottom Line
Pi is a serious, well-structured agent toolkit with real breadth—five packages, 27 dependencies, and 552 tests. The provider abstraction and agent runtime are production-grade, but the hub modules and cycles in packages/ai will make deep changes expensive. Teams wanting a multi-provider agent foundation should evaluate it; teams needing sandboxing out of the box should look elsewhere or adopt the documented containerization patterns.