Skip to content
useMagicMtnPublic

About

Open-source sandboxes/VMs and model inference for coding agents on your own infrastructure.

Topics

Resources

Contributing

Security policy

Stars

37 stars

Watchers

3 watching

Forks

Latest commit

 

History

205 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MagicMtn—Distributed compute for agents

MagicMtn logo

Latest release Apache 2.0 license Code coverage

MagicMtn Docs  •  Provider Registry  •  Contributing  •  Cloud service

Distributed inference and sandboxed compute platform for agents. The open-source edition of MagicMtn Cloud that runs on your own infrastructure.

  • Inference — Run agent workloads with models from providers such as Amazon Bedrock, SageMaker, and Ollama.
  • Sandboxed compute — Run agent commands in isolated environments, from Apple Container on a Mac to microVMs on Linux or AWS.
  • CLI — Use magic to manage sandboxes, execute commands, and install providers.
  • Provider SDK — Build and package your own inference or compute providers in Rust.
  • Agent integrations — Connect Pi and OpenCode to MagicMtn workspaces, or expose sandbox tools to other MCP clients.

Demo

cli-pi-demo.mp4

Launch a cloud agent from Pi, disconnect while it keeps running, then SSH into the machine MagicMtn provisioned.

Getting Started

Install the MagicMtn CLI

Run the installer on macOS or Linux.

curl -fsSL https://magicmtn.ai/install.sh | sh

The shell installer counts completed installs. To opt out, run curl -fsSL https://magicmtn.ai/install.sh | MAGIC_NO_INSTALL_ANALYTICS=1 sh.

On macOS, you can also use Homebrew.

brew install useMagicMtn/tap/magic

See the CLI installation guide for more options.

Run your first local sandbox

Install Apple Container.

Start Apple Container and install the MagicMtn provider:

container system start
magic provider install apple-container

If you previously signed in to MagicMtn Cloud, run magic logout. Start the local server in its own terminal and keep it open:

magic server start

In another terminal, prepare the bundled Canonical image, create a sandbox, run a command, and delete the sandbox:

magic images prepare canonical --provider apple-container
sandbox_id=$(magic computer new --image canonical --provider apple-container)
magic computer exec "$sandbox_id" -- /bin/echo "hello from the sandbox"
magic computer terminate "$sandbox_id" --yes

The command result includes hello from the sandbox. Run magic server stop when finished. See the local server guide for custom images, configuration, and cleanup.

Add inference with Modal and Pi

Use Modal for inference while Pi works inside a MagicMtn Canonical 1 VM on your Apple silicon Mac. MagicMtn manages Pi, the inference connection, and the sandbox lifecycle.

Install Modal and set up access

Install the Modal provider and the Apple Container provider from the MagicMtn Registry:

magic provider install modal
magic provider install apple-container

Create a Modal workspace API token with access to manage endpoints and Proxy Tokens. Save it as modal-credentials.json:

{
  "MODAL_TOKEN_ID": "YOUR_TOKEN_ID",
  "MODAL_TOKEN_SECRET": "YOUR_TOKEN_SECRET"
}

Start the local server in its own terminal and keep it open:

magic server start

In another terminal, configure Modal:

magic provider configure modal --secret-file ./modal-credentials.json

This establishes access to your Modal account. Model selection determines which inference resource MagicMtn provisions; the provider manages its endpoint and credentials.

Prepare local isolation with Apple Container

Install Apple Container on your Apple silicon Mac, start its runtime, and make the Canonical image available to it:

container system start
magic images prepare canonical --provider apple-container

Run MagicMtn-managed Pi

Install Pi, then install the MagicMtn Pi integration and open Pi:

magic agents install pi
pi

In Pi, run /magic default and select Kimi K3 with Modal as the inference provider. Run /magic new and choose Apple Container as the sandbox backend.

MagicMtn starts Pi inside the local VM and routes its model requests to your Modal endpoint.

Example: Ask Pi to work in its isolated workspace:

Create a Python script in /computer that prints the first 20 Fibonacci numbers, run it, and show me the output.

Press Ctrl+] to disconnect while Pi keeps running. Use /magic view and choose Resume to reconnect, or Terminate to delete the workspace when finished.

Bonus: isolation with Modal sandboxes

Run the same Pi workflow inside a sandbox in your own Modal account.

Reuse the configured Modal connection and selected model, and make the Canonical image available to Modal:

magic images prepare canonical --provider modal
pi

Keep the same model in /magic default. Run /magic new and choose Modal as the sandbox backend. MagicMtn runs Pi in the Modal sandbox and sends inference requests to the same model endpoint.

Use the same prompt, Ctrl+] to disconnect, and /magic view to resume or terminate the workspace. After terminating your workspaces, run magic server stop to stop the local server.

See the Modal provider setup guide for account and endpoint configuration.

Use the MagicMtn Web UI

Start the server with magic server start, then open http://localhost:1900 to view your computers and images, configure templates, and browse the MCP Catalog. Sign in as magic with the dashboard password printed in the terminal.

See the Web UI guide for a tour.

Using MagicMtn Cloud

Sign up for MagicMtn Cloud, our managed platform for inference and cloud computers for agents.

Set up Pi

Install the its Pi extension, and open Pi.

magic login
magic agents install pi
pi

In Pi, run /magic new to start a managed workspace. Press Ctrl+] to disconnect while Pi keeps running, then use /magic view and choose Resume to rejoin. Pi setup guide

For OpenCode 2.3.2 or later, sign in with magic login, then run magic agents install opencode. Hosted and local modes have separate credentials.

CLI error reporting is opt-in.

Install from source

Install Rust 1.100.0 or later and a C/C++ build toolchain (Xcode Command Line Tools on macOS, or GCC and Make on Linux). Download and extract the source archive, then run these commands from the extracted repository root:

cargo install --path cli --locked --bin magic
magic --version

Cargo installs magic in ~/.cargo/bin; add that directory to your PATH. To build a provider in a separate project, start with the provider SDK example.

Contribute

See CONTRIBUTING.md to build and test the engine and SDK. Read the security model for sandbox boundaries and provider trust. Send vulnerability reports through the private channel in SECURITY.md.

MagicMtn is licensed under the Apache License 2.0.

Footnotes

  1. MagicMtn Canonical is the default machine/sandbox image. ↩

About

Open-source sandboxes/VMs and model inference for coding agents on your own infrastructure.

Topics

Resources

Contributing

Security policy

Stars

37 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages