ForeverVM

ForeverVM

Run Python in a code sandbox.

224
Stars
21
Forks
20
Releases

Overview

foreverVM offers a secure API to run Python code in isolated, stateful environments called machines. Each machine represents a Python process with its own execution state, and you interact with it by sending Python statements or expressions as instructions, receiving results one instruction at a time. Machines persist across interactions, enabling long-running REPL-style sessions. The platform provides both a CLI and an SDK for programmatic access: login, create or connect to machines, and execute code via repl.exec. Machines can be created with memory limits (memory_mb), ensuring controlled resource usage. Idle machines are automatically swapped from memory to disk and swapped back when needed, allowing “forever” repls without consuming active memory. You can create machines with tags and filter/list by tags (e.g., env, owner, project). Output can be streamed, including stdout and stderr, so you can print results and iterate over execution output. The API usage demonstrated includes token-based authentication and interacting with repls to run and observe Python code.

Details

Owner
jamsocket
Language
Rust
License
MIT License
Updated
2025-12-07

Features

Stateful Python machines

Each machine is a stateful Python process with its own execution state, enabling ongoing interaction and persistence across instructions.

Instruction-based execution

Interact with a machine by sending Python statements and expressions; the machine processes one instruction at a time and returns results.

REPL interface and lifecycle

Use a REPL-like interface to connect to new machines and obtain IDs to reconnect later, enabling continuous work sessions.

Automatic memory-to-disk swapping

Idle machines are swapped from memory to disk and swapped back on demand, enabling long-running repls without high memory usage.

CLI and SDK access

Interact via the CLI (e.g., login, repl, machine list) and via the ForeverVM SDK for programmatic control.

Stdout and stderr capture

Execute code and stream both stdout and stderr for real-time observation of output.

Memory limits

Create machines with memory_mb to cap RAM usage (e.g., 512MB) for controlled resource consumption.

Tag-based machine management

Create machines with tags and filter or list them by tags (e.g., env, owner, project) for organized management.

Audience

DevelopersUse ForeverVM's API/CLI/SDK to run Python code in isolated, stateful machines for experimentation and testing.
DevOps / SREsProvide secure, memory-limited Python sandboxes for automated tests, experiments, and reproducible runs.
Platform integrators / SDK usersEmbed ForeverVM into apps or workflows using the SDK to execute Python code in sandboxed machines.

Tags

Pythonsandboxsecure executionstateful machinesinstructionsREPLCLISDKmemory limitstagsauthenticationoutput streamingdisk swapping