Securely run AI-generated code in stateful sandboxes that run forever.
npx forevervm signup
oruvx forevervm signup
ForeverVM is a code execution API that allows you to securely run arbitrary Python code in a remote sandbox and get back results.
Unlike traditional code interpreters, ForeverVM does not have a concept of a session after which state expires. Instead, ForeverVM uses memory snapshots to swap idle machines to disk for as long as you want. This improves scalability and resource usage, and means that applications and agents built on ForeverVM don't have to manage session lifecycles.
Once you have created a ForeverVM machine, you can interact with it through a REPL (read-eval-print loop) interface. ForeverVM will assign the machine to an available worker while it is actively in use.
When a sandbox is idle, its memory is snapshotted before it is “detached” from the worker.
As long as the sandbox remains inactive, it only consumes storage space, not compute or memory resources.
The next time an instruction for the sandbox is received by the API, it is assigned to a new worker and resumed from its last snapshot.
These implementation details are hidden from the outside world. To applications built on ForeverVM, a machine is just a long-lived REPL that is always ready to run code.
The ForeverVM CLI allows you to create machines and start REPL sessions with them. It is distributed through major package managers. Source and binaries are also available on GitHub.
npx forevervm login
npx forevervm repl
npx forevervm --help
uvx forevervm login
uvx forevervm repl
uvx forevervm --help
pip install forevervm
forevervm login
forevervm repl
forevervm --help
cargo install forevervm
forevervm login
forevervm repl
forevervm --help
Start a machine:
from forevervm_sdk import ForeverVM
fvm = ForeverVM(token=API_TOKEN)
fvm.create_machine()
{ "id": "YGBm-MFSd-mb263bQRUcc" }
import { ForeverVM } from "@forevervm/sdk";
const fvm = ForeverVM({ token: API_TOKEN });
await fvm.createMachine();
{ id: "YGBm-MFSd-mb263bQRUcc" }
Run code:
from forevervm_sdk import ForeverVM
repl = ForeverVM(token=API_TOKEN).repl()
fvm.exec("8 + 123").result
{
"value": "131",
"runtime_ms": 9
}
import { ForeverVM } from "@forevervm/sdk";
const repl = ForeverVM({ token: API_TOKEN }).repl();
await repl.exec("8 + 123").result;
{
value: "131",
runtime_ms: 9
}
More examples are avilable in our documentation.
ForeverVM is available as a Model Context Protocol (MCP) server. You can add ForeverVM as a tool for Claude Desktop and other MCP Clients.
Find the ForeverVM MCP server on Github. Or read our docs for setup instructions.
More examples are available in our documentation.
npx forevervm signup
oruvx forevervm signup
ForeverVM is designed with enterprise needs in mind, including running in your own AWS account. If you're interested, fill out the form below to set up a call.