Glean 拾遗
Daily /2026-07-30 / Pi: All-in-One AI Agent Toolkit with Unified LLM API and Coding Agent CLI

Pi: All-in-One AI Agent Toolkit with Unified LLM API and Coding Agent CLI

Source github.com Glean’d 2026-07-30 06:00 Read 6 min
AI summary

Pi is an open-source AI agent toolkit offering a unified multi-provider LLM API (OpenAI, Anthropic, Google, etc.), an extensible agent runtime with tool calling and state management, an interactive coding agent CLI, and a terminal UI library. It addresses component fragmentation in building AI agents via modular npm packages, with containerization support and supply-chain security hardening. Ideal for engineers building, deploying, or customizing AI agents, especially coding agents.

Original · 6 min
github.com ↗
§ 1

Pi is an open-source toolkit that bundles a unified multi-provider LLM API, an agent runtime with tool calling and state management, and an interactive coding agent CLI. It's designed for developers who want to build or use AI agents without managing multiple SDKs and providers.

Pi 是一套开源工具包,它将统一的多提供商 LLM API、带工具调用和状态管理的 agent 运行时,以及交互式编码 agent CLI 整合在一起。它为想要构建或使用 AI agent 而无需管理多个 SDK 和提供商的开发者而设计。

§ 2

Developers often struggle with different APIs from OpenAI, Anthropic, Google, and others. Pi provides a single, coherent interface (@earendil-works/pi-ai) to multiple providers, eliminating the need to learn and maintain separate SDKs. The coding agent CLI (@earendil-works/pi-coding-agent) further reduces friction by offering an interactive terminal where agents can use tools and manage state.

开发者常常疲于应对来自 OpenAI、Anthropic、Google 等不同 API 的差异。Pi 通过统一的接口(@earendil-works/pi-ai)对接多个提供商,省去了学习和维护多个 SDK 的麻烦。编码 agent CLI(@earendil-works/pi-coding-agent)则通过交互式终端进一步降低了门槛,让 agent 能调用工具并管理状态。

§ 3

The monorepo includes: @earendil-works/pi-ai (unified LLM API for OpenAI, Anthropic, Google, etc.), @earendil-works/pi-agent-core (agent runtime with tool calling and state management), and @earendil-works/pi-coding-agent (interactive coding agent CLI). An additional @earendil-works/pi-tui provides a terminal UI library with differential rendering for building custom interfaces.

单体仓库包含:@earendil-works/pi-ai(面向 OpenAI、Anthropic、Google 等的统一 LLM API)、@earendil-works/pi-agent-core(具备工具调用和状态管理的 agent 运行时),以及 @earendil-works/pi-coding-agent(交互式编码 agent CLI)。额外提供的 @earendil-works/pi-tui 则是带有差异渲染的终端 UI 库,可用于构建自定义界面。

§ 4

The coding agent CLI runs in the terminal, where it can execute commands, read files, and call external tools. It uses the agent runtime to manage conversation state and tool execution, while the unified LLM API routes requests to the chosen provider (e.g., OpenAI, Anthropic). The user interacts via natural language or commands, and the agent can perform complex coding tasks like editing files, running tests, or searching code.

编码 agent CLI 在终端中运行,可以执行命令、读取文件以及调用外部工具。它通过 agent 运行时来管理对话状态和工具执行,而统一的 LLM API 则将请求路由到选定的提供商(如 OpenAI、Anthropic)。用户通过自然语言或命令进行交互,agent 可以完成复杂的编码任务,比如编辑文件、运行测试或搜索代码。

§ 5

Pi is published as npm packages. To use the coding agent CLI: npm install -g @earendil-works/pi-coding-agent. Then run pi to start the interactive session. For programmatic use, install the core packages: npm install @earendil-works/pi-ai @earendil-works/pi-agent-core. The project uses modern Node.js and requires npm. Development setup: npm install --ignore-scripts, npm run build, and ./test.sh to run tests (skips LLM-dependent tests without keys).

Pi 以 npm 包形式发布。若要使用编码 agent CLI,运行 npm install -g @earendil-works/pi-coding-agent,然后执行 pi 启动交互式会话。如需编程使用,安装核心包:npm install @earendil-works/pi-ai @earendil-works/pi-agent-core。项目需要现代 Node.js 和 npm。开发设置:npm install --ignore-scriptsnpm run build./test.sh 运行测试(没有 API 密钥时会跳过依赖 LLM 的测试)。

§ 6

Pi does not include a built-in permission system for filesystem, process, or network access. By default, it runs with the user's permissions. For stronger isolation, the project recommends containerization via Docker, Gondolin (Linux micro-VM), or OpenShell (policy-controlled sandbox). See packages/coding-agent/docs/containerization.md for detailed patterns.

Pi 没有内置的权限系统来限制文件系统、进程或网络访问。默认情况下,它使用启动它的用户权限运行。如果需要更强的隔离,项目推荐通过 Docker、Gondolin(Linux 微型虚拟机)或 OpenShell(策略控制沙箱)进行容器化。详细模式请参见 packages/coding-agent/docs/containerization.md

§ 7

The project encourages users to share their coding agent sessions (with sensitive info removed) to a Hugging Face repository using badlogic/pi-share-hf. Public session data helps improve coding agents with real-world tasks. The author regularly publishes sessions at badlogicgames/pi-mono on Hugging Face.

该项目鼓励用户分享他们的编码 agent 会话(移除敏感信息),通过 badlogic/pi-share-hf 上传到 Hugging Face 仓库。公开的会话数据有助于基于真实任务改进编码 agent。作者定期在 Hugging Face 的 badlogicgames/pi-mono 发布会话。

Open source ↗