Skip to content
Dashboard

Create a new computer instance

computers.create(ComputerCreateParams**kwargs) -> ComputerResponse
POST/computers

Create a new automation session. Set kind to "browser" for web automation or "desktop" for OS-level automation. Defaults to "browser" if not specified. timeout_seconds controls max lifetime, inactivity_timeout_seconds controls idle timeout, and auto_kill disables only the idle timeout (max lifetime still applies).

ParametersExpand Collapse
auto_kill: Optional[bool]

If true (default), kill session after inactivity

context_id: Optional[str]
display: Optional[Display]
height: Optional[int]
scale: Optional[float]
width: Optional[int]
environment_id: Optional[str]
inactivity_timeout_seconds: Optional[int]

Idle timeout before auto-kill

kind: Optional[str]

"browser" (default) or "desktop"

persistent: Optional[bool]

Persist cookies/storage state to DB on session teardown only if true

stealth: Optional[object]
timeout_seconds: Optional[int]
use_advanced_proxy: Optional[bool]

If true (browser sessions), use ADVANCED_PROXY_URL on session start

ReturnsExpand Collapse
class ComputerResponse:
id: Optional[str]
auto_kill: Optional[bool]
created_at: Optional[str]
endpoints: Optional[Dict[str, str]]
expires_at: Optional[str]
idle_expires_at: Optional[str]
inactivity_timeout_seconds: Optional[int]
kind: Optional[str]
last_activity_at: Optional[str]
max_lifetime_seconds: Optional[int]
status: Optional[str]

Create a new computer instance

import os
from tzafon import Lightcone

client = Lightcone(
    api_key=os.environ.get("TZAFON_API_KEY"),  # This is the default and can be omitted
)
computer_response = client.computers.create()
print(computer_response.id)
{
  "id": "id",
  "auto_kill": true,
  "created_at": "created_at",
  "endpoints": {
    "foo": "string"
  },
  "expires_at": "expires_at",
  "idle_expires_at": "idle_expires_at",
  "inactivity_timeout_seconds": 0,
  "kind": "kind",
  "last_activity_at": "last_activity_at",
  "max_lifetime_seconds": 0,
  "status": "status"
}
Returns Examples
{
  "id": "id",
  "auto_kill": true,
  "created_at": "created_at",
  "endpoints": {
    "foo": "string"
  },
  "expires_at": "expires_at",
  "idle_expires_at": "idle_expires_at",
  "inactivity_timeout_seconds": 0,
  "kind": "kind",
  "last_activity_at": "last_activity_at",
  "max_lifetime_seconds": 0,
  "status": "status"
}