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
docs: improve Linux Desktop and Desktop Template documentation
- Add explanatory prose before code blocks per documentation standards
- Fix TypeScript code block labels to use "JavaScript & TypeScript"
- Add external links for sharp, SSE, noVNC, xdotool, x11vnc, and Xvfb
- Fix GitHub link to point to Surf repo instead of cookbook
- Add introduction and section headers to desktop template page
Copy file name to clipboardExpand all lines: docs/template/examples/desktop.mdx
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,17 @@ title: "Desktop"
3
3
description: "Sandbox with Ubuntu Desktop and VNC access"
4
4
---
5
5
6
+
This template creates a sandbox with a full Ubuntu 22.04 desktop environment, including the XFCE desktop, common applications, and VNC streaming for remote access. It's ideal for building AI agents that need to interact with graphical user interfaces.
7
+
8
+
The template includes:
9
+
-**Ubuntu 22.04** with XFCE desktop environment
10
+
-**VNC streaming** via [noVNC](https://novnc.com/) for browser-based access
11
+
-**Pre-installed applications**: LibreOffice, text editors, file manager, and common utilities
12
+
-**Automation tools**: [xdotool](https://github.com/jordansissel/xdotool) and scrot for programmatic desktop control
13
+
14
+
## Template Definition
15
+
16
+
The template installs the desktop environment, sets up VNC streaming via [x11vnc](https://github.com/LibVNC/x11vnc) and noVNC, and configures a startup script.
6
17
7
18
<CodeGroup>
8
19
@@ -131,6 +142,9 @@ template = (
131
142
132
143
</CodeGroup>
133
144
145
+
## Startup Script
146
+
147
+
The startup script initializes the virtual display using [Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) (X Virtual Framebuffer), launches the XFCE desktop session, starts the VNC server, and exposes the desktop via noVNC on port 6080. This script runs automatically when the sandbox starts.
Build the template with increased CPU and memory allocation to handle the desktop environment installation. The build process may take several minutes due to the size of the packages being installed.
Copy file name to clipboardExpand all lines: docs/use-cases/linux-desktop.mdx
+19-17Lines changed: 19 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,13 +30,15 @@ This guide is a demo version of [E2B Surf](https://github.com/e2b-dev/surf), an
30
30
</CardGroup>
31
31
32
32
<Note>
33
-
Full source code available on [GitHub](https://github.com/e2b-dev/e2b-cookbook).
33
+
Full source code available on [GitHub](https://github.com/e2b-dev/surf).
34
34
</Note>
35
35
36
36
## Project Structure
37
37
38
+
This starter project follows a standard Next.js App Router structure with additional directories for AI services, utilities, and type definitions. The separation keeps concerns modular and makes the codebase easy to navigate.
39
+
38
40
<CodeGroup>
39
-
```ts TypeScript
41
+
```typescript JavaScript & TypeScript
40
42
surf-starter/
41
43
├── app/
42
44
│ ├── api/chat/
@@ -79,7 +81,7 @@ This application creates an autonomous AI loop that enables natural language con
79
81
6.**Feedback Loop** - A new screenshot is taken and sent back to the AI
80
82
7.**Iteration** - The loop continues until the task is complete (maximum 15 iterations)
81
83
82
-
All updates stream to your browser in real-time via Server-Sent Events (SSE), giving you live visibility into what the AI is thinking and doing.
84
+
All updates stream to your browser in real-time via [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events), giving you live visibility into what the AI is thinking and doing.
83
85
84
86
---
85
87
@@ -105,7 +107,7 @@ Initialize a new Next.js project and install the required dependencies.
105
107
**Dependencies explained:**
106
108
- `@e2b/desktop` - E2B Desktop SDK for controlling virtual Linux desktops
107
109
- `openai` - OpenAI SDK for Computer Use API integration
108
-
- `sharp` - Fast image processing library for screenshot optimization
110
+
- [`sharp`](https://sharp.pixelplumbing.com/) - Fast image processing library for screenshot optimization
109
111
</Step>
110
112
</Steps>
111
113
@@ -130,7 +132,7 @@ Set up your API keys and create environment validation utilities.
130
132
<Steptitle="Environment Validation">
131
133
Create `lib/env.ts` to validate environment variables:
132
134
133
-
```typescript
135
+
```typescript JavaScript & TypeScript
134
136
// lib/env.ts
135
137
exportfunction getEnv() {
136
138
const E2B_API_KEY =process.env.E2B_API_KEY;
@@ -156,7 +158,7 @@ Define TypeScript interfaces for type safety throughout the application.
156
158
157
159
Create `types/index.ts` with core application types:
158
160
159
-
```typescript
161
+
```typescript JavaScript & TypeScript
160
162
// types/index.ts
161
163
162
164
// Message structure for chat interface
@@ -203,7 +205,7 @@ Centralize all configuration values for easy management.
203
205
204
206
Create `lib/constants.ts` with application-wide constants:
205
207
206
-
```typescript
208
+
```typescript JavaScript & TypeScript
207
209
// lib/constants.ts
208
210
209
211
// Sandbox configuration
@@ -248,7 +250,7 @@ Build helper functions for screenshot processing, streaming, and action executio
248
250
<Steptitle="Screenshot Processing">
249
251
Create `lib/utils/screenshot.ts` to optimize screenshots:
0 commit comments