Sandbox
Alfred can write and run code for you. All of it happens in a sandbox, which is an isolated environment that gets created for the work and thrown away afterwards.
There are two flavours of it, and Alfred picks between them based on the job.
Code Runner
Section titled “Code Runner”Code Runner is the quick one. Alfred writes a bit of Python or JavaScript, runs it, and uses the result.
It’s good for:
- Maths, data crunching and unit conversions where you want an actual answer instead of a guess.
- Parsing or reshaping a file you uploaded.
- Generating a chart or a table from raw numbers.
- Any small task where code is more reliable than the AI doing it in its head.
Code Runner is quick and cheap, and Alfred reaches for it on his own when a question is better answered by running something than by reasoning about it.
Sandbox VM
Section titled “Sandbox VM”Sandbox VM is the heavy one. It’s a full Debian machine that Alfred gets a shell on, with sudo, package installs, and network access. Each conversation has its own, and a job keeps one across all its shifts.
It’s good for:
- Cloning a repo, running it, building it, and opening a pull request. See GitHub.
- Rendering, converting and exporting media: video, audio, images, documents.
- Anything that needs real tools installed rather than a single script.
- Longer multi-step work where Alfred needs a place to keep files while working.
Inside the VM, GitHub, your Cards, your drive and your places are already connected, so Alfred can clone your repos, read your cards and work on your files without you handing over anything. Alfred can also publish a file he generated in there and give you a public link to it.
What’s in it
Section titled “What’s in it”Every sandbox starts from a ready-made machine, so a new one starts quickly with the usual tools already there:
- Node with npm, pnpm and bun; Python with pip, venv and uv.
- Build tools and git, the GitHub CLI, jq, ripgrep, fd and sqlite.
- ImageMagick, ffmpeg and pandoc for images, audio, video and documents.
- A Chromium browser, which is what Alfred uses to look at pages he made. See Places.
Anything else, he installs as he needs it. The machine is kept up to date with security fixes.
What lasts
Section titled “What lasts”A sandbox closes once it’s been left idle for about half an hour, and the next time Alfred needs one he starts a fresh one and says so. Installs and anything left lying around go with it. Two folders don’t:
~/workis backed up into your drive while Alfred works: a minute after he runs something, and every few minutes while it keeps changing. When a new sandbox replaces one that closed, or one you asked him to swap for a fresh one, that conversation’s~/workis put back as it was last backed up. Backups are kept hourly for a day and daily for a week, and count against your drive’s room. Big rebuildable things, likenode_modules, virtual environments and build output, are left out, as are files over 64 MB.~/driveis your drive itself. A file saved there is in your drive. See Drive.
So for anything that takes more than one sitting, the project lives in ~/work and the finished files go in ~/drive. “Save your work” makes Alfred back up ~/work right away, which is worth doing before you ask him for a fresh sandbox, since that brings back the last backup.
Bringing ~/work back can take a little while on a big project, and Alfred holds off writing there until it’s done. If something was written into ~/work in the meantime anyway, it isn’t lost: that folder is moved aside to ~/work.meanwhile-<time>, kept and backed up beside the restored one. A restore that keeps failing is given up after five tries or six hours, and you’re told. The earlier work is still in its backup, and the new sandbox carries on with ~/work as it is.
A sandbox that can only read your drive gets earlier work back but doesn’t back up its own; a job keeps its own record of where it got to instead.
Running something in the background
Section titled “Running something in the background”Alfred can start a long process (a build, a render, a server) in the background of his sandbox and get on with the conversation. With a watch on it, he picks the conversation back up when it prints something he’s waiting for, or when it finishes. A watched process keeps its sandbox open for up to a day.
Access levels
Section titled “Access levels”Every sandbox is opened at one of three levels, and keeps that level for as long as it lives:
| Level | What it reaches |
|---|---|
| Normal | Your drive, GitHub, Cards and your places, as far as the conversation allows. The default. |
| Drive read-only | The same, but the drive can only be read. |
| Isolated | Nothing of yours at all: no drive, no GitHub, no Cards, no places, no keys. Just the internet. |
Isolated is for code nobody should trust: a repository you’re not sure about, something you downloaded, a suspected piece of malware you want looked at. Nothing from an isolated sandbox is uploaded, shown to you as an image, backed up or restored, and Alfred reads what it prints as somebody else’s text, never as instructions. It’s a separate machine, so a normal sandbox never ends up running where untrusted code ran. You can ask for it: “look at this repo in an isolated sandbox”.
Which level a request gets depends on who it’s for:
- A turn in your own private conversation uses the conversation’s normal sandbox, with your drive writable. That includes turns Alfred starts there himself: a reminder going off, a watch firing, a background task finishing.
- Work nobody is reading (a job, a background agent, a reflex’s code, a helper Alfred hands part of a task to) gets a drive read-only sandbox of its own, never the conversation’s normal one. A job keeps its own across all its shifts.
- Anything a visitor or a webhook set off never reaches your things. A turn a visitor’s submit started can’t use the sandbox at all, and code a visitor’s event set off runs isolated.
- A channel other people can read gets a sandbox that reaches none of your things: no drive, GitHub, Cards or places.
A request can ask for less than it may have (“check this in an isolated sandbox”), never more. Each conversation keeps a sandbox per level, so asking for less doesn’t throw the normal one away.
Safety
Section titled “Safety”Your credentials are never inside the sandbox. Authentication happens in a proxy layer outside of it, so the sandbox gets access without ever holding your tokens.
That matters because sandboxes run code, and some of that code comes from the internet. Even if something malicious ended up running in there, there’s no GitHub token or account credential sitting in the environment for it to steal.
The same goes for keys you give Alfred for other services: code sends them through the proxy, which fills them in on the way out. See Secrets and webhooks.
The sandbox is also isolated per run. It can’t reach your other conversations, your Dashboard session, or anything else on your account beyond what Alfred was explicitly given access to. A conversation only ever uses sandboxes it opened itself, never another conversation’s or a job’s, and in a channel other people can read, the sandbox reaches none of your things.
Automation
Section titled “Automation”Reflexes run in the same sandbox, which is what makes them cheap enough to fire all day. A reflex handler is just code running in a sandbox with access to Alfred’s tools, no AI in the loop.
Enabling it
Section titled “Enabling it”Code Runner and Sandbox VM are both modules, so you can turn either off from the Modules Page if you’d rather Alfred didn’t run code at all. See Modules.