r/PiCodingAgent • • 14d ago

Question Multi-tenant Pi and resource isolation

I'm exploring the possibility of using Pi (or the Pi SDK) as a backend to support a multi-tenant application. The architecture would be a browser frontend with backend servers running Pi. Each user would have their own isolated sessions(working directories), and the system needs to support horizontal scale-out.

I know PiAPI SDK supports creating Agent Sessions, but its parameters include things like AgentDir and cwd (local disk directories), which makes true backend scale-out difficult.

I've looked into a few existing projects:

  • pi-web: designed for personal/private use, deployed directly on the end-user's machine. It doesn't support multi-tenant requirements.
  • pi-tau-web-server: It creates Pi subprocesses via Pi RPC on the server side. However, it seems unable to achieve horizontal scale-out and lacks proper tenant isolation.
  • pi-parallel-session: From what I can tell, it mainly focuses on session-level concurrency in the UTi.

Are there any existing projects that are closer to my use case (multi-tenant, scale-out, backend-hosted Pi)? Any pointers or recommendations would be greatly appreciated!

5 Upvotes

8 comments sorted by

1

u/Extra_Loquat_7667 14d ago

If you truly want to isolate multiple users, you should use a solution like Docker sandboxing rather than relying solely on account management. Otherwise, you won't be able to prevent interference between different users.

0

u/wodaxia 14d ago

+1. I use docker deployment and one backend -one container. It is still resource isolation issue that multiple users use agentSessions in the same docker container. The true isolation would be 1 AgentSession for one sandbox.

1

u/TheTyand 14d ago

Check out omnigent. It is what you need and it supports also pi. Plus a few other harnesses. https://github.com/omnigent-ai/omnigent

I am creating my own harness with a similar architecture, but I am not done. Still in beta and no MVP. I am missing time and money. https://github.com/SchneiderDaniel/cheasee-pi

1

u/wodaxia 14d ago

I checked the omnigent and finally set it up in my conmputer. It is SPA and using sandbox for runners, processors distinguished from backends, to maintain the agent. What problem does cheasee-pi try to resolve?

1

u/TheTyand 13d ago

Cheasse-pi let's you run parallel pi sessions in a custom docker container and the pi agent is flavored. Not crazy like ohmypi, but I add thinks that in my book are needed. But omnigent is the better approach for 99% of the people. Cheasse-pi is just for the 1%, me.

1

u/gandazgul 14d ago

I've built RunWield this year and it's a great sdlc coding agent built on Pi. Right now I'm architecting k8s based scalable remote workers as well as factory definitions. Wld implementation and review validation loops as well as individual agents for factory work. Starting with the runners right now then I'll build the UI and add multitenancy to the wld plan and settings store. I'm looking for collaborators if you are interested message me.

https://github.com/RunWield/runwield

1

u/alpinetime999 14d ago

Looked into something similar recently. Rivet for the backend and maybe tanstack ai for frontend looked the most promising. Can also roll your own, postgres for session storage and s3 for workspace storage, then have your server spin up an executor container/microvm on a service like ecs or eks that is given the session data and workspace corresponding to a given session in a mounted volume. Then your server executes user queries on that running container, with checkpoints etc.

0

u/Hulto 14d ago

I was looking for something similar a few months ago and didn’t find anything. The space has evolved a lot with t3code, opencode v2, and broader support for remote coding sessions.

I think coder is the best in the space with their agents tab.

https://github.com/coder/coder

Their basis in remote dev environments makes isolation and integration with existing infrastructure really smooth.

I wanted to use Claude and codex subscriptions so I ended up building my own that talks to each harness including pi for openweight models over headless RPC/JSON and then fronting those in a web app behind CF tunnels.