Skip to content
Dashboard
Core Concepts

Computers

Sandboxed browser and desktop sessions you create, interact with, and terminate.

A computer is a sandboxed cloud environment — either a Chromium browser or a full Linux desktop — that you control through the Lightcone API. Each session runs in an isolated container with its own browser profile, filesystem, and network. You create a session, send actions (click, type, navigate, screenshot), and terminate it when done.

BrowserDesktop
kind"browser""desktop"
EnvironmentHeadless Chromium with stealthFull Linux desktop (X11)
Use casesWeb scraping, form filling, testingOS-level automation, file management, multi-app workflows
Tab managementYesNo
Proxy supportYesNo
File systemIsolated per sessionFull Linux filesystem
from tzafon import Lightcone
client = Lightcone()
# High-level wrapper with automatic cleanup
with client.computer.create(kind="browser") as computer:
computer.navigate("https://example.com")
# session terminates when block exits
import Lightcone from "@tzafon/lightcone";
const client = new Lightcone();
const computer = await client.computers.create({ kind: "browser" });
await client.computers.navigate(computer.id!, { url: "https://example.com" });
// Always clean up when done
await client.computers.delete(computer.id!);

Every action returns an ActionResult containing a status, optional result data (a dictionary with action-specific keys), and optional page_context with viewport state.

computer.navigate("https://example.com")
computer.click(100, 200)
computer.type("hello world")
computer.hotkey("enter")
computer.scroll(0, 300, 640, 400) # dx, dy, x, y
result = computer.screenshot()
url = computer.get_screenshot_url(result) # extracts result["screenshot_url"]
html_result = computer.html()
content = computer.get_html_content(html_result) # extracts result["html_content"]
const id = computer.id!;
await client.computers.navigate(id, { url: "https://example.com" });
await client.computers.click(id, { x: 100, y: 200 });
await client.computers.type(id, { text: "hello world" });
await client.computers.hotkey(id, { keys: ["Enter"] });
await client.computers.scroll(id, { dx: 0, dy: 300, x: 640, y: 400 });
const result = await client.computers.screenshot(id);
const url = result.result?.screenshot_url as string;
const htmlResult = await client.computers.html(id);
const content = htmlResult.result?.html_content as string;

The result dictionary contains different keys depending on the action:

ActionKeyValue
screenshot()screenshot_urlURL of the captured screenshot
html()html_contentThe page’s HTML as a string
debug()debug_responseShell command output
# Automatic with context manager (recommended)
with client.computer.create(kind="browser") as computer:
# ...
# Or manual cleanup
session = client.computers.create(kind="browser")
# ...
client.computers.delete(session.id)
await client.computers.delete(computer.id!);

Both SDKs provide a ComputerSession class that binds a session ID to convenience methods, so you don’t have to pass the ID on every call.

Python — accessed via client.computer.create() with a context manager:

with client.computer.create(kind="browser") as computer:
computer.navigate("https://example.com")
computer.click(100, 200)
result = computer.screenshot()
url = computer.get_screenshot_url(result)
# Session terminates automatically on exit

TypeScript — imported from the package and created with ComputerSession.create():

import Lightcone, { ComputerSession } from "@tzafon/lightcone";
const client = new Lightcone();
const computer = await ComputerSession.create(client, { kind: "browser" });
try {
await computer.navigate("https://example.com");
await computer.click(100, 200);
const result = await computer.screenshot();
const url = ComputerSession.getScreenshotUrl(result);
} finally {
await computer.terminate();
}

Both wrappers expose the same methods: navigate(), click(), type(), hotkey(), scroll(), screenshot(), html(), wait(), batch(), and keepAlive(). Static helper methods getScreenshotUrl(), getHtmlContent(), and getDebugResponse() extract values from ActionResult.

ActionDescription
click(x, y)Left-click at pixel coordinates
double_click(x, y)Double-click
right_click(x, y)Right-click (context menu)
drag(x1, y1, x2, y2)Click-and-drag between two points
mouse_down(x, y)Press and hold the mouse button
mouse_up(x, y)Release the mouse button
ActionDescription
type(text)Type text into the focused element
hotkey(keys)Press a key combination (e.g., ["Control", "c"])
key_down(key)Press and hold a key
key_up(key)Release a held key
ActionDescription
navigate(url)Go to a URL
scroll(dx, dy, x, y)Scroll at position by delta
viewport(width, height)Resize the viewport
screenshot()Capture the current viewport
html()Get the page HTML

Sessions have two timeout mechanisms:

ParameterDefaultDescription
timeout_secondsPlan-dependentMaximum total session lifetime
inactivity_timeout_secondsPlan-dependentTime with no API calls before auto-termination
auto_killtrueWhether the inactivity timeout is active

To keep a session alive during long pauses:

computer.keep_alive()
await client.computers.keepalive(computer.id!);

Save browser state (cookies, local storage) and restore it later:

# Save state on termination
with client.computer.create(kind="browser", persistent=True) as computer:
computer.navigate("https://example.com/login")
# ... log in ...
# State saved automatically when session ends
# Restore state later using the session ID
with client.computer.create(
kind="browser",
environment_id="previous_session_id",
persistent=True, # save again on exit
) as computer:
computer.navigate("https://example.com/dashboard")
# Cookies are still active
// Save state
const session = await client.computers.create({
kind: "browser",
persistent: true,
});
// ... use the session, then terminate ...
await client.computers.delete(session.id!);
// Restore state
const restored = await client.computers.create({
kind: "browser",
environment_id: session.id!,
persistent: true,
});

Execute multiple actions in a single request. The batch stops on the first error:

results = client.computers.batch(session.id, actions=[
{"type": "navigate", "url": "https://example.com"},
{"type": "click", "x": 100, "y": 200},
{"type": "screenshot"},
])
const results = await client.computers.batch(computer.id!, {
actions: [
{ type: "navigate", url: "https://example.com" },
{ type: "click", x: 100, y: 200 },
{ type: "screenshot" },
],
});

Route browser traffic through a proxy for stealth:

# Use the built-in advanced proxy
with client.computer.create(
kind="browser",
use_advanced_proxy=True,
) as computer:
# ...
# Or change proxy mid-session
client.computers.change_proxy(session.id, proxy_url="http://proxy.example.com:8080")
const computer = await client.computers.create({
kind: "browser",
use_advanced_proxy: true,
});
// Change proxy mid-session
await client.computers.changeProxy(computer.id!, {
proxy_url: "http://proxy.example.com:8080",
});