Rust-native, library-first coding-agent runtime and terminal CLI inspired by Pi, with composable LLM providers, tools, sessions, and plugin ABI

★ 308⑂ 58👁 1⑃ 395● 49▤ 150
RustMITCreated 2026-08-15rpi.bigfisharc.cn/
下载:rpi v0.31.0rpi-0.31.0 ↓0.31.02026-11-27
+5
日增长
308
stars
58
forks
1
watchers
395
prs
49
issues
150
releases

README

rpi · Rust 原生编码智能体运行时

English | 简体中文


  












rpi 是用 Rust 编写、以库为核心的编码智能体运行时,并在其上提供了一个终端智能体。
工作区包含 11 个可组合的 crate,涵盖模型提供方适配、可从崩溃恢复的智能体循环、可复用的运行时、终端界面和稳定的插件 ABI。
你可以将同一套实现作为 SDK 嵌入应用,也可以直接运行 rpi 命令。

rpi 最初是 Mario Zechner 的 Pi TypeScript SDK 的 Rust 实现,现已具备自己的 Rust 原生插件 ABI 和执行基础设施。
上游项目的归属说明见致谢和 NOTICE。

快速上手 · 官网 · 文档 · 扩展目录与收录 · rpi-extension

 演示

!rpi 终端读取项目 README 并显示运行和测试命令

终端。 在项目目录运行 rpi。图中展示隔离示例会话和一次 read 工具调用。用户指南

!rpi-web 的项目侧栏、工具调用和 Markdown 回复

Web。 运行 rpi install rpi-web 安装扩展,然后在项目目录运行 rpi --webserver,打开终端输出的地址。Web 安装指南

!RPI Work 桌面预览,并排显示会话与 Git 差异

桌面端。 RPI Work 的 GPUI 预览版在原生窗口中展示项目会话、对话和 Git 差异。RPI Work


终端和 SDK 录屏

!rpi 终端演示:无需请求模型即可打开内置帮助

启动终端智能体后即可用 /help 查看帮助,无需真实 API 密钥或模型请求。录制脚本见 demo/tui.tape。

!rpi SDK 演示:通过 faux 提供方离线运行智能体循环和完整的工具调用

无需 API 密钥或网络,按测试所用的路径运行智能体循环和一次真实的 write 工具调用。录制脚本见 demo/sdk.tape,可用 task demo 重新生成。



 三种用法

| 目标 | 所需依赖 | 从这里开始 |
| --- | --- | --- |
| 直接使用终端编码智能体 | 无需添加依赖 | cargo install rpi-cli |
| 在自己的进程里运行智能体 | rpi-agent(可加 rpi-ai、rpi-tools) | examples/minimal |
| 为会话添加工具或模型提供方 | rpi-plugin-sdk | examples/plugin-stub |

三种用法共用一套实现。你可以在内嵌的智能体里调试工具,再把同一套代码打包成由全局 rpi 加载的 cdylib 插件。推荐的项目布局见智能体项目结构。

 安装

预编译二进制(无需 Rust 工具链)

bash
curl -fsSL https://raw.githubusercontent.com/bigfish1913/pi-rust/main/scripts/install.sh | sh


脚本会验证发布的 SHA-256 校验值,再安装到 /usr/local/bin 或 ~/.local/bin。可通过 --dry-run 预览安装操作。

在 Windows (x64) 上使用 PowerShell 5.1 或更高版本运行以下命令。

powershell
& ([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/bigfish1913/pi-rust/main/scripts/install.ps1).Content))


脚本会验证发布的 SHA-256 校验值,再安装到 $env:LOCALAPPDATA\Programs\rpi。
按脚本输出的说明添加 PATH,然后运行 rpi --version。可附加 -DryRun 预览,或使用 -Version  和 -Dir 'C:\Tools\rpi' 指定版本和目录。

通过 npm 安装(需要 Node.js 20 或更新版本,无需 Rust 工具链)

bash
npm install -g @bigfishnpm/rpi
rpi --version


npm 安装器从 GitHub Releases 下载对应平台的二进制,并按包内固定的 SHA-256 校验值验证归档和可执行文件。
支持 macOS(x64/ARM64)、Windows(x64)和 Linux(x64 glibc/musl、ARM64 glibc)。

通过 crates.io 安装(需要 Rust 1.88 或更新版本)

bash
cargo install rpi-cli
rpi --version


通过包管理器安装

bash
brew tap bigfish1913/tap && brew install rpi           macOS(Apple 芯片)、Linux
scoop bucket add bigfish1913 https://github.com/bigfish1913/scoop-bucket
scoop install rpi                                      Windows


在 macOS 上,Homebrew 配方目前支持 Apple 芯片。Intel Mac 可以使用提供 x86_64-apple-darwin 产物的版本的预编译安装脚本,也可以运行 cargo install rpi-cli。winget 安装清单正在审核。

从源码运行

bash
git clone https://github.com/bigfish1913/pi-rust.git
cd pi-rust && cargo run -p minimal    离线智能体,无需 API 密钥


以下是两个离线示例的实际输出。两者都无需凭据或网络,每次运行的输出一致。用 task demo-transcript 可重新生成。

text
$ cargo run -q -p minimal
minimal example: 2 messages after run
  - user
  - assistant
assistant reply: Hello from the faux provider!
AgentEnd observed.

$ cargo run -q -p tools-example
tools example: 4 messages after run
wrote out.txt (28 bytes): "hello from the tools example"
AgentEnd observed; tool ran against OsExecutionEnv.


 快速上手

 CLI

bash
export ANTHROPIC_API_KEY=...       

Top issues

Discussions

Latest release

rpi v0.31.0 v0.31.0 2026-11-27
What's Changed
 perf: reduce history restore allocations and interrupted recovery hydration by @bigfish1913 in https://github.com/bigfish1913/pi-rust/pull/394
 docs: add extension contribution link to README by @bigfish1913 in https://github.com/bigfish1913/pi-rust/pull/395
 fix(rpc): correlate and settle every native execution lease by @bigfish1913 in https://github.com/bigfish1913/pi-rust/pull/396
 feat(extensions): follow the catalog move to pi-rust/rpi-extension by @bigfish1913 in https://github.com/bigfish1913/pi-rust/pull/398
 feat(tui): support explicit hiding in entry renderers by @big

Snapshot: 2026-11-28T10:06:57Z · Data license Apache-2.0 · JSON