Quick Use
pip install e2b-desktopSandbox.create()returns a desktop withdesktop.stream.get_url()for VNC- Drive with
desktop.left_click(x, y),desktop.write(...),desktop.screenshot()
Intro
E2B Desktop is a managed cloud Linux desktop — full X11 environment, Firefox, terminal, file manager — exposed via VNC and an SDK. Drop in as the target environment for Claude Computer Use or OpenAI's CUA without setting up Docker / X11 locally. Best for: production deployments of computer-using AI agents, multi-tenant SaaS where each user gets an isolated desktop. Works with: Python SDK, Claude Computer Use, any agent that drives a screen+keyboard+mouse. Setup time: 5 minutes.
Spawn a desktop sandbox
from e2b_desktop import Sandbox
with Sandbox.create() as desktop:
# Get the live VNC URL (embed in iframe or watch via VNC viewer)
print(desktop.stream.get_url())
# Take a screenshot
screenshot = desktop.screenshot()
with open("screenshot.png", "wb") as f:
f.write(screenshot)
# Drive mouse + keyboard
desktop.left_click(500, 300)
desktop.write("hello world")
desktop.press("Enter")
# Launch an app
desktop.launch("firefox", "https://news.ycombinator.com")Use with Claude Computer Use
from anthropic import Anthropic
from e2b_desktop import Sandbox
desktop = Sandbox.create()
response = anthropic.beta.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=4096,
tools=[
{
"type": "computer_20241022",
"name": "computer",
"display_width_px": desktop.width,
"display_height_px": desktop.height,
}
],
messages=[{"role": "user", "content": "Find the top story on HN, screenshot it"}],
extra_headers={"anthropic-beta": "computer-use-2024-10-22"},
)
# Each tool call from Claude — execute against desktop:
for content in response.content:
if content.type == "tool_use" and content.input.get("action") == "screenshot":
ss = desktop.screenshot()
# ... return base64 to Claude
elif content.input.get("action") == "left_click":
x, y = content.input["coordinate"]
desktop.left_click(x, y)
# ... handle other actionsMulti-tenant pattern
# Each user gets their own sandbox
def get_user_desktop(user_id):
sandbox = Sandbox.create(timeout=3600)
sandbox.set_metadata("user_id", user_id)
return sandbox
# Reconnect to a running sandbox by ID
sandbox = Sandbox.connect(sandbox_id)Sessions persist across calls — useful for "agent did some work, returned to the user, now resumes" flows.
FAQ
Q: How is this different from Open Interpreter OS Mode? A: Open Interpreter OS Mode runs on YOUR machine — your screen, your keyboard. E2B Desktop runs in the cloud — agent gets an isolated cloud desktop, your machine is uninvolved. Use OS Mode for personal automation; E2B Desktop for production / multi-tenant SaaS.
Q: Can I install custom apps in the desktop?
A: Yes — E2B Desktops use Ubuntu under the hood. Run desktop.commands.run('apt install --yes <package>') or build a custom image with e2b template build for fast cold starts.
Q: Does it support audio / video? A: VNC streams the visual desktop in real time. Audio is not yet supported; video apps work for visual-only output. For audio interactions, layer a separate audio pipeline.
Source & Thanks
Built by E2B. Licensed under Apache-2.0.
e2b-dev/desktop — ⭐ 1,500+