Use this file to discover all available pages before exploring further.
E2B Desktop is an open-source secure virtual desktop framework specifically engineered for developing Computer Use Agents. This solution provides a comprehensive, isolated desktop environment that enables AI agents to securely interact with desktop applications through controlled virtualization.This document will provide detailed instructions on how to run this project based on Novita Agent sandbox service.
The following implementation demonstrates the instantiation of a virtual desktop environment and the retrieval of VNC access endpoints for remote desktop interaction:
// demo.ts implementationimport { Sandbox } from '@e2b/desktop'// Initialize virtual desktop sandbox instanceconst desktop = await Sandbox.create()// Activate desktop streaming serviceawait desktop.stream.start()// Retrieve interactive VNC endpoint URLconst url = desktop.stream.getUrl()console.log(url)// Expected output format:// Browser-accessible URL for interactive virtual desktop session. Suitable for application integration.// https://6080-ik0n7lc3j0dvqd4jxy6g7.sandbox.novita.ai/vnc.html?autoconnect=true&resize=scale// Retrieve read-only VNC endpoint URL (interaction disabled)const urlDisabledInteraction = desktop.stream.getUrl({ viewOnly: true })console.log(urlDisabledInteraction)// Expected output format:// Browser-accessible URL for view-only virtual desktop session (non-interactive mode). Suitable for monitoring applications.// https://6080-ik0n7lc3j0dvqd4jxy6g7.sandbox.novita.ai/vnc.html?autoconnect=true&view_only=true&resize=scale// Keep the program runningconsole.log("Desktop stream started, press Ctrl+C to stop the program...")const interval = setInterval(() => {}, 1000)// Register interrupt signal handlers for resource cleanuplet isCleaning = falseconst cleanup = async () => { if (isCleaning) return isCleaning = true console.log("\nProgram interrupted, cleaning up resources...") clearInterval(interval) try { await desktop.stream.stop() // Terminate streaming service await desktop.kill() // Deallocate sandbox instance } catch (err) { console.error("Error cleaning up resources:", err) } process.exit(0)}process.on('SIGINT', cleanup)process.on('SIGTERM', cleanup)
Running example:Access virtual desktop stream VNC URL:Additional implementation examples and advanced use cases are available in the official E2B Desktop repository.