Skip to main content
Pi Web: Running a Coding Agent in the Browser Behind Anvil Connect
agentssecurityplatform-engineeringai-infrastructureproduct

Pi Web: Running a Coding Agent in the Browser Behind Anvil Connect

How I put my Pi coding agent behind Anvil Connect so developers could drive it from a browser, and why the boundary around it was the real work.

Sekou M. Doumbouya

Sekou M. Doumbouya

· 9 min read

Listen to this article

The views expressed here are my own and do not represent those of any current or former employer.

Part 3 of a six-part series on Anvil Connect.

On September 10 I typed a request that was shorter than the problem behind it. I wanted Pi as a first-class session in Connect: a chat panel, threaded conversations, folders, and, in my words that day, something that would “look a lot like pi-webui.” That was the whole spec. Nothing in it looked like a shell.

Pi is the coding agent I drive from the command line, which suits me fine. The problem was everyone else. I wanted developers to drive Pi and tell me how it held up, and every path to that started with the same two bad options: teach them my terminal, or hand them my host. So the question I carried into that week was narrow. How do you give someone a coding agent without giving them a terminal, or the machine the agent runs on?

A terminal is just another wall

A terminal is the same wall the series started with, wearing a different coat. It assumes the person already knows where they are, what the prompt expects, and what not to type.

Developers are not afraid of terminals. That is not the point. The point is that a terminal on my machine is my machine. I did not want to ask anyone to be careful at my desk. I wanted the system to be careful for them.

Pi Web is a session, not a shell

On September 11, Pi Web went live through Connect as a managed session UI. You sign in once at the front door, the same way you reach every other published app, and Pi shows up as a session in the browser. You talk to the agent. The agent does the work. You never see a prompt with a blinking cursor.

I asked for it, and background agents built it from that request.

The panel is the easy part. What matters is everything behind it, because a friendly interface in front of an unrestricted agent is not a product. It is a liability with good typography.

The runner carries a valet key

The Pi runner is a pinned image. It carries no host credentials. Its proxy reaches approved model providers at frozen addresses and nothing else.

The metaphor I keep coming back to is a valet key. A valet key starts the car and drives it around the block. It does not open the trunk, and it does not open the glovebox where the registration lives. It cannot wander off to arbitrary corners of the internet, because the proxy does not know those corners exist.

That is a tradeoff, and I made it on purpose. A pinned image means upgrades are deliberate instead of ambient. Frozen provider addresses mean a new provider is a change I make, not a URL the agent discovers. Both cost me convenience. Both buy me the ability to let someone else drive.

Roles decide who even sees the tool

Connect grants a role per resource, such as workbench:member or workbench:admin. Pi follows that split. Admins see the Pi tool in Workbench. Members do not. Pi Web is its own published app with its own grant, separate from that tool.

My reason for roles was simple. I needed a view of the whole system. A tester only needed what I was showing them. On September 12 and 13, when I exposed Pi to a few developers, I asked for the steps to set up a Pi-only user: someone granted Pi Web and nothing else.

Images become text before the model sees them

Images were the next problem. Between September 21 and 23 I worked through how Pi should handle them.

The answer was to split the job. A vision model reads the image, and the main model gets only text. It shipped as pi --observation. The main coding model never has to be a vision model, which keeps my model choices independent, and what flows into the agent’s context is a description it can reason over rather than a blob it has to interpret. It is the same instinct as the proxy: decide exactly what crosses each line, and make it the simplest thing that does the job.

What broke, and how it broke

A managed session is a promise that the person on the other side does not need to know how it works. Every failure here broke that promise in a way they could see.

Sessions stuck on working. Pi would show that it was working and stay there. For me in a terminal, that is a process I can inspect and kill. For someone in a browser, it is a spinner and a guess. A stuck indicator is worse than an error, because an error at least tells you to stop waiting.

Compaction failing. Long sessions need compaction, where the agent condenses its history so it fits. Compaction failed in two ways. Some requests came back as 413 errors, request too large. Others came back as 500 errors reading no available tier. Either way, the conversation could not continue.

Model crashes wearing a gateway’s face. When a model crashed underneath, it showed up as a 502. A 502 tells you the gateway got no usable answer from what sits behind it, which is true and also useless. It points every eye at the front door when the problem is several layers back.

Switching between Pi Web and the CLI. Moving the same work between Pi Web and the CLI broke it. Two front ends on one agent is a coordination problem, the same one you get when two teams share a service and neither owns it.

Agents pushing red builds. Agents pushed changes that failed CI until I told them to validate first. This is the organizational lesson in miniature. You would not let a new engineer push without running the tests. An agent is not exempt because it types faster.

None of these were exotic.

Two things I said no to

The first was a separate Pi dashboard. It was tempting, because Pi has enough moving parts to justify its own surface. But a second dashboard is a second door, with its own sign-in story and its own drift. Workbench is the one control plane. Pi lives inside it, behind the same roles, or it does not live there at all.

The second was forking third-party Pi extensions. Forking feels like control. It is actually a subscription to someone else’s upstream that you pay for forever. I install those extensions directly and track that in my AI infrastructure repo instead, so what is running is written down without me carrying a private copy of someone else’s work.

The limits

A member got a shared Pi workspace with no separate permissions inside it. Sign-in was per user. The workspace behind it was not. That is an isolation gap, and it is the kind that does not show up until two people are in it at once. OpenShell later became the sandbox for every Connect user but me, and I cover that in the post on Hermes in a sandbox.

The bridge that connects Pi Web to Pi is pinned to my own fork, and I re-pinned it many times between September 22 and October 5. That is maintenance debt with my name on it. A bridge that needs constant re-pinning is a chore, not infrastructure. The same principle that kept me from forking extensions applies here, and I did not hold myself to it.

If I did this again, I would change the order. Isolation comes before sharing. I shared first because I wanted the feedback, and the shared workspace was the cost of that order.

The boundary was the work

The coding agent was never the hard part. Pi already worked for me at the command line before anyone else touched it. The work was everything around it: what Pi can reach, who can see it, what crosses each line, and what a person sees when something several layers back falls over.

When you expose a powerful tool to people who do not share your context, remember which part is yours to give. The tool’s power is yours to lend. Where it stops is yours to build, and that part takes longer.

0 claps

Enjoyed this? Tap to applaud, hold to really applaud.

Share this post
LinkedInXHacker NewsBluesky

Co-authored with AI, based on the author's working sessions, dictations, and notes.

Explore the source

fakoli/anvil-serving

This article discusses an open-source project. Star it, fork it, or open an issue.