PiSharp 1.6.0.1 is out, matching Pi 1.6.0. See what's new
The minimal agent harness, native to .NET
An independent C# port of the Pi coding agent. Pi's sessions, RPC and workflow, with native C# extensions, embeddable libraries, and no Node runtime required.
dotnet tool install -g PiSharp.CliRequires .NET 10. Then run pisharp, or build from source.
~/src/orders-api anthropic claude-sonnet › add exponential backoff to the payment client retries read src/Payments/PaymentClient.cs read src/Payments/RetryPolicy.cs edit src/Payments/RetryPolicy.cs +18 -6 bash dotnet test tests/Payments.Tests Retries now back off exponentially with jitter, capped at 5 attempts. Tests pass. Want me to make the cap configurable?
Pi's philosophy, without leaving .NET
Native .NET 10
The CLI, terminal UI, RPC and agent loop are all C#. Node is only needed to run TypeScript extensions.
Minimal dependencies
Most libraries use only .NET. Five add one package each: SkiaSharp for images, Jint for codemode, YamlDotNet for prompt templates and, in the experimental packages, Microsoft.Data.Sqlite for durable storage and Roslyn for C# script tools. A locked restore and a pinned SDK keep the supply chain short.
Extend in C#
Run Pi's TypeScript extensions and packages unchanged, or write native extensions in C#.
Embed it anywhere
Use the LLM client, agent or coding agent in your own app. Five new experimental libraries in 1.5.0.1 add Chord, hosting, shared storage and remote environments.
How close to Pi it is
PiSharp makes three promises and tracks each one against Pi 1.5.0.
- BehaviorSame prompts, tools, ordering and results for the same inputs.13 of 13 areas ported
- Sessions and RPCThe same files and the same protocol, so tools built for Pi keep working.8 of 8 areas ported
- ExtensionsPi's TypeScript extensions and packages run unchanged.7 of 7 areas ported
Assessed 5 November 2026 for release 1.5.0, from PiSharp's own test suites. See the full parity report
What it does
Bring your providers
Every chat API Pi has, from Anthropic and OpenAI to Bedrock, Codex, Copilot, Google, Mistral and Pi Messages, with all of Pi's provider catalogs and /login for each. Switch mid-session with /model.
/model › anthropic messages openai responses openai-codex codex-responses amazon-bedrock converse-stream google-vertex vertex mistral conversations
Sessions are trees
Branch from any point, keep every branch in one file, and compact long histories automatically. Sessions live in Pi's folder, in Pi's format, so Pi and PiSharp resume each other's work.
● user plan the retry change ├─● asst read 2 files │ ├─● user use a retry library │ │ └─○ asst …abandoned │ └─● user keep it dependency-free │ └─● asst edit RetryPolicy.cs ← you are here └─● compaction summary of earlier entries
Primitives, not features
Register tools, commands, shortcuts, renderers and typed hooks from a plain C# class. Ship it as a NuGet package.
Already have Pi extensions? PiSharp runs them through a Node bridge, on Pi's own npm packages, and installs Pi packages with pisharp install.
public sealed class StatefulTodoExtension : IPiSharpExtension { public ValueTask InitializeAsync( IExtensionRegistry registry, CancellationToken ct) { registry.RegisterTool(new("todo", "todo", Description, JsonData.Parse(ParametersJson), ExecuteAsync)); return ValueTask.CompletedTask; } }
Four ways to run it
The same agent behind a terminal UI, a script, another process or your own app.
| Mode | Start it with | What you get |
|---|---|---|
| Interactive | pisharp | The full terminal UI, with steering and follow-ups. |
| Print and JSON | pisharp -p "…" | One-shot answers for scripts, or Pi's event stream with --mode json. |
| RPC | pisharp --mode rpc | Pi's protocol over stdin and stdout, for any language. |
| SDK | dotnet add package PiSharp.CodingAgent | The agent inside your own .NET app. |
Take the whole agent, or just a layer
29 libraries and the CLI are on NuGet, all at one version.
| You want to | Reference |
|---|---|
| Stream a chat completion from any provider Pi supports | PiSharp.AI |
| Run a tool-calling loop with your own tools | PiSharp.Agent |
| Read, write, branch and compact Pi's session files | PiSharp.Sessions |
| Embed the coding agent, with settings, skills and prompt templates | PiSharp.CodingAgent |
| Serve Pi's RPC protocol from your process | PiSharp.Rpc |
| Write an extension | PiSharp.Extensions.Abstractions |
What we didn't build
PiSharp keeps Pi's minimal core. Features other agents bake in are left to extensions, so the harness fits your workflow, not the other way around. Read why, from Pi's author
- No sub-agentsSpawn instances via tmux, or build your own as an extension.
- No permission popupsRun in a container, or write a confirmation hook that matches your policy.
- No plan modeWrite plans to files, or install an extension that does it your way.
- No built-in to-dosUse a TODO.md, or the sample todo extension, in C#.
- No background bashUse tmux. Full observability, direct interaction.
- No Node requirementThe one thing PiSharp adds to the list: Node is needed only for TypeScript extensions.
Find your way in
Reference & SDK
Already using Pi?
Run pisharp where you ran pi. It reads the same ~/.pi/agent and .pi folders: settings, sign-ins, MCP servers, AGENTS.md, skills, prompts, themes, extensions and sessions.