Agent
InterfaceThe main entry point for all automation functionality
The agent object is globally available in all automation scripts. It provides access to device controls, screen content, file operations, and more through its namespaced properties.
Agent Interface
TypeScript
interface Agent { /** Accessibility action constants */ constants: AgentConstants;
/** All automation actions */ actions: AgentActions;
/** Utility functions */ utils: AgentUtils;
/** Device and automation info */ info: AgentInfo;
/** Automation control */ control: AgentControl;
/** HTML overlay display */ display: AgentDisplay;
/** Email operations */ email: AgentEmail;
/** Notification handling */ notifications: AgentNotifications;
/** Record usage statistics */ recordUsage(type: string, usage: number): void;}Namespaces
agent.constants
44 accessibility action constants used with nodeAction()
agent.actions
26 methods for device interaction: touch gestures, text input, app management, screenshots, and more
agent.utils
Utility functions including randomClick, randomSwipe, callbacks, and file operations
agent.info
Get automation and device metadata
agent.control
Stop automation execution
agent.display
Display HTML overlays on screen
agent.email
Read emails via IMAP protocol
agent.notifications
Handle and respond to system notifications
Quick Example
TypeScript
// Tap at coordinatesawait agent.actions.tap(100, 200);
// Get screen content and find elementsconst screen = await agent.actions.screenContent();const button = screen.findTextOne("Submit");
// Perform action on a nodeif (button) { await button.performAction(agent.constants.ACTION_CLICK);}
// Get device infoconst device = agent.info.getDeviceInfo();console.log(device.brand, device.model);
// Read a fileconst content = agent.utils.files.readFullFile("/sdcard/data.txt");