PI is a TypeScript toolkit for building AI agents. It's a monorepo of packages that layer on top of each other: pi-ai handles LLM communication across providers, pi-agent-core adds the agent loop with tool calling, pi-coding-agent gives you a full coding agent with built-in tools, session persistence, and extensibility, and pi-tui provides a terminal UI for building CLI interfaces.
These are the same packages that power OpenClaw. This guide walks through each layer, progressively building up to a fully featured coding assistant with a terminal UI, session persistence, and custom tools.
By understanding how to compose these layers, you can build production-grade agentic software on your own terms, without being locked into a specific abstraction.
Pi was created by @badlogicgames. This is a great writeup from him that explains some of the design decisions made when creating it.