Create isolated sandboxes and runtime environments in seconds. Build AI agents, run untrusted code safely, or deploy cloud workers—all with a simple API.
Start new environments in under a second. No waiting, just instant sandboxes ready to run your code.
Every sandbox runs in complete isolation. Safe to run untrusted code without worrying about security.
Control everything with a few lines of code. Create, monitor, and manage sandboxes programmatically.
Use the Python SDK or web console to create and manage your sandboxes. Run code, stream logs, and get results—all with just a few lines of code.
Perfect for AI agents, testing code, running CI/CD jobs, or any task that needs a clean, isolated environment.
Try the console →pip install microvm-magpie
from magpie import Magpie
client = Magpie(api_key="YOUR_API_KEY")
# Create a sandbox and run code
run = client.jobs.create(
name="my-sandbox",
script="python my_script.py",
vcpus=4,
memory_mb=8192,
)
# Wait for it to complete
result = client.jobs.wait_for_completion(
run["request_id"]
)
print(result.status, result.exit_code) Customize CPU and memory for your needs.
Run quick tasks, save your work between runs, or keep environments running—you choose.
| Option | What it does | Best for |
|---|---|---|
persist | Keep the sandbox running after your code finishes | Development shells, long-running services |
stateful | Save files between runs in a shared workspace | Caching dependencies, saving progress |
ip_lease | Get a direct network address for SSH/HTTP access | Remote access, web servers, debugging |
Run code and automatically clean up when done. Great for:
Keep files between runs to speed things up:
Keep sandboxes alive and connect remotely:
Combine options for more flexibility:
Use Magpie for any task that needs a clean, secure environment.
Let AI agents run code safely in isolated sandboxes. Perfect for coding assistants that need to execute and test code.
Train machine learning models with custom CPU and memory. Save checkpoints between runs to resume training.
Run background tasks, process webhooks, or handle scheduled jobs. Scale up as needed automatically.
Run untrusted user code safely in isolation. Great for online coding platforms and educational tools.
Run tests and builds in clean environments every time. Cache dependencies to speed up repeat runs.
Process data with the resources you need. Monitor progress in real-time and get results when done.
# Create a sandbox with SSH access
vm = client.jobs.create_persistent_vm(
name="dev-box",
script="echo ready",
ip_lease=True,
)
print("Connect at:", vm.ip_address)
# Run commands remotely
result = client.jobs.ssh(
vm.request_id,
"git clone https://github.com/myrepo"
)
print(result.stdout) Connect to running sandboxes from anywhere.
# First run: install dependencies
first = client.jobs.run_and_wait(
name="setup",
script="pip install -r requirements.txt",
stateful=True,
workspace_size_gb=10,
)
# Next run: reuse the workspace
second = client.jobs.run_and_wait(
name="train",
script="python train.py",
stateful=True,
workspace_id=first.request_id,
) Reuse installed packages and files across runs.
Save sandbox configurations as templates you can reuse. Great for creating self-service tools for your team.
Watch logs stream in real-time as your code runs. See what's happening and monitor progress instantly.
Run Magpie on your own infrastructure for full control. We can help you set it up and manage it.
Write your code or choose a template. Pick how much CPU and memory you need. Decide if you want to save files or keep it running.
Your code starts in seconds in a clean, isolated environment. Create as many sandboxes as you need.
Watch logs in real-time, get results, or connect via SSH. Stop jobs anytime or let them finish automatically.
Create your first sandbox in minutes. No credit card required.