Automation API

Android device automation

AgentInfo

Interface

Get automation and device metadata

Access these methods through agent.info. Provides information about the current automation and the device it's running on.

AgentInfo Interface
TypeScript
interface AgentInfo {
getAutomationInfo(): AutomationInfo;
getDeviceInfo(): DeviceInfo;
}

Methods

getAutomationInfo()

TypeScript
getAutomationInfo(): AutomationInfo

Returns metadata about the currently running automation.

Returns

AutomationInfoAutomation metadata

Examples

TypeScript
const info = agent.info.getAutomationInfo();
console.log("Running:", info.name);
console.log("Launch ID:", info.launchId);
console.log("Server:", info.serverBaseUrl);

getDeviceInfo()

TypeScript
getDeviceInfo(): DeviceInfo

Returns information about the device hardware and configuration.

Returns

DeviceInfoDevice specifications

Examples

TypeScript
const device = agent.info.getDeviceInfo();
console.log("Device:", device.brand, device.model);
console.log("Screen:", device.width, "x", device.height);
console.log("Android SDK:", device.sdkVersion);
console.log("Is Emulator:", device.isEmulator);

Types

AutomationInfo

Contains metadata about the running automation.

TypeScript
interface AutomationInfo {
name: string; // Automation name
description: string; // Automation description
launchId: string; // Unique ID for this launch
agent?: { // Optional agent details
id: string;
commitId: string;
token: string;
jobTaskId: string;
};
serverBaseUrl: string; // Server URL for API calls
}

AutomationInfo Properties

PropertyTypeDescription
namestringThe name of the automation
descriptionstringDescription of what the automation does
launchIdstringUnique identifier for this execution
agent?objectAgent details when running in agent mode (id, commitId, token, jobTaskId)
serverBaseUrlstringBase URL of the server for API calls

DeviceInfo

Contains hardware and configuration information about the device.

TypeScript
interface DeviceInfo {
id: string; // Unique device ID
brand: string; // Device brand (e.g., "Samsung")
model: string; // Device model (e.g., "SM-G991B")
sdkVersion: number; // Android SDK version (e.g., 33)
processor: string; // CPU info
numberOfCores: number; // CPU core count
ramMb: number; // RAM in megabytes
country: string; // Device country
isEmulator: boolean; // true if running on emulator
width: number; // Screen width in pixels
height: number; // Screen height in pixels
}

DeviceInfo Properties

PropertyTypeDescription
idstringUnique identifier for the device
brandstringDevice manufacturer (e.g., 'Samsung', 'Google')
modelstringDevice model name
sdkVersionnumberAndroid SDK API level (e.g., 33 for Android 13)
processorstringCPU/processor information
numberOfCoresnumberNumber of CPU cores
ramMbnumberTotal RAM in megabytes
countrystringDevice country/region setting
isEmulatorbooleanWhether the device is an emulator
widthnumberScreen width in pixels
heightnumberScreen height in pixels

Usage Example

TypeScript
// Adapt automation to device capabilities
const device = agent.info.getDeviceInfo();
// Calculate center of screen
const centerX = device.width / 2;
const centerY = device.height / 2;
// Check Android version for feature availability
if (device.sdkVersion >= 33) {
// Use Android 13+ features
}
// Log automation context
const automation = agent.info.getAutomationInfo();
console.log(`Running "${automation.name}" on ${device.brand} ${device.model}`);