API Reference
- class agentdesk.ConnectConfig(*, agentd_url: str | None = None, instance: V1DesktopInstance | str | None = None, api_key: str | None = None, storage_uri: str = 'file://.media', type_min_interval: float = 0.02, type_max_interval: float = 0.5, move_mouse_duration: float = 1.0, mouse_tween: str = 'easeInOutQuad', store_img: bool = False, requires_proxy: bool = True, proxy_type: str = 'process', proxy_port: int = 8000, private_ssh_key: str | None = None, ssh_port: int = 22)[source]
Bases:
BaseModel
- agentd_url: str | None
- api_key: str | None
- instance: V1DesktopInstance | str | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- mouse_tween: str
- move_mouse_duration: float
- private_ssh_key: str | None
- proxy_port: int
- proxy_type: str
- requires_proxy: bool
- ssh_port: int
- storage_uri: str
- store_img: bool
- type_max_interval: float
- type_min_interval: float
- class agentdesk.Desktop(agentd_url: str | None = None, instance: DesktopInstance | None = None, storage_uri: str = 'file://.media', type_min_interval: float = 0.02, type_max_interval: float = 0.5, move_mouse_duration: float = 1.0, mouse_tween: str = 'easeInOutQuad', store_img: bool = False, requires_proxy: bool = True, proxy_type: str = 'process', proxy_port: int = 8000, private_ssh_key: str | None = None, ssh_port: int = 22, check_health: bool = True, api_key: str | None = None)[source]
Bases:
Device
Desktop OS as a device via agentd
- click(button: str = 'left', x: int | None = None, y: int | None = None) None [source]
Click mouse button
- Parameters:
button (str, optional) – Button to click. Defaults to “left”.
x (Optional[int], optional) – X coordinate to move to, if not provided it will click on current location. Defaults to None.
y (Optional[int], optional) – Y coordinate to move to, if not provided it will click on current location. Defaults to None.
- close()[source]
A method that should be implemented by subclasses to handle the closing of the tool.
This method is intended to provide a way to release any resources or perform any cleanup necessary when the tool is no longer needed.
- classmethod connect(config: ConnectConfig) Desktop [source]
Connect to a device from a configuration
- Parameters:
config (C) – Config
- Returns:
The device
- Return type:
D
- connect_config() ConnectConfig [source]
Connect configuration
- Returns:
Connect configuration for this device
- Return type:
C
- classmethod connect_config_type() Type[ConnectConfig] [source]
Type of connect configuration
- Returns:
Type of connect configuration
- Return type:
Type[C]
- classmethod create(name: str | None = None, config: ProvisionConfig = ProvisionConfig(provider=V1ProviderData(type='docker', args=None), image=None, memory=4, cpus=2, disk='30gb', reserve_ip=False, ssh_key_pair=None, proxy_port=8000)) Desktop [source]
Create a desktop VM
- demostrate(task: str, owner_id: str, token: str, tracker_url: str = 'https://api.hub.agentlabs.xyz') None [source]
Demostrate a task on the desktop
- Parameters:
task (str) – Task to demostrate.
token (str) – Token to use for the tracker.
tracker_url (str) – URL of the tracker
- classmethod docker(name: str | None = None, image: str | None = None, memory: int = 2, cpus: int = 1, disk: str = '30gb', reserve_ip: bool = False, ssh_key_pair: str | None = None) Desktop [source]
Create a desktop container on docker
- double_click(button: str = 'left', x: int | None = None, y: int | None = None) None [source]
Double click the mouse
- drag_mouse(x: int, y: int) None [source]
Drag the mouse
- Parameters:
x (int) – x coordinate
y (int) – y coordinate
- classmethod ec2(name: str | None = None, region: str | None = None, image: str | None = None, memory: int = 4, cpus: int = 2, disk: str = '30gb', reserve_ip: bool = False, ssh_key_pair: str | None = None) Desktop [source]
Create a desktop VM on EC2
- classmethod ensure(name: str, config: ProvisionConfig) Desktop [source]
Find or create a desktop
- exec(cmd: str) dict [source]
Execute a command
- Parameters:
cmd (str) – Command to execute
- Returns:
Command execution result containing status, output and return code if error
- Return type:
dict
- classmethod find(**kwargs: Any) list[DesktopInstance] [source]
List all desktops
- Returns:
A list of desktop vms
- Return type:
list[DesktopInstance]
- classmethod from_instance(instance: DesktopInstance, proxy_type: str = 'process', proxy_port: int = 8000, check_health: bool = True) Desktop [source]
Create a desktop from a VM
- Parameters:
instance (DesktopInstance) – Instance to use
proxy_type (str, optional) – The type of proxy to use. Defaults to process.
proxy_port (int, optional) – The port to use for the proxy. Defaults to 8000.
check_health (bool, optional) – Check the health of the VM. Defaults to True.
- Returns:
A desktop
- Return type:
- classmethod gce(name: str | None = None, project: str | None = None, zone: str = 'us-central1-a', region: str = 'us-central1', image: str | None = None, memory: int = 4, cpus: int = 2, disk: str = '30gb', reserve_ip: bool = False, ssh_key_pair: str | None = None) Desktop [source]
Create a desktop VM on GCE
- classmethod get(name: str) DesktopInstance | None [source]
Get a desktop by name
- Parameters:
name (str) – Name of the desktop
- Returns:
A desktop
- Return type:
- hot_key(keys: List[str]) None [source]
Press a hot key. For example ctrl+c
- Parameters:
keys (List[str]) – Which keys to press. Options are: [ “t”, “n”, “r”, “ “, “!”, ‘"’, “#”, “$”, “%”, “&”, “'”, “(”, “)”, “*”, “+”, “,”, “-”, “.”, “/”, “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “:”, “;”, “<”, “=”, “>”, “?”, “@”, “[”, “\”, “]”, “^”, “_”, “`”, “a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”, “{”, “|”, “}”, “~”, “accept”, “add”, “alt”, “altleft”, “altright”, “apps”, “backspace”, “browserback”, “browserfavorites”, “browserforward”, “browserhome”, “browserrefresh”, “browsersearch”, “browserstop”, “capslock”, “clear”, “convert”, “ctrl”, “ctrlleft”, “ctrlright”, “decimal”, “del”, “delete”, “divide”, “down”, “end”, “enter”, “esc”, “escape”, “execute”, “f1”, “f10”, “f11”, “f12”, “f13”, “f14”, “f15”, “f16”, “f17”, “f18”, “f19”, “f2”, “f20”, “f21”, “f22”, “f23”, “f24”, “f3”, “f4”, “f5”, “f6”, “f7”, “f8”, “f9”, “final”, “fn”, “help”, “home”, “insert”, “left”, “numlock”, “pagedown”, “pageup”, “pause”, “pgdn”, “pgup”, “playpause”, “prevtrack”, “print”, “printscreen”, “prntscrn”, “prtsc”, “prtscr”, “return”, “right”, “scrolllock”, “select”, “separator”, “shift”, “shiftleft”, “shiftright”, “sleep”, “space”, “stop”, “subtract”, “tab”, “up”, “volumedown”, “volumemute”, “volumeup”, “win”, “winleft”, “winright”, “yen”, “command”, “option”, “optionleft”, “optionright” ]
- info() dict [source]
Get info on the desktop runtime
- Returns:
A dictionary of info
- Return type:
dict
- classmethod kube(name: str | None = None, image: str | None = None, memory: int = 2, cpus: int = 1, disk: str = '30gb', reserve_ip: bool = False, ssh_key_pair: str | None = None) Desktop [source]
Create a desktop container on kubernetes
- classmethod local(name: str | None = None, memory: int = 4, cpus: int = 2) Desktop [source]
Create a local VM
- Parameters:
name (str, optional) – Name of the instance. Defaults to None.
memory (int, optional) – Memory the VM has. Defaults to 4.
cpus (int, optional) – CPUs the VM has. Defaults to 2.
- Returns:
A desktop
- Return type:
- mouse_coordinates() Tuple[int, int] [source]
Get the current mouse coordinates
- Returns:
x, y coordinates
- Return type:
Tuple[int, int]
- move_mouse(x: int, y: int) None [source]
Move mouse to a position
- Parameters:
x (int) – x coordinate
y (int) – y coordinate
- press_key(key: str) None [source]
Press a key
- Parameters:
key (str) – Which key to press. Options are: [ “t”, “n”, “r”, “ “, “!”, ‘"’, “#”, “$”, “%”, “&”, “'”, “(”, “)”, “*”, “+”, “,”, “-”, “.”, “/”, “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “:”, “;”, “<”, “=”, “>”, “?”, “@”, “[”, “\”, “]”, “^”, “_”, “`”, “a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, “y”, “z”, “{”, “|”, “}”, “~”, “accept”, “add”, “alt”, “altleft”, “altright”, “apps”, “backspace”, “browserback”, “browserfavorites”, “browserforward”, “browserhome”, “browserrefresh”, “browsersearch”, “browserstop”, “capslock”, “clear”, “convert”, “ctrl”, “ctrlleft”, “ctrlright”, “decimal”, “del”, “delete”, “divide”, “down”, “end”, “enter”, “esc”, “escape”, “execute”, “f1”, “f10”, “f11”, “f12”, “f13”, “f14”, “f15”, “f16”, “f17”, “f18”, “f19”, “f2”, “f20”, “f21”, “f22”, “f23”, “f24”, “f3”, “f4”, “f5”, “f6”, “f7”, “f8”, “f9”, “final”, “fn”, “help”, “home”, “insert”, “left”, “numlock”, “pagedown”, “pageup”, “pause”, “pgdn”, “pgup”, “playpause”, “prevtrack”, “print”, “printscreen”, “prntscrn”, “prtsc”, “prtscr”, “return”, “right”, “scrolllock”, “select”, “separator”, “shift”, “shiftleft”, “shiftright”, “sleep”, “space”, “stop”, “subtract”, “tab”, “up”, “volumedown”, “volumemute”, “volumeup”, “win”, “winleft”, “winright”, “yen”, “command”, “option”, “optionleft”, “optionright” ]
- classmethod provision_config_type() Type[ProvisionConfig] [source]
Type of provision configuration
- Returns:
Type of provisioner configuration
- Return type:
Type[P]
- classmethod react_component() ReactComponent [source]
React component for the device
- Returns:
React component
- Return type:
Optional[ReactComponent]
- scroll(clicks: int = -3) None [source]
Scroll the screen
- Parameters:
clicks (int, optional) – Number of clicks, negative scrolls down, positive scrolls up. Defaults to -3.
- class agentdesk.ProvisionConfig(*, provider: V1ProviderData = V1ProviderData(type='docker', args=None), image: str | None = None, memory: int = 4, cpus: int = 2, disk: str = '30gb', reserve_ip: bool = False, ssh_key_pair: str | None = None, proxy_port: int = 8000)[source]
Bases:
BaseModel
- cpus: int
- disk: str
- image: str | None
- memory: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- provider: V1ProviderData
- proxy_port: int
- reserve_ip: bool
- ssh_key_pair: str | None
- class agentdesk.SimpleDesktop(agentd_url: str | None = None, instance: DesktopInstance | None = None, storage_uri: str = 'file://.media', type_min_interval: float = 0.02, type_max_interval: float = 0.5, move_mouse_duration: float = 1.0, mouse_tween: str = 'easeInOutQuad', store_img: bool = False, requires_proxy: bool = True, proxy_type: str = 'process', proxy_port: int = 8000, private_ssh_key: str | None = None, ssh_port: int = 22, check_health: bool = True, api_key: str | None = None)[source]
Bases:
Desktop
A more simple desktop
- class agentdesk.V1DesktopInstance(*, id: str | None = None, name: str | None = None, addr: str | None = None, status: str | None = None, created: float | None = None, assigned: float | None = None, image: str | None = None, memory: int | None = None, cpu: int | None = None, disk: str | None = None, memory_usage: float | None = None, cpu_usage: float | None = None, disk_usage: float | None = None, reserved_ip: bool | None = None, provider: V1ProviderData | None = None, meta: dict | None = None, owner_id: str | None = None, key_pair_name: str | None = None, agentd_port: int | None = None, vnc_port: int | None = None, vnc_port_https: int | None = None, basic_auth_user: str | None = None, basic_auth_password: str | None = None, resource_name: str | None = None, namespace: str | None = None, ttl: int | None = None, requires_proxy: bool | None = None)[source]
Bases:
BaseModel
- addr: str | None
- agentd_port: int | None
- assigned: float | None
- basic_auth_password: str | None
- basic_auth_user: str | None
- cpu: int | None
- cpu_usage: float | None
- created: float | None
- disk: str | None
- disk_usage: float | None
- id: str | None
- image: str | None
- key_pair_name: str | None
- memory: int | None
- memory_usage: float | None
- meta: dict | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str | None
- namespace: str | None
- owner_id: str | None
- provider: V1ProviderData | None
- requires_proxy: bool | None
- reserved_ip: bool | None
- resource_name: str | None
- status: str | None
- ttl: int | None
- vnc_port: int | None
- vnc_port_https: int | None