aaronrussell
Beamlet is an Elixir server that your AI agent builds from the inside. Connect your favourite AI client over MCP and ask for a page, an API or a small app. The agent writes it as Elixir modules that become part of your running server, and the result is live straight away.
The easiest way to explain it is to show it (sped up, about 1m20s):
Under the hood
The agent has three MCP tools, eval, define and patch, and everything else is plain Elixir:
- Modules compile into the running VM and are saved as source files, so they survive a restart.
- Agents write ordinary Phoenix controllers and LiveViews and mount them. Routes go live without a restart or a deploy.
- Agent code gets a SQLite database with real Ecto migrations, a key/value store, PubSub, a files directory and outbound HTTP.
- The agent finds its way around by reading module docs. When it gets something wrong, the errors tell it what to do instead.
- Every change is a git commit, with the token that made it as the author.
Nothing carries over between chats except what’s on the beamlet. A new chat, or a different client, picks up where the last one left off.
Security
It’s remote code execution by design. A beamlet has one owner, and each client you connect gets its own token. Each token has a policy that sets what agent code may call, along with limits on run time, memory and output. A policy is a guardrail that helps steer an agent, but it is not a sandbox. The Security guide covers more.
Try it
docker run -d --name my-beamlet \
-p 4000:4000 \
-v beamlet_data:/data \
-e BEAMLET_URL=http://localhost:4000 \
ghcr.io/aaronrussell/beamlet:0.1
docker exec -it my-beamlet beamlet setup
Then sign in at localhost:4000/beamlet, which shows you how to connect your client.
This is 0.1.0, so it’s early and things will change. It grew out of some code-mode experiments in Omni. If you give it a try, I’d love to hear what you build with it.
- Hex
- GitHub:
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex











Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
jeremyjh
This is a really cool idea. I think the security docs need some advice about sandboxing, not just disclaiming it. The threat is not just someone else controlling the beamlet, but also giving a coding agent the run of a remote server (even if disposable).
There are lots of tools but GitHub - anthropics/sandbox-runtime: A lightweight sandboxing tool for enforcing filesystem and network restrictions on arbitrary processes at the OS level, without requiring a container. · GitHub is a pretty decent compromise between utility and security with good defaults, and it works on Mac (seatbelt) and Linux (bubblewrap).
aaronrussell
Thanks. I will make a point to expand the security note - I understand this is the main thing people are going to ask about Beamlet. My current advice is to run it in Docker or on Fly etc, which contains the filesystem, but you’re right that it doesn’t stop escaped code using the box. There may be more we can advise here - resource limits, restricting outbound traffic at the network level etc.
I’m not sure SRT helps, as Beamlet is a web server and I don’t think there’s a way to expose ports with SRT (although very possibly I don’t understand SRT that well either).
I should point out that Beamlet doesn’t just let any code in. Everything gets scanned according to the token’s policy. Lots of standard APIs are denied. Agents have to use
Host.HTTP- andHost.Filefor file operations. If they try and callFileorReqdirectly they’ll be denied and pointed in the right direction. The challenge is preventing the models from executing arbitrary code using imaginative ways that get round the scanner. There are a few ways that I’m aware of, and I’m sure there are others that I don’t know about. There is a kind of whack-a-mole ness to it (and the models are clever rascals that seem to relish a good sandbox-escaping challenge). So the honest position is you have to assume a model with a token does have full access, even if in most normal honest use the scanner will do its job.jeremyjh
I actually forgot I’d added
exposePortsto SRT in my fork. I hadn’t really planned to try to upstream or support that so you are right, not something we’d want to recommend. I’d think they have to support it at some point since so many agents have built in web UIs now but I’ve not been tracking it, I just have my agent add whatever I need.This is fine as defense in-depth but this can’t be something you rely on; you are supporting eval of code that is not evaluated deterministically, right? Have you had an agent do any adversarial testing?
aaronrussell
I have, yes. It was an enlightening experience
- also quite frustrating as classifiers get in they way. “Am I f*cked? Yes. How do I fix it? Can’t tell you that mate.”
The way I see it the methods of breaking out exist on a scale of obscureness. The further along the scale, the more “tricksy” the method is. How far along the scale the scanner protects is a judgement call, but it’s never going to be able to cover it all. That’s why I call it a guardrail. When a model writes code that bumps into it, it’s steered in the right direction. I think for low-risk usage (curious developer, using docker, kicking the tyres) this is OK for v0.1.
In a situation where an agent does break out, something like SRT that wraps around the process - rather than something inside Elixir - is almost certainly the right call. I will explore this more and see what options are out there.
jeremyjh
I don’t think you have to provide a solution, just a warning and maybe some references. GitHub - restyler/awesome-sandbox: Awesome Code Sandboxing for AI · GitHub
aaronrussell
Released
v0.1.1today. A very small update with a few security focused tweaks:Running Beamlet now requires the
--cap-add NET_ADMINflag, so the firewall gets enabled.