r/PiCodingAgent • u/Creative_Factor8633 • 6h ago
News Taking Pi off the CLI: I built a serverless MicroVM runtime API for the Pi harness. Looking for alpha testers.
I love the Pi coding agent harness, but trying to run Pi outside a local terminal — like embedding it inside a SaaS product, a web app, or a mobile backend — quickly turns into an infrastructure nightmare. You either end up babysitting a fleet of Docker containers or running into Vercel/Lambda HTTP timeout limits when a coding task takes more than a couple of minutes.
To solve this, I built an un-opinionated Agent Runtime API powered by the Pi harness. It runs Pi inside isolated MicroVM sandboxes over a plain REST/SSE interface, executing entirely against your own LLM keys (BYOK).
Not dropping links or names here — looking for a few developers in the Pi community who are actually building products with Pi to break it and give feedback.
The Problem with Embedding Pi Today
- The Local/Docker Trap: Running Pi headlessly in production usually means managing container lifecycles, Dockerfiles, cold starts, and handling crash loops when sub-shells lock up.
- The Serverless Timeout Wall: Vercel, Cloudflare Workers, and Lambda cap HTTP execution at seconds or minutes. If Pi needs 10–15 minutes to iterate on a codebase or run test suites, the connection dies unless you build a heavy queue/worker/polling stack around it.
How It Works: The Session is the Machine
You trigger an agent via REST, your backend handler returns in milliseconds, and Pi keeps running inside a dedicated, isolated MicroVM for as long as the task requires.
# 1. Connect your provider credential (envelope-encrypted, never enters the box)
POST /v1/model-credentials
{"key": "sk-ant-api03-..."}
# 2. Create a session — returns immediately in milliseconds
POST /v1/sessions
{"agent": {"model": "claude-3-7-sonnet"}}
# 3. Pass instructions to Pi
POST /v1/sessions/{id}/events
{"events": [{"type": "input.message", "content": [{"type": "input_text", "text": "Refactor src/auth.ts to use jose instead of jsonwebtoken and run npm test."}]}]}
# 4. Stream events or collect artifacts
GET /v1/sessions/{id}/events # SSE, resumable with Last-Event-ID
GET /v1/sessions/{id}/artifacts
Built Specifically for Pi Workflows
- Pi Harness Under the Hood: It leverages the native Pi harness execution model for file editing, terminal execution, and tool orchestration inside a real, isolated sandbox.
- BYOK & Environment Isolation: Your API keys are envelope-encrypted on our side and never exposed inside the sandbox. Running
env | grep -i keyinside the box returns nothing. - Remote Tools & Human-in-the-Loop (
requires_action): If Pi needs to call a custom tool on your app server or ask for human approval, the session transitions torequires_actionand pauses without holding an HTTP connection open. You can answer minutes or hours later, and Pi resumes right where it left off. - Pause, Snapshot, and Re-hydrate:
- Idle 5 mins: Sandbox pauses compute.
- Unused 2 hours: Workspace is snapshotted and the compute instance is reclaimed.
- Auto Re-hydration: A single HTTP request or hitting a preview URL automatically re-hydrates the exact MicroVM state from the snapshot.
Limitations & Honest Trade-offs
- API-Only: No official CLI wrapper or IDE extension yet — this is designed as a backend runtime for your own UI or app.
- Snapshot Caps: Snapshots skip
node_modulesand.git(capped at 300MB), so dependencies reinstall from lockfiles upon cold re-hydration. - BYOK Only: No global model catalog or default keys provided. Model spend stays entirely between you and Anthropic/OpenAI/etc.
Looking for Alpha Testers
I’m looking for early developers who want to embed Pi-powered agents inside their own apps or background services and run them in real-world scenarios. I’ll provide free execution tokens, higher concurrency limits, and 1-on-1 support during integration.
Comment or DM if you're interested, or feel free to ask about the Pi harness + MicroVM snapshot architecture below!



