Tools

class Tools(ABC)

Abstract base class for all tools. This class provides a common interface for all tools to implement.

Tools.get_state

async def get_state() -> Dict[str, Any]

Get the current state of the tool.

Tools.tap_by_index

async def tap_by_index(index: int) -> bool

Tap the element at the given index.

Tools.swipe

async def swipe(
    start_x: int,
    start_y: int,
    end_x: int,
    end_y: int,
    duration_ms: int = 300
) -> bool

Swipe from the given start coordinates to the given end coordinates.

Tools.input_text

async def input_text(text: str) -> bool

Input the given text into a focused input field.

Tools.back

async def back() -> bool

Press the back button.

Tools.press_key

async def press_key(keycode: int) -> bool

Enter the given keycode.

Tools.start_app

async def start_app(package: str, activity: str = "") -> bool

Start the given app.

Tools.take_screenshot

async def take_screenshot() -> Tuple[str, bytes]

Take a screenshot of the device.

Tools.list_packages

async def list_packages(include_system_apps: bool = False) -> List[str]

List all packages on the device.

Tools.remember

async def remember(information: str) -> str

Remember the given information. This is used to store information in the tool’s memory.

Tools.get_memory

async def get_memory() -> List[str]

Get the memory of the tool.

Tools.complete

def complete(success: bool, reason: str = "") -> bool

Complete the tool. This is used to indicate that the tool has completed its task.

describe_tools

def describe_tools(tools: Tools) -> Dict[str, Callable[..., Any]]

Describe the tools available for the given Tools instance.

Arguments:

  • tools - The Tools instance to describe.

Returns:

A dictionary mapping tool names to their descriptions.

Tools

class Tools(ABC)

Abstract base class for all tools. This class provides a common interface for all tools to implement.

Tools.get_state

async def get_state() -> Dict[str, Any]

Get the current state of the tool.

Tools.tap_by_index

async def tap_by_index(index: int) -> bool

Tap the element at the given index.

Tools.swipe

async def swipe(
    start_x: int,
    start_y: int,
    end_x: int,
    end_y: int,
    duration_ms: int = 300
) -> bool

Swipe from the given start coordinates to the given end coordinates.

Tools.input_text

async def input_text(text: str) -> bool

Input the given text into a focused input field.

Tools.back

async def back() -> bool

Press the back button.

Tools.press_key

async def press_key(keycode: int) -> bool

Enter the given keycode.

Tools.start_app

async def start_app(package: str, activity: str = "") -> bool

Start the given app.

Tools.take_screenshot

async def take_screenshot() -> Tuple[str, bytes]

Take a screenshot of the device.

Tools.list_packages

async def list_packages(include_system_apps: bool = False) -> List[str]

List all packages on the device.

Tools.remember

async def remember(information: str) -> str

Remember the given information. This is used to store information in the tool’s memory.

Tools.get_memory

async def get_memory() -> List[str]

Get the memory of the tool.

Tools.complete

def complete(success: bool, reason: str = "") -> bool

Complete the tool. This is used to indicate that the tool has completed its task.

describe_tools

def describe_tools(tools: Tools) -> Dict[str, Callable[..., Any]]

Describe the tools available for the given Tools instance.

Arguments:

  • tools - The Tools instance to describe.

Returns:

A dictionary mapping tool names to their descriptions.