登录 注册

pi (AI 智能体工具包)

去点 Star
开发者工具AI 应用与 AI AgentAI 模型与开发框架
121,481
Stars
0
Forks
0
Watchers
0
Open Issues
未知
许可证
TypeScript
语言
创建时间
最近更新

项目能做什么

AI Agent 工具包,提供统一 LLM API、Agent 循环、TUI 及编程 CLI。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

项目简介

Pi 是一个极简且高度可扩展的 AI Agent 工具框架(Agent Harness)。它提供了统一的多平台 LLM API、Agent 循环、差量渲染的 TUI(终端用户界面)以及交互式 Coding Agent CLI。

不同于功能臃肿的 Agent 方案,Pi 默认去掉了 sub-agents(子代理)和 plan mode(规划模式)等复杂设定,主打让开发者根据自身工作流自由定制,支持通过扩展插件、技能、提示词模板和主题进行扩展,并支持打包为 Pi package 分享。


核心功能

  • 高度模块化与可定制:支持自定义 extensions(扩展)、skills(技能)、prompt templates(提示词模板)和 themes(主题),可打包并通过 npm 或 git 分发。
  • 多样化的使用模式:
  • 交互式终端(TUI);
  • 自动化脚本支持(print 模式或 JSON 模式);
  • 远程调用(RPC 控制);
  • 使用 Pi TypeScript SDK 嵌入到自有应用中开发。
  • 完整的 Monorepo 生态:
  • @earendil-works/pi-ai:统一的多供应商 LLM API(支持 OpenAI、Anthropic、Google 等);
  • @earendil-works/pi-agent-core:具备 Tool Calling(工具调用)和状态管理的 Agent 运行时;
  • @earendil-works/pi-coding-agent:交互式编码终端 CLI;
  • @earendil-works/pi-tui:支持差量渲染的高性能终端 UI 库;
  • @earendil-works/chord、@earendil-works/pi-telemetry、@earendil-works/pi-durable 等支撑库。

适合谁用

  • 想打造专属终端编码助手、反感繁琐固定工作流的个人开发者;
  • 需要通过 TypeScript SDK、RPC 或 JSON 管道自动化集成 AI Agent 的全栈/后端工程师;
  • 寻求统一多模型 LLM API 调用与工具调用的底层库开发者。

安装步骤

前置要求

  • 需要 Node.js 22.19 或更高版本(官方安装脚本会在缺失时尝试自动安装)。

1. 官方脚本安装(推荐)

通过官方脚本安装会锁定依赖版本,后续可直接用 pi update 升级。

  • macOS / Linux: bash curl -fsSL https://pi.dev/install.sh | sh

  • Windows(PowerShell): powershell powershell -c "irm https://pi.dev/install.ps1 | iex"

2. npm 全局安装

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

注:该方式不会锁定间接依赖(transitive dependencies)。

3. Nix 安装

支持 Linux 和 macOS(ARM64 / x86-64):

# 直接运行最新稳定版
nix run github:earendil-works/pi/stable

# 或者安装到环境 profile
nix profile add github:earendil-works/pi/stable

配置说明

1. 登录与模型接入

进入目标项目目录并启动 Pi:

cd /path/to/project
pi

在 Pi 终端内输入以下命令,绑定支持的模型平台订阅或 API Key:

/login

(具体的 API 环境变量名称或高级配置原文未说明,请查看原仓库及官方文档)

2. 权限与安全沙箱说明

Pi 默认没有内置权限限制系统(即直接继承启动该进程的操作系统的用户权限,可访问本地文件、网络与系统进程)。若需隔离运行,官方推荐以下三种沙箱方案(详细配置请参考仓库对应文档): - Gondolin extension:本机运行 pi 并保留鉴权,将内置工具和 ! shell 命令转发至本地轻量 Linux micro-VM; - Plain Docker:直接将整个 pi 放入 Docker 容器中运行隔离; - OpenShell:在策略控制的 Sandbox 中运行整个 pi。


常见问题

  • 如何更新 Pi?
  • 脚本安装用户:运行 pi update。
  • Nix 用户:运行 nix profile upgrade pi。
  • npm 用户:重新运行带有最新版本的 npm install -g 即可。
  • 提交 Issue / PR 为什么被自动关闭?
    根据项目机制,新贡献者提交的 Issue 和 PR 默认会被系统自动关闭,维护者每日会进行人工筛选复核。
  • Nix 构建时模型信息过期如何处理?
    Nix 构建属于离线状态,若需手动更新模型 catalog pin,可运行: bash npm run update:model-catalog-pin
原始 README 摘录(英文原文,节选前 3000 字符)
<p align="center">
  <a href="https://pi.dev">
    <img alt="pi logo" src="https://pi.dev/logo-auto.svg" width="128">
  </a>
</p>
<p align="center">
  <a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
  <a href="https://www.npmjs.com/package/@earendil-works/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@earendil-works/pi-coding-agent?style=flat-square" /></a>
</p>

> New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See [CONTRIBUTING.md](CONTRIBUTING.md).

# Pi

Pi is a minimal, extensible agent harness that you can make your own.

Adapt Pi to your workflows, not the other way around. Customize Pi with [extensions](packages/coding-agent/docs/extensions.md), [skills](packages/coding-agent/docs/skills.md), [prompt templates](packages/coding-agent/docs/prompt-templates.md), and [themes](packages/coding-agent/docs/themes.md). Bundle them as [Pi packages](packages/coding-agent/docs/packages.md) and share via npm or git.

