Pi, but in Rust.

The agent loop that powers OpenClaw, written in Rust. Parallel runtimes, native binaries, and structured permissions.

View on GitHub Documentation

Open source. MIT licensed. Built for AI employees.

Quick Start

Get started in seconds

# Cargo.toml
[dependencies]
picrust = "0.1"
tokio = { version = "1", features = ["full"] }
anyhow = "1.0"
Capabilities

Everything an AI employee needs

Not an assistant framework. A runtime for autonomous agents.

Crash-Safe Sessions

Append-only persistence that survives power failures, OOM kills, and deployment restarts without corrupting state.

Parallel Execution

Multiple agent loops running concurrently on a single Tokio runtime, each with isolated state but sharing compute.

9 Built-in Tools

Read, Write, Edit, Glob, Grep, Bash, Todo, AskUser, and PresentFile. Plus the Tool trait for custom ones.

Structured Permissions

Three-tier permission system with hooks that intercept dangerous operations before they execute.

MCP Built In

Dynamic tool discovery from external MCP servers with namespacing, JWT refresh, and automatic reconnection.

Native Binaries

Single binary, zero runtime dependencies. No Node.js, no Python, no dependency hell. Runs anywhere.

Multi-Provider LLM

Anthropic Claude and Google Gemini with hot-swappable providers, streaming, prompt caching, and extended thinking.

Hook System

PreToolUse, PostToolUse, PostAssistantResponse and more. Pattern-based matching with configurable priority.

Philosophy

The best agent architecture
is the simplest one

A while loop with tools. No graphs, no DAGs, no state machines. Call the LLM, execute whatever tools it asks for, feed results back, repeat. That's it.

PiCrust takes that insight and rebuilds it in Rust for a different use case: AI employees. Not assistants that sit in your terminal and wait for instructions — employees that do work on their own, handle your email while you're in a meeting, and juggle multiple tasks concurrently.

Rust makes agent code easier for both humans and LLMs to understand. No inheritance hierarchies. No dynamic typing. No runtime magic. Every function signature tells you exactly what goes in and what comes out. The types tell the whole story.

Comparison

Where PiCrust diverges from Pi

Pi PiCrust
LanguageTypeScriptRust
Tools4 built-in, self-extending9 built-in + Tool trait
ExtensionsDynamic hot-reloadCompiled Rust traits
MCPNot includedBuilt-in via ToolProvider
ConcurrencyOne agent per processMany agents, one runtime
TargetCoding assistantsAI employees
Example

Minimal agent in ~30 lines

use std::sync::Arc;
use picrust::{
    agent::{AgentConfig, StandardAgent},
    llm::{AnthropicProvider, LlmProvider},
    runtime::AgentRuntime,
    session::AgentSession,
};

// 1. Create provider, runtime, session
let llm: Arc<dyn LlmProvider> = Arc::new(
    AnthropicProvider::from_env()?
);
let runtime = AgentRuntime::new();
let session = AgentSession::new(
    "my-session", "assistant",
    "My Assistant", "A helpful agent",
)?;

// 2. Configure and spawn
let config = AgentConfig::new("You are a helpful assistant.")
    .with_streaming(true);
let agent = StandardAgent::new(config, llm);
let handle = runtime
    .spawn(session, |i| agent.run(i))
    .await;

// 3. Send input, receive output
handle.send_input("Hello!").await?;
Powered by PiCrust

Don't want to build it yourself?

Crator AI builds and manages AI employees for your business. Coding agents, outbound, customer support, data analysis, and more — fully managed, so you don't have to lift a finger.

Visit Crator AI

Start building
with PiCrust today.

Open source, MIT licensed. Read the docs, clone the repo, ship an agent.