You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for VNC using x11vnc and novnc (#15)
* feat: add ubuntu-desktop template with custom wallpaper and vnc support
* Cleanup dockerfile; create dev template
* feat: restore original template directory
* feat: update env vars in desktop-dev template
* feat: add wait_for_port function to verify vnc and novnc status
* feat: full control over startup and vnc server
* feat: refresh desktop and unique password generation
* fix: remove vnc and novnc handles on stop
* feat: add js sdk
* feat: add auto-connect parameter in novnc URL
* fix: resolve extended sandboxOpts issue
* fix: resolve e2b wallpaper not applied issue
* fix: catch command exit error in wait and verify method
* Update README
* feat: update the original template
* Revert changes made to template to add VNC support
* Restore necessary changes to template for VNC support
* Use E2B fork of noVNC without control bar and branding
* Upgrade typedoc package to 0.27.9
* Add type definitions for NodeJS
* Remove autoconnect parameter from examples
* Add the password to the stream URL when auth is enabled
* Don't print the password in the Python example
* Enable stream auth in the TypeScript example
* Rename methods and documentation to use "stream" instead of "VNC"
* Throw an error instead of returning null for getCursorPosition() and getScreenSize()
* Remove README for Python SDK
* Remove desktop.hotkey()
* Rename takeScreenshot() to screenshot()
* Make password member private in the TypeScript SDK
* Throw an error on stream.start() if the stream is already running
* Always use Sandbox class name instead of Desktop
* Move stream parameters to stream.start()
* Remove desktop.refresh()
* added changeset
* changed default sandbox template
* Add apt-update
* Remove old streaming web page
* Make sure to always pull the latest git repo in the sandbox template by invalidating Docker cache
* Add readmes to each package
* Explain better how stream auth works
* Remove example of customizing streaming port from readmes
* Change positional params to an options object for the `write()` method in JS SDK
---------
Co-authored-by: Vasek Mlejnsky <[email protected]>
Co-authored-by: James Murdza <[email protected]>
Co-authored-by: Mish Ushakov <[email protected]>
Copy file name to clipboardexpand all lines: README.md
+134-54
Original file line number
Diff line number
Diff line change
@@ -7,78 +7,150 @@ Each sandbox is isolated from the others and can be customized with any dependen
7
7

8
8
9
9
### Example app using Computer Use with Anthropic's Claude
10
-
Check out the [example open-source app](https://github.com/e2b-dev/secure-computer-use) in a separate repository.
11
10
11
+
Check out the [example open-source app](https://github.com/e2b-dev/secure-computer-use) in a separate repository.
12
12
13
13
## 🚀 Getting started
14
+
14
15
The E2B Desktop Sandbox is built on top of [E2B Sandbox](https://e2b.dev/docs).
15
16
16
17
### 1. Get E2B API key
18
+
17
19
Sign up at [E2B](https://e2b.dev) and get your API key.
18
20
Set environment variable `E2B_API_KEY` with your API key.
19
21
20
22
### 2. Install SDK
23
+
21
24
**Python**
25
+
22
26
```bash
23
27
pip install e2b-desktop
24
28
```
25
29
26
30
**JavaScript**
31
+
27
32
```bash
28
33
npm install @e2b/desktop
29
34
```
30
35
31
36
### 3. Create Desktop Sandbox
37
+
32
38
**Python**
39
+
33
40
```python
34
41
from e2b_desktop import Sandbox
35
42
43
+
# Basic initialization
36
44
desktop = Sandbox()
45
+
46
+
# With custom configuration
47
+
desktop = Sandbox(
48
+
display=":0", # Custom display (defaults to :0)
49
+
resolution=(1920, 1080), # Custom resolution
50
+
dpi=96, # Custom DPI
51
+
)
37
52
```
38
53
39
54
**JavaScript**
55
+
40
56
```javascript
41
57
import { Sandbox } from'@e2b/desktop'
42
58
59
+
// Basic initialization
43
60
constdesktop=awaitSandbox.create()
44
-
```
45
61
46
-
## Stream virtual desktop screen
47
-
You can enable streaming the desktop screen by passing `videoStream: true` to the `Sandbox.create` function in JavaScript and `video_stream=True` to the `Sandbox` constructor in Python.
62
+
// With custom configuration
63
+
constdesktop=awaitSandbox.create({
64
+
display:':0', // Custom display (defaults to :0)
65
+
resolution: [1920, 1080], // Custom resolution
66
+
dpi:96, // Custom DPI
67
+
})
68
+
```
48
69
49
-
Then call `getVideoStreamUrl` in JS and `get_video_stream_url` method in Python to get the stream URL that will look like this: `https://e2b.dev/stream/sandbox/<sandbox-id>?token=<secret-token>` and open it in your browser.
70
+
## Features
50
71
51
-
You'll need to wait a couple of seconds for the stream to buffer the first frames.
72
+
### Streaming desktop's screen
52
73
53
74
**Python**
75
+
54
76
```python
55
77
from e2b_desktop import Sandbox
78
+
desktop = Sandbox()
79
+
80
+
# Start the stream
81
+
desktop.stream.start()
56
82
57
-
desktop = Sandbox(video_stream=True)
58
-
stream_url = desktop.get_video_stream_url()
59
-
print(stream_url)
60
-
# Open stream_url in your browser
61
-
# You'll need to wait a couple of seconds for the stream to buffer the first frames
You can use [PyAutoGUI](https://pyautogui.readthedocs.io/en/latest/) to control the whole environment programmatically.
214
295
215
296
The 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.
216
297
Check out the sandbox template's code [here](./template/).
0 commit comments