Pi ships with powerful defaults but skips features like sub-agents and plan mode. Ask Pi to build what you want, or install a package that does it your way.

Use Pi [interactively](packages/coding-agent/docs/usage.md), automate it in [print or JSON mode](packages/coding-agent/docs/cli.md), control it over [RPC](packages/coding-agent/docs/rpc.md), or build apps with the [Pi TypeScript SDK](packages/coding-agent/docs/sdk.md). See [OpenClaw](https://github.com/OpenClaw/OpenClaw) for a real-world integration.

## Getting started

Install the command-line interface:

```bash
curl -fsSL https://pi.dev/install.sh | sh
```

On Windows:

```shell
powershell -c "irm https://pi.dev/install.ps1 | iex"
```

The installer pins all dependencies and updates Pi with `pi update`. Alternatively, install directly with npm, which does not pin transitive dependencies:

```bash
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
```

Pi requires Node.js 22.19 or newer. The macOS, Linux, and Windows installers can install it if needed. Pi does not require dependency lifecycle scripts for a normal npm installation.

Start Pi in the directory where you want it to work:

```bash
cd /path/to/project
pi
```

For a built-in AI provider, run `/login` inside Pi to connect a subscription or API key. Then give Pi a task.

See the [documentation](https://pi.dev/docs/latest) for full setup and usage instructions, or [visit pi.dev](https://pi.dev) for demos.

## Run with Nix

```bash
nix run github:earendil-works/pi/stable
```

`stable` points at the latest release. Install it with `nix profile add github:earendil-works/pi/stable` and update with `nix profile upgrade pi`. Use a release tag such as `github:earendil-works/pi/v1.0.0` to pin a version, or `github:earendil-works/pi` for unreleased changes on `main`. Nix builds Pi from source.

Supports 
阅读完整原文

商业机会分析 AI 生成

Pi Packages 专业级插件与技能市场 (Extension & Skill Hub)

产品构想基于Pi原生支持的extensions、skills和prompt templates机制,搭建面向特定领域(如DevOps自动化、漏洞审计、合规重构)的商业化扩展市场。
核心功能高阶安全审计插件、CI/CD全自动发布技能包、付费Prompt模板、一键安装与依赖校验工具
目标用户使用Pi提升特定技术栈开发效率的工程师与技术团队
难度/周期中等 · 1-2 个月 · 成本:极低(主要是平台搭建与模板开发成本)
收费模式按技能包一次性买断、年费订阅制,或提供第三方开发者分成平台
竞争风险开源社区可能自发提供大量免费替代插件,需靠极高专业度和持续更新构建壁垒
依据 已验证事实

托管型团队协作与持久化状态网关 (Hosted Durable RPC Hub)

产品构想利用Pi的RPC能力与@earendil-works/pi-durable运行时,提供支持多端共享、会话持久化、统一Token计费的云端托管与中继服务。
核心功能RPC连接中继、持久化任务状态同步、团队成员权限与Audit Log、多LLM厂商统一计费路由
目标用户多人研发团队、远程开发团队、需在CI/CD和Web中集中管控Agent调用的技术负责人
难度/周期高 · 3-4 个月 · 成本:中等(服务器资源与跨网络长连接管理)
收费模式按团队席位收费(SaaS订阅),结合多模型Token代理用量加价
竞争风险运维门槛相对较高,需要解决跨机器调用的安全隔离与延迟问题
依据 AI推测

针对企业代码库的定制化 Coding Agent 实施与私有化交付

产品构想基于Pi的TypeScript SDK与单体架构,为中小型研发企业定制匹配其内部架构与脚手架的定制版Pi Agent,并完成内网离线/私有LLM部署。
核心功能内网私有模型接入适配、私有脚手架Skills定制、团队专属规则Prompt调优、本地代码审计与权限阻断集成
目标用户有数据安全敏感要求、需规范内部开发流程的中小型软件外包或科技企业
难度/周期中等 · 2-4 周/项目 · 成本:低(主要为人力时间成本)
收费模式项目制交付咨询费 + 年度维护与升级支持费用
竞争风险商业化难以规模化(定制交付依赖人力),受目标企业预算波动影响较大
依据 尚需验证的假设
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
vamsi/pi 中文介绍暂未生成
Port of pi-mono to Python; AI agent toolkit: coding agent CL
33 Python
codeworksh/codework 中文介绍暂未生成
AI agent toolkit for coding agents, unified LLM APIs, agenti
26 TypeScript
SithraBot/synthetic 中文介绍暂未生成
A Kotlin-first LLM toolkit offering unified API for AI model
15 Kotlin
qhkm/pi-rs 中文介绍暂未生成
AI agent toolkit rewritten in Rust: unified LLM API, agent r
5 Rust
jmccardle/tau 中文介绍暂未生成
AI agent toolkit: unified LLM API, agent loop, TUI, coding a
4 Python
lvyuan1688/unified-agent-rs 中文介绍暂未生成
AI agent toolkit: unified multi-provider LLM API, agent loop
3 Rust
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 ,最近推送 ,发布过 100 个 Release
社区活跃Star 121,481 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/earendil-works/pi.git
cd pi
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。