Over the past couple of weeks, I got pretty intrigued by the rise of OpenClaw and agent harnesses like Pi.
At some point, I decided I wanted to make my own in order to learn how these things work. I learn by doing, and it seemed like a fun project. So I started building my own OpenClaw in TypeScript--but at some point realized I'd rather start from first principles, so instead I shifted focus towards building my own agent harness.
Something curious happened though: the more I looked at the problem space (agent system, running tools, etc)--the more it looked like Erlang/OTP to me. I had a hunch that Elixir would be a great fit for this problem.
I started building it and effectively, yes! It was a great fit. The agent loop maps perfectly to an Erlang GenServer/gen_fsm, parallel tool execution is easy by just spawning cheap Erlang processes, and multiple agents/subagents can be isolated in one system as separate supervision trees. This is all a lot of stuff I would've had to reinvent if another language was used.
Erlang/OTP is an amazing system. This setup gives me incredible observability into running agent systems--I can remote iex to the server binary and manipulate the system, end tool execution. The agent can debug itself by connecting to its own running instance. And, in the future, you can probably network these using Erlang distribution as well!
So far, in terms of features, the harness is minimal but packs a punch.
- Read/write files
- Shell calls
- Multiplatform
- Subagent support
- Asking questions
- Nice CLI :)
All in all, this project has been very fun to build. It's finally at the point where it's building itself and that's very rewarding to watch.
https://github.com/matteing/opal
Take a look at the GitHub, drop a star, and let me know any feedback? It's my first time building an agent system, so any input is welcome. Thank you!