ai-setup 3 min read

Pi: A Unified AI Agent Toolkit with LLM API and TUI

Pi is a TypeScript AI agent toolkit with a unified LLM API, agent loop, terminal UI, and coding-agent CLI. MIT-licensed, used by 100k+ stars worth of developers.

By
Share: X in
GitHub social preview card for earendil-works/pi

TL;DR: earendil-works/pi is a TypeScript AI agent toolkit that bundles a unified LLM API, an agent loop, a terminal UI, and a coding-agent CLI into one MIT-licensed package. It has crossed 100,000 stars and is one of the more established agent frameworks on GitHub.

What it is

earendil-works/pi describes itself as “AI agent toolkit: unified LLM API, agent loop, TUI, coding agent CLI.” The organisation behind the repo is earendil-works. The codebase is TypeScript, the license is MIT, and the repository has 105,759 stars and 13,292 forks at the time of writing — significant scale for a project in this category.

The default branch is main, and the project has been actively pushed to within the past day. It was first created in August 2025, which makes it older than most of the agent frameworks that came out of the 2026 wave.

What it does well

Pi is built as a stack of four pieces, each of which you can use independently.

  • Unified LLM API. One client abstraction that wraps multiple model providers, so you don’t write a different adapter per vendor.
  • Agent loop. A reusable runtime that handles the model call, tool execution, and result aggregation for you. You define the tools; Pi drives the loop.
  • TUI. A terminal interface for running agents interactively. Useful when you want the same coding workflow without launching a separate GUI app.
  • Coding-agent CLI. A command-line tool that wires the agent loop into your editor and filesystem, similar in spirit to Claude Code or Codex.

Because all four pieces live in one repository, you can read the loop once and trust that the TUI and CLI are using the same primitives. That consistency matters when you start customizing the agent — you do not have to wonder whether the CLI is doing something the loop wouldn’t.

How to try it

The repository’s install instructions cover the CLI; the library pieces are importable as TypeScript packages:

git clone https://github.com/earendil-works/pi.git
cd pi
npm install
npm run build
npm link               # makes the `pi` binary available globally
pi                     # launches the TUI / CLI

From there, the agent loop is reachable both as a library (import { Agent } from "@earendil-works/pi") and as a CLI (pi run "summarise the diff").

When it fits, and when it doesn’t

Pi fits teams that want a single, MIT-licensed toolkit for building agent-driven CLIs and TUIs, especially when they have already standardised on TypeScript. It is less attractive if you only need a chat UI, in which case a host-managed service is faster, or if you have committed to Python for your agent stack, in which case the library doesn’t help.

The maturity is a positive signal: 100k+ stars and a year of history mean the core API is unlikely to churn overnight, but the project is still actively evolving, so version pinning in production deployments remains wise.

Source and Accuracy Notes

  • Project page: https://github.com/earendil-works/pi
  • Source repository: earendil-works/pi (verified via GitHub API html_url)
  • License: MIT (verified via GitHub API license.spdx_id)
  • Stars at time of writing: 105,759
  • Language: TypeScript
  • Homepage: none provided in repository metadata