Repolode
bigfish1913

bigfish1913/pi-rust

A Rust-native, library-first coding-agent runtime and terminal CLI (rpi) with provider adapters, tools, durable sessions and a stable plugin ABI.

Open-source alternative to:Claude CodeCodex CLI

Stars
208
Forks
40
Open issues
6
Last commit
11 hours ago

What is it?

rpi is a coding-agent runtime written in Rust, split into ten composable crates covering provider adapters, an agent loop, tools, session persistence, a terminal UI and a plugin ABI. The same code can be embedded in your own process as an SDK or used directly through the `rpi` command-line agent with an interactive TUI, one-shot mode and JSON event output.

Sessions are stored as JSONL trees and resume from the last committed frame after a crash mid-run. Anthropic and OpenAI-compatible gateways are configured through a models.json file, and a deterministic offline `faux` provider lets tests and examples run without an API key or network access.

Plugins are Rust cdylib libraries behind a hand-written #[repr(C)] C ABI, and can register tools, providers, slash commands and event handlers. The project also includes a headless server mode that a thin TUI client can connect to over TCP. It is a reimplementation of the TypeScript Pi SDK in Rust, and it does not load Node or npm extensions.

Key features

  • 01Embeddable agent loop via rpi-agent and rpi-ai crates, usable without the CLI.
  • 02Deterministic offline faux provider for tests and examples without network access.
  • 03Crash-resumable sessions stored as JSONL trees.
  • 04Built-in read, write, edit, bash, grep, find and ls tools.
  • 05Plugin ABI with cdylib extensions that can register tools, providers and commands.
  • 06Headless server mode with a thin TUI client over TCP.

Use cases

  • Embedding a coding agent with custom tools and event handling inside your own Rust application.
  • Writing offline tests for agent workflows without API keys or network calls.
  • Running a terminal coding agent on a local machine while driving it from a thin client on another machine.
  • Building a reusable tool plugin that works both in the global CLI and in an embedded agent.

Quick start

  1. 1

    Install the rpi CLI from crates.io (requires Rust 1.88+)

    cargo install rpi-cli
  2. 2

    Set an API key for your model provider

    export ANTHROPIC_API_KEY=...
  3. 3

    Start the interactive terminal UI

    rpi

Things to know

  • Requires Rust 1.88 or newer when installing from crates.io or source.
  • The Homebrew formula supports only Apple silicon on macOS; Intel Macs need the prebuilt installer or cargo.
  • Running the CLI against real models needs a provider API key or a models.json configuration.

In collections

Topics

FAQ

What is pi-rust?
A Rust-native, library-first coding-agent runtime and terminal CLI (rpi) with provider adapters, tools, durable sessions and a stable plugin ABI. rpi is a coding-agent runtime written in Rust, split into ten composable crates covering provider adapters, an agent loop, tools, session persistence, a terminal UI and a plugin ABI. The same code can be embedded in your own process as an SDK or used directly through the `rpi` command-line agent with an interactive TUI, one-shot mode and JSON event output.
Is pi-rust free to use? What license does it have?
pi-rust is open source under the MIT license. Check the license terms before using it in commercial products.
Is pi-rust still maintained?
Actively maintained. The last commit to pi-rust was on Nov 6, 2026.
What can I use pi-rust for?
Embedding a coding agent with custom tools and event handling inside your own Rust application. Writing offline tests for agent workflows without API keys or network calls. Running a terminal coding agent on a local machine while driving it from a thin client on another machine. Building a reusable tool plugin that works both in the global CLI and in an embedded agent.
How do I install pi-rust?
Install the rpi CLI from crates.io (requires Rust 1.88+): cargo install rpi-cli Set an API key for your model provider: export ANTHROPIC_API_KEY=... Start the interactive terminal UI: rpi
Where can I get pi-rust?
The source code and installation instructions are on GitHub: https://github.com/bigfish1913/pi-rust

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects