{"id":18261580,"url":"https://github.com/e2b-dev/desktop","last_synced_at":"2025-04-14T02:58:07.380Z","repository":{"id":259309521,"uuid":"806216118","full_name":"e2b-dev/desktop","owner":"e2b-dev","description":"E2B Desktop Sandbox for LLMs. E2B Sandbox with desktop graphical environment that you can connect to any LLM for secure computer use.","archived":false,"fork":false,"pushed_at":"2025-04-10T13:51:37.000Z","size":4109,"stargazers_count":587,"open_issues_count":4,"forks_count":65,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-14T02:58:01.485Z","etag":null,"topics":["ai","computer","desktop","e2b","e2b-dev","gpt","gui","llm","vm"],"latest_commit_sha":null,"homepage":"https://e2b.dev","language":"MDX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e2b-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-26T17:38:34.000Z","updated_at":"2025-04-12T20:19:48.000Z","dependencies_parsed_at":"2025-03-23T22:07:35.252Z","dependency_job_id":"339b101c-9310-4076-9a5d-acc43b47dd33","html_url":"https://github.com/e2b-dev/desktop","commit_stats":null,"previous_names":["e2b-dev/desktop"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fdesktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fdesktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fdesktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e2b-dev%2Fdesktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e2b-dev","download_url":"https://codeload.github.com/e2b-dev/desktop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813789,"owners_count":21165633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","computer","desktop","e2b","e2b-dev","gpt","gui","llm","vm"],"created_at":"2024-11-05T11:03:22.910Z","updated_at":"2025-04-14T02:58:07.374Z","avatar_url":"https://github.com/e2b-dev.png","language":"MDX","readme":"# E2B Desktop Sandbox - Open Source Virtual Computer for Computer Use\n\nE2B Desktop Sandbox is an open source secure virtual desktop ready for Computer Use. Powered by [E2B](https://e2b.dev).\n\nEach sandbox is isolated from the others and can be customized with any dependencies you want.\n\n![Desktop Sandbox](readme-assets/screenshot.png)\n\n## Examples\n\n**Basic SDK Examples**\n\n- Check out the examples directory for more examples on how to use the SDK:\n   - [Python](./examples/basic-python)\n   - [JavaScript](./examples/basic-javascript)\n\n**[Open Computer Use](https://github.com/e2b-dev/open-computer-use)**\n   \n- Computer use made with 100% open source LLMs.\n\n**[🏄 Surf](https://github.com/e2b-dev/surf)**\n\n-  OpenAI Computer Use Agent using E2B's Desktop Sandbox. Runs as a Next.js app.\n\n## 🚀 Getting started\n\nThe E2B Desktop Sandbox is built on top of [E2B Sandbox](https://e2b.dev/docs).\n\n### 1. Get E2B API key\n\nSign up at [E2B](https://e2b.dev) and get your API key.\nSet environment variable `E2B_API_KEY` with your API key.\n\n### 2. Install SDK\n\n**Python**\n\n```bash\npip install e2b-desktop\n```\n\n**JavaScript**\n\n```bash\nnpm install @e2b/desktop\n```\n\n### 3. Create Desktop Sandbox\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\n\n# Basic initialization\ndesktop = Sandbox()\n\n# With custom configuration\ndesktop = Sandbox(\n    display=\":0\",  # Custom display (defaults to :0)\n    resolution=(1920, 1080),  # Custom resolution\n    dpi=96,  # Custom DPI\n)\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\n// Basic initialization\nconst desktop = await Sandbox.create()\n\n// With custom configuration\nconst desktop = await Sandbox.create({\n  display: ':0', // Custom display (defaults to :0)\n  resolution: [1920, 1080], // Custom resolution\n  dpi: 96, // Custom DPI\n})\n```\n\n## Features\n\n### Streaming desktop's screen\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Start the stream\ndesktop.stream.start()\n\n# Get stream URL\nurl = desktop.stream.get_url()\nprint(url)\n\n# Get stream URL and disable user interaction\nurl = desktop.stream.get_url(view_only=True)\nprint(url)\n\n# Stop the stream\ndesktop.stream.stop()\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\n// Start the stream\nawait desktop.stream.start()\n\n// Get stream URL\nconst url = desktop.stream.getUrl();\nconsole.log(url);\n\n// Get stream URL and disable user interaction\nconst url = desktop.stream.getUrl({ viewOnly: true })\nconsole.log(url)\n\n// Stop the stream\nawait desktop.stream.stop()\n```\n\n### Streaming with password protection\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Start the stream\ndesktop.stream.start(\n    require_auth=True  # Require authentication with an auto-generated key\n)\n\n# Retrieve the authentication key\nauth_key = desktop.stream.get_auth_key()\n\n# Get stream URL\nurl = desktop.stream.get_url(auth_key=auth_key)\nprint(url)\n\n# Stop the stream\ndesktop.stream.stop()\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\n// Start the stream\nawait desktop.stream.start({\n  requireAuth: true, // Require authentication with an auto-generated key\n})\n\n// Retrieve the authentication key\nconst authKey = await desktop.stream.getAuthKey()\n\n// Get stream URL\nconst url = desktop.stream.getUrl({ authKey })\nconsole.log(url)\n\n// Stop the stream\nawait desktop.stream.stop()\n```\n\n### Mouse control\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\ndesktop.double_click()\ndesktop.left_click()\ndesktop.left_click(x=100, y=200)\ndesktop.right_click()\ndesktop.right_click(x=100, y=200)\ndesktop.middle_click()\ndesktop.middle_click(x=100, y=200)\ndesktop.scroll(10) # Scroll by the amount. Positive for up, negative for down.\ndesktop.move_mouse(100, 200) # Move to x, y coordinates\ndesktop.drag((100, 100), (200, 200)) # Drag using the mouse\ndesktop.mouse_press(\"left\") # Press the mouse button\ndesktop.mouse_release(\"left\") # Release the mouse button\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\nawait desktop.doubleClick()\nawait desktop.leftClick()\nawait desktop.leftClick(100, 200)\nawait desktop.rightClick()\nawait desktop.rightClick(100, 200)\nawait desktop.middleClick()\nawait desktop.middleClick(100, 200)\nawait desktop.scroll(10) // Scroll by the amount. Positive for up, negative for down.\nawait desktop.moveMouse(100, 200) // Move to x, y coordinates\nawait desktop.drag([100, 100], [200, 200]) // Drag using the mouse\nawait desktop.mousePress(\"left\") // Press the mouse button\nawait desktop.mouseRelease(\"left\") // Release the mouse button\n```\n\n### Keyboard control\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Write text at the current cursor position with customizable typing speed\ndesktop.write(\"Hello, world!\")  # Default: chunk_size=25, delay_in_ms=75\ndesktop.write(\"Fast typing!\", chunk_size=50, delay_in_ms=25)  # Faster typing\n\n# Press keys\ndesktop.press(\"enter\")\ndesktop.press(\"space\")\ndesktop.press(\"backspace\")\ndesktop.press([\"ctrl\", \"c\"]) # Key combination\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\n// Write text at the current cursor position with customizable typing speed\nawait desktop.write('Hello, world!')\nawait desktop.write('Fast typing!', { chunkSize: 50, delayInMs: 25 }) // Faster typing\n\n// Press keys\nawait desktop.press('enter')\nawait desktop.press('space')\nawait desktop.press('backspace')\nawait desktop.press(['ctrl', 'c']) // Key combination\n```\n\n### Screenshot\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Take a screenshot and save it as \"screenshot.png\" locally\nimage = desktop.screenshot()\n# Save the image to a file\nwith open(\"screenshot.png\", \"wb\") as f:\n    f.write(image)\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\nconst image = await desktop.screenshot()\n// Save the image to a file\nfs.writeFileSync('screenshot.png', image)\n```\n\n### Open file\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Open file with default application\ndesktop.files.write(\"/home/user/index.js\", \"console.log('hello')\") # First create the file\ndesktop.open(\"/home/user/index.js\") # Then open it\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\n// Open file with default application\nawait desktop.files.write('/home/user/index.js', \"console.log('hello')\") // First create the file\nawait desktop.open('/home/user/index.js') // Then open it\n```\n\n### Run any bash commands\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\n# Run any bash command\nout = desktop.commands.run(\"ls -la /home/user\")\nprint(out)\n```\n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\n\n// Run any bash command\nconst out = await desktop.commands.run('ls -la /home/user')\nconsole.log(out)\n```\n\n### Wait\n\n**Python**\n\n```python\nfrom e2b_desktop import Sandbox\ndesktop = Sandbox()\n\ndesktop.wait(1000) # Wait for 1 second\n``` \n\n**JavaScript**\n\n```javascript\nimport { Sandbox } from '@e2b/desktop'\n\nconst desktop = await Sandbox.create()\nawait desktop.wait(1000) // Wait for 1 second\n```\n\n## Under the hood\n\nThe desktop-like environment is based on Linux and [Xfce](https://www.xfce.org/) at the moment. We chose Xfce because it's a fast and lightweight environment that's also popular and actively supported. However, this Sandbox template is fully customizable and you can create your own desktop environment.\nCheck out the sandbox template's code [here](./template/).\n","funding_links":[],"categories":["Projects","MDX","HarmonyOS","Python"],"sub_categories":["Environment \u0026 Sandbox","Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2b-dev%2Fdesktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe2b-dev%2Fdesktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe2b-dev%2Fdesktop/lists"}