by jamsocket
Run AI-generated Python code securely in persistent, stateful sandboxes that can stay active indefinitely.
ForeverVM provides an API and command‑line interface for creating and interacting with stateful Python "machines". Each machine runs one instruction at a time, preserving its execution state across sessions, and can be swapped to disk when idle, enabling truly long‑running REPL sessions.
npx forevervm login
npx forevervm repl
npx forevervm repl <machine_name>.npx forevervm machine list
import { ForeverVM } from '@forevervm/sdk'
const fvm = new ForeverVM({ token: process.env.FOREVERVM_TOKEN })
const repl = fvm.repl()
const result = await repl.exec('4 + 4')
console.log('result:', await result.result)
fvm.createMachine({...}).Q: Do I need to manually stop a machine? A: No. Machines automatically swap to disk when idle and are removed according to the service’s retention policy.
Q: How is security enforced? A: Code runs inside sandboxed containers with restricted filesystem and network access, isolating it from the host.
Q: Can I run non‑Python code? A: The current platform is Python‑only; other runtimes are not supported.
Q: How do I set resource limits?
A: Use the memory_mb field when creating a machine via the SDK.
Q: What happens to stdout/stderr?
A: Execution results include an async iterator of output objects, exposing both stdout and stderr streams.
| repo | version |
|---|---|
| cli | |
| sdk |
foreverVM provides an API for running arbitrary, stateful Python code securely.
The core concepts in foreverVM are machines and instructions.
Machines represent a stateful Python process. You interact with a machine by running instructions (Python statements and expressions) on it, and receiving the results. A machine processes one instruction at a time.
You will need an API token (if you need one, reach out to paul@jamsocket.com).
The easiest way to try out foreverVM is using the CLI. First, you will need to log in:
npx forevervm login
Once logged in, you can open a REPL interface with a new machine:
npx forevervm repl
When foreverVM starts your machine, it gives it an ID that you can later use to reconnect to it. You can reconnect to a machine like this:
npx forevervm repl [machine_name]
You can list your machines (in reverse order of creation) like this:
npx forevervm machine list
You don't need to terminate machines -- foreverVM will automatically swap them from memory to disk when they are idle, and then automatically swap them back when needed. This is what allows foreverVM to run repls “forever”.
import { ForeverVM } from '@forevervm/sdk'
const token = process.env.FOREVERVM_TOKEN
if (!token) {
throw new Error('FOREVERVM_TOKEN is not set')
}
// Initialize foreverVM
const fvm = new ForeverVM({ token })
// Connect to a new machine.
const repl = fvm.repl()
// Execute some code
let execResult = repl.exec('4 + 4')
// Get the result
console.log('result:', await execResult.result)
// We can also print stdout and stderr
execResult = repl.exec('for i in range(10):\n print(i)')
for await (const output of execResult.output) {
console.log(output.stream, output.data)
}
process.exit(0)
You can create machines with tags and filter machines by tags:
import { ForeverVM } from '@forevervm/sdk'
const fvm = new ForeverVM({ token: process.env.FOREVERVM_TOKEN })
// Create a machine with tags
const machineResponse = await fvm.createMachine({
tags: {
env: 'production',
owner: 'user123',
project: 'demo'
}
})
// List machines filtered by tags
const productionMachines = await fvm.listMachines({
tags: { env: 'production' }
})
You can create machines with memory limits by specifying the memory size in megabytes:
// Create a machine with 512MB memory limit
const machineResponse = await fvm.createMachine({
memory_mb: 512,
})
Please log in to share your review and rating for this MCP.
{
"mcpServers": {
"forevervm": {
"command": "npx",
"args": [
"forevervm"
],
"env": {
"FOREVERVM_TOKEN": "<YOUR_API_KEY>"
}
}
}
}claude mcp add forevervm npx forevervmExplore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.