🔥 Pi:统一 LLM API、代理循环与编码代理工具包
英文标题:🔥 earendil-works/pi
Pi 是一个开源的 AI 代理工具包,提供统一的 LLM API、代理循环、终端用户界面(TUI)和编码代理 CLI。它不含内置权限系统,官方推荐通过容器化或沙箱机制增强安全隔离,并给出了三种实现模式。项目实行严格的依赖版本锁定与审计流程,确保可复现构建与供应链安全。此外,项目鼓励开发者分享开源软件开发会话,以真实数据提升编码代理的实用性能。
1.4 MB
85.5 KB
中文
来自新贡献者的新 issue 和 PR 默认会被自动关闭。维护者每天会审查这些自动关闭的 issue。详见 CONTRIBUTING.md。
这是 Pi 代理驾驭项目的主页,包含我们自扩展的编码代理。
要了解更多关于 Pi 的信息:
Slack/聊天自动化与工作流请见 earendil-works/pi-chat。
权限与容器化
Pi 不包含用于限制文件系统、进程、网络或凭证访问的内置权限系统。默认情况下,它以启动它的用户和进程的权限运行。
如果你需要更强的边界隔离,请将 Pi 容器化或置于沙箱中运行。三种模式请参见 packages/coding-agent/docs/containerization.md:
- Gondolin 扩展:将
pi和供应商认证保留在宿主机,同时将内置工具和!命令路由进本地 Linux 微型虚拟机。 - 普通 Docker:将整个
pi进程运行在本地容器中以实现简单隔离。 - OpenShell:将整个
pi进程运行在策略控制的沙箱中。
请参阅 CONTRIBUTING.md 获取贡献指南,参阅 AGENTS.md 获取面向人类和代理的项目特定规则。Pi 的长期规划也可在 RFC 中找到。
npm install --ignore-scripts # 安装所有依赖而不运行生命周期脚本
npm run build # 构建所有包
npm run check # 代码规范检查、格式化与类型检查
./test.sh # 运行测试(无 API 密钥时会跳过依赖 LLM 的测试)
./pi-test.sh # 从源码运行 pi(可在任意目录执行)
我们将 npm 依赖变更视为受审阅的代码变更。
- 直接外部依赖锁定为精确版本。内部工作区包保留版本范围。
.npmrc设置save-exact=true和min-release-age=2,避免在 npm 解析时引入当天发布的新依赖。package-lock.json是依赖的事实基准。预提交钩子会阻止意外的 lockfile 提交,除非设置PI_ALLOW_LOCKFILE_CHANGE=1。npm run check验证锁定的直接依赖、原生 TypeScript 导入兼容性以及生成的编码代理 shrinkwrap。- 已发布的 CLI 包包含
packages/coding-agent/npm-shrinkwrap.json,该文件基于根 lockfile 生成,用于为 npm 用户锁定传递依赖。 - 发布冒烟测试使用
npm run release:local在标记版本前于仓库外部构建、打包并创建隔离的 npm 和 Bun 安装环境。 - 本地发布安装、文档中的 npm 安装命令以及
pi update --self在支持的情况下均使用--ignore-scripts。 - CI 使用
npm ci --ignore-scripts安装,并设有定时 GitHub 工作流运行npm audit --omit=dev和npm audit signatures --omit=dev。 - Shrinkwrap 生成对依赖生命周期脚本使用显式允许名单;新的生命周期脚本依赖在被审查前会导致检查失败。
分享你的开源编码代理会话
如果你在开源工作中使用 Pi 或其他编码代理,请分享你的会话。
公开的开源会话数据有助于通过真实世界的任务、工具使用、失败案例和修复过程来改进编码代理,而不是依赖玩具基准测试。
完整解释请见 此 X 帖子。
要发布会话,请使用 badlogic/pi-share-hf。阅读其 README.md 了解设置指引。你只需要一个 Hugging Face 账户、Hugging Face CLI 和 pi-share-hf。
你也可以观看视频:发布 pi-mono 会话的操作演示,其中我展示了如何发布我的 pi-mono 会话。
我会定期在此发布自己的 pi-mono 工作会话:
MIT
pi.dev 域名由

exe.dev 友情捐赠。
English / 原文
New issues and PRs from new contributors are auto-closed by default. Maintainers review auto-closed issues daily. See CONTRIBUTING.md.
This is the home of the Pi agent harness project including our self extensible coding agent.
To learn more about Pi:
For Slack/chat automation and workflows see earendil-works/pi-chat.
Permissions & Containerization
Pi does not include a built-in permission system for restricting filesystem, process, network, or credential access. By default, it runs with the permissions of the user and process that launched it.
If you need stronger boundaries, containerize or sandbox Pi. See packages/coding-agent/docs/containerization.md for three patterns:
- Gondolin extension : keep
piand provider auth on the host while routing built-in tools and!commands into a local Linux micro-VM. - Plain Docker : run the whole
piprocess in a local container for simple isolation. - OpenShell : run the whole
piprocess in a policy-controlled sandbox.
See CONTRIBUTING.md for contribution guidelines and AGENTS.md for project-specific rules (for both humans and agents). Longer term plans for Pi can also be found in RFCs.
npm install --ignore-scripts # Install all dependencies without running lifecycle scripts
npm run build # Build all packages
npm run check # Lint, format, and type check
./test.sh # Run tests (skips LLM-dependent tests without API keys)
./pi-test.sh # Run pi from sources (can be run from any directory)
We treat npm dependency changes as reviewed code changes.
- Direct external dependencies are pinned to exact versions. Internal workspace packages remain version-ranged.
.npmrcsetssave-exact=trueandmin-release-age=2to avoid same-day dependency releases during npm resolution.package-lock.jsonis the dependency ground truth. Pre-commit blocks accidental lockfile commits unlessPI_ALLOW_LOCKFILE_CHANGE=1is set.npm run checkverifies pinned direct deps, native TypeScript import compatibility, and the generated coding-agent shrinkwrap.- The published CLI package includes
packages/coding-agent/npm-shrinkwrap.json, generated from the root lockfile, to pin transitive deps for npm users. - Release smoke tests use
npm run release:localto build, pack, and create isolated npm and Bun installs outside the repo before tagging a release. - Local release installs, documented npm installs, and
pi update --selfuse--ignore-scriptswhere supported. - CI installs with
npm ci --ignore-scripts, and a scheduled GitHub workflow runsnpm audit --omit=devplusnpm audit signatures --omit=dev. - Shrinkwrap generation has an explicit allowlist for dependency lifecycle scripts; new lifecycle-script deps fail checks until reviewed.
Share your OSS coding agent sessions
If you use Pi or other coding agents for open source work, please share your sessions.
Public OSS session data helps improve coding agents with real-world tasks, tool use, failures, and fixes instead of toy benchmarks.
For the full explanation, see this post on X.
To publish sessions, use badlogic/pi-share-hf. Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and pi-share-hf.
You can also watch this video, where I show how I publish my pi-mono sessions.
I regularly publish my own pi-mono work sessions here:
MIT
pi.dev domain graciously donated by