What is PiCrust?
PiCrust is a Rust framework for building AI agents that can use tools, maintain conversations, and execute complex tasks autonomously. It’s specifically designed for applications that need to spawn, manage, and communicate with multiple agents - particularly suited for Tauri apps and other frontend-backend architectures. Works with Claude (Anthropic), Gemini (Google), and OpenAI out of the box.Quick Start
Build your first agent in under 5 minutes
Architecture
Understand the system design
Core Concepts
Learn how agents work
API Reference
Complete API documentation
Why PiCrust?
Built for Production Frontends
Unlike simple chatbot libraries, PiCrust is designed for real applications:- Runtime Management: Spawn and manage multiple concurrent agents
- Session Persistence: Automatic conversation history and state management
- Permission System: Three-tier security for tool execution
- Event Streaming: Real-time updates for responsive UIs
- Frontend-First: Perfect for Tauri, Electron, or web backends
Key Features
Multi-LLM Support
Multi-LLM Support
Works with Claude (Anthropic), Gemini (Google), and OpenAI out of the box. Swap providers at runtime or use different models for different tasks.
Tool System
Tool System
Powerful tool system with built-in tools and easy custom tool creation:
- File Operations: Read, Write, Edit, Glob, Grep
- Shell Access: Bash command execution
- Task Management: Built-in TODO list support
- Custom Tools: Simple trait implementation
- MCP Integration: Connect to external MCP servers
Automatic Prompt Caching
Automatic Prompt Caching
Reduce API costs by up to 90% with automatic prompt caching:
- Enabled by default (no configuration needed)
- Caches tool definitions, system prompt, and conversation history
- Cache entries valid for 5 minutes
- Automatic cache breakpoints at optimal locations
Session Management
Session Management
Built-in conversation persistence and metadata:
- Automatic disk persistence (write-through)
- Parent-child session relationships (for subagents)
- Custom metadata support
- Conversation naming (automatic or manual)
- Session listing and filtering
Permission System
Permission System
Three-tier permission system for security:
- Session Rules - In-memory, highest priority
- Local Rules - Agent-type specific, persisted
- Global Rules - All agents, persisted
Hook System
Hook System
Intercept and modify agent behavior:
- PreToolUse: Block or approve tool execution
- PostToolUse: React to successful execution
- UserPromptSubmit: Intercept user input
- Pattern matching for specific tools
- Modify tool inputs on the fly
MCP Integration
MCP Integration
Full support for Model Context Protocol:
- Dynamic tool discovery from MCP servers
- JWT refresh with callback system
- Automatic reconnection on server crashes
- Multiple servers with tool namespacing
- Thread-safe concurrent access
Advanced Features
Advanced Features
Production-ready features:
- Streaming & History: Dual-channel architecture for real-time + persistence
- Image & PDF Support: Vision and document understanding
- File Attachments:
<vibe-work-attachment>tag support - Ask User Questions: Interactive multi-choice workflows
- Interrupt Handling: Graceful cancellation in 3 scenarios
- Extended Thinking: Deep reasoning with extended thinking mode
- Debugger: Log all API calls and tool executions
Architecture at a Glance
Use Cases
Perfect For
- Tauri Desktop Apps - Native desktop applications with AI assistants
- CLI Tools - Command-line agents with tool access
- Web Backends - Server-side agent orchestration
- Multi-Agent Systems - Parent agents spawning specialized subagents
- Tool-Heavy Workflows - Agents that need file system, shell, API access
Not Ideal For
- Simple chatbots (too much infrastructure)
- Stateless request/response (use LLM API directly)
- Browser-only apps (Rust/WASM not optimal here)
Comparison with Alternatives
| Feature | PiCrust | LangChain | Anthropic SDK |
|---|---|---|---|
| Language | Rust | Python/JS | Python/TS |
| Runtime Management | Built-in | Manual | Manual |
| Session Persistence | Automatic | Manual | None |
| Permission System | Three-tier | None | None |
| Tauri Integration | Native | Via FFI | Via FFI |
| Multi-Agent | First-class | Complex | Manual |
| Type Safety | Rust | Python | Python/TS |
| MCP Support | Full | Via plugins | None |
| Streaming | Built-in | Yes | Yes |
Philosophy
PiCrust is built on these principles:- Frontend-First: Designed for apps that need responsive UIs and real-time feedback
- Type Safety: Leverage Rust’s type system for reliability
- Production-Ready: Session persistence, permissions, error handling built-in
- Flexible: Multiple LLM providers, custom tools, extensible hooks
- Efficient: Automatic prompt caching, connection pooling, async-first
Getting Started
Create your first agent
See the Quick Start guide for a complete example
What’s Next?
Quick Start Tutorial
Build a working agent step-by-step
Core Concepts
Understand the architecture
Tool System
Learn about built-in and custom tools
Examples
See complete working examples
Community & Support
- GitHub: PiCrust
- Issues: Report bugs and request features
- Examples: See
examples/directory in the repository
Ready to build your first agent? Let’s get started!