Skip to main content

Quickstart

Get started with InstaVM in under 5 minutes. InstaVM allows you to spin up virtual machines in under 200ms and execute code securely in isolated environments.

What is InstaVM?

InstaVM is an infrastructure platform designed for rapid VM provisioning and secure code execution. Perfect for:

  • 🤖 LLM-generated code execution - Run AI-generated code safely
  • 📊 Data visualization - Generate charts and graphs in isolated environments
  • 🛠️ Package installation - Install tools like ffmpeg, d3, matplotlib without affecting your system
  • Real-time processing - Process files and streams with sub-second latency

Get your API Key

  1. Sign up at InstaVM Dashboard
  2. Navigate to API Keys section
  3. Create a new API key
  4. Copy your API key (starts with Iben...)

Installation

pip install instavm

Your First VM

from instavm import InstaVM

# Initialize with your API key
vm = InstaVM('Ibenx6XQetSm8Nvcngy3H18nyAwqKM8RtFDhHUid7aE')

# Execute code on a virtual machine
result = vm.execute("""
print("Hello from InstaVM! 🚀")
print(f"2 + 2 = {2 + 2}")
""")

print(result)
# Output: {'output': 'Hello from InstaVM! 🚀\n2 + 2 = 4\n', 'execution_time': 0.123}

For automatic session cleanup, use context managers:

from instavm import InstaVM

# Automatic session cleanup
with InstaVM('your_api_key') as vm:
result = vm.execute("print('Hello from InstaVM!')")
print(result)
# Session automatically closed

Real-world Example: Data Visualization

Here's a complete example of generating a data visualization with matplotlib:

from instavm import InstaVM

with InstaVM('your_api_key') as vm:
# Install matplotlib and generate a plot
result = vm.execute("""
import subprocess
import sys

# Install matplotlib
subprocess.check_call([sys.executable, "-m", "pip", "install", "matplotlib"])

import matplotlib.pyplot as plt
import numpy as np

# Generate data
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Create plot
plt.figure(figsize=(10, 6))
plt.plot(x, y, 'b-', linewidth=2, label='sin(x)')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Sine Wave Generated on InstaVM')
plt.legend()
plt.grid(True, alpha=0.3)

# Save plot
plt.savefig('sine_wave.png', dpi=150, bbox_inches='tight')
print("Plot saved as sine_wave.png")
""")

print(result)

Next Steps

Need Help?