r/PiCodingAgent • • 11d ago

Resource I built Headless Pi (hpi): the normal Pi experience, but headless, on top of Pi Durable

Hello guys!

It is not a secret that Pi Durable is hard to use as a coding agent. It is quite easy to build products on top of it, but if you want it to replace normal Pi, Claude Code or Codex for your daily work, it simply requires too much effort. You have to wire up everything from zero, not even the basic barebones are in place for that kind of work, and you end up reinventing the wheel each time.

So I built Headless Pi (hpi). The intuition is very simple: I wanted the experience of normal Pi, where you cd into a project and just start working, but headless.

Basically it is one local daemon that hosts persistent Pi Durable harnesses. A harness belongs to a project folder and has many conversations. On top of that there is a TypeScript SDK, and a CLI that uses the same SDK:

hpi daemon start
hpi harness start --name worker
hpi conversation create --model openrouter/openai/gpt-4.1-nano
hpi send 'Inspect this project' --wait
hpi watch

The daemon brings the running harnesses back after a restart, and the activity (messages, thinking, tool calls, tool results) is stored, so a client can disconnect and continue later from where it was.

Beyond hosting the harnesses, for now it only does two things. It automatically loads the extensions you put in <project>/.hpi/extensions/, and it supports multiple accounts for the same provider, so you can do hpi auth login anthropic --account work and then use the models as anthropic@work/<model>.

And that's it, it is minimal and unopinionated on purpose. There are no built-in tools, no automatic system prompt, no AGENTS.md loading, no skills and no global agent directory. If you want any of those, you write an extension for it. All of these can come in the future if people (and me) ask for them, but I wanted to start explicitly minimal and not decide for you how your agent should look.

The thing I don't understand tbh is why this didn't exist already. When Pi Durable launched I expected something like this to come out the day after, because the idea is so obvious: take the thing everybody already likes about Pi and make it run without a terminal. But it never came, so I built it myself.

This is also the other reason I keep it minimal. I think the idea is so obvious that the Pi maintainers will release their own version sooner or later, and I really don't want to maintain a parallel implementation of it. So I'm trying to save as much work as possible. But meanwhile we got hpi.

So far I have built a few things with it. The main one is an agent for my team that lives in Slack, Linear and GitHub, where each one is a small independent service that receives the webhooks and talks to the same harness through the SDK. I also built a small local web UI to chat with it and work on documents together, and an MCP extension. I will write another post about that setup, because it deserves its own.

Keep in mind that this is still an experimental project:

  • It only works on Linux with systemd user services.
  • It is not on npm yet, you install it from the repo.
  • Pi coding agent extensions don't work as they are, they need to be adapted to Durable.
  • All extensions run inside the daemon process, so one bad extension can affect every harness.
  • Things can change and break. I use it every day, but I'm the only one who has.

Repo: https://github.com/elpapi42/headless-pi

If you try it, or if you solved the same problem in another way, I would really like to hear about it. And if something like this already exists and I missed it, tell me too.

24 Upvotes

14 comments sorted by

2

u/bdixisndniz 11d ago

Quick search: https://a.skh.am/pi-daemon/

How does yours differ?

2

u/elpapi42 11d ago

I will check it!

1

u/bdixisndniz 11d ago

Cool no idea. This kinda thing looks good though!

Been wanting to set something up at work for various automations. Let’s see if I actually set aside some time tomorrow lol.

1

u/firebat-66 8d ago

Any opinions on the pi-daemon? SASUKE hasn't made a commit in 3 months or so...

2

u/Sad-Situation-1782 10d ago

Is there a github repo?

2

u/scratchingPaintjobs 10d ago

There is no public one, hopefully he answers to clarify: https://github.com/harryaskham/agent-utils/issues/38

1

u/Training_Yoghurt501 11d ago

This is awesome! Great work

I use this at the moment (made by my friend) for agentic automation pipelines (e.g. automatically pick up dependabot PRs for review and merge): https://github.com/cheenulabs/pi-agent-python-sdk

It uses pi-coding-agent through RPC mode, so we get all of our pi-extensions through it.

Sorry if this is a dumb question - why use durable over pi-coding-agent ?
Would it be worth having a pi-durable-python-sdk? I can ask my friend to work with you on it, he'd be keen.

5

u/elpapi42 11d ago

I think pi-durable is the future, thats all the reason to be honest, the technical design is simply superior to pi agent in all ways, i see Mario and thers learned a lot from their experience with pi agent.

Designing extensions in pi durable is a lot easier than in pi agent, they learned from how users hacked the extensions api to create extension and designed native solutions in the pi durable api.

Also pi durable reliability and conversations model makes it ideal for always on agents, where i personally think we are heading, for everything from coding agents to personal assistants

this is my humble opinion of course and the reason behind movin to pi durable

2

u/Oshden 10d ago

+1 👆🏼

1

u/firebat-66 9d ago

Just wanted to reach out and ask if you' are familiar with deepseek harness and the cordis architecture, mostly for me to juxtapose your implementation vs a cordis based system

1

u/elpapi42 9d ago

i have estudied it few times already, but i can not say im a subject matter expert, but i would love to read what you have to say!

1

u/firebat-66 9d ago

Will DM you

1

u/rayishu 9d ago

Is there a docker image?

1

u/elpapi42 9d ago

Not for now, daemon interface is simply ZeroMQ over OS sockets, so i really dodnt think of containerizing this.

But this makes me think that setting the protocol to http would make this better for remote or distributed setups, and a docker image + containers of course.

Will find the time for this change next week or something