aaronrussell

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.

Showing Posts 1 to 6

jeremyjh

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

aaronrussell OP

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 - and Host.File for file operations. If they try and call File or Req directly 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

jeremyjh

I actually forgot I’d added exposePorts to 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

aaronrussell OP

I have, yes. It was an enlightening experience :laughing: - 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

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

aaronrussell OP

Released v0.1.1 today. A very small update with a few security focused tweaks:

  • The default security policy closes a few more ways that would allow agent code to call a module out of the policy’s sight.
  • The docker image sets up iptables to keep agent code (and escaped code) off your network and other protocols.
  • Based on the discussion above, a rewritten security guide.

Running Beamlet now requires the --cap-add NET_ADMIN flag, so the firewall gets enabled.

docker run -d \
  --name my-beamlet \
  --cap-add NET_ADMIN \
  -p 4000:4000 \
  -v beamlet_data:/data \
  -e BEAMLET_URL=http://localhost:4000 \
  ghcr.io/aaronrussell/beamlet:0.1
— All posts loaded —

Where Next? Top

Trending in Announcing Top

achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New
bartblast
If you haven’t tried Hologram yet, what’s stopped you? Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
mat-hek
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn: This is possible because it now builds on a very stab...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews