Agent
askui.agent
VisionAgent Objects
click
Simulates a mouse click on the user interface element identified by the provided instruction.
Arguments:
instruction
str | None - The identifier or description of the element to click.button
‘left’ | ‘middle’ | ‘right’ - Specifies which mouse button to click. Defaults to ‘left’.repeat
int - The number of times to click. Must be greater than 0. Defaults to 1.model_name
str | None - The model name to be used for element detection. Optional.
Raises:
InvalidParameterError
- If the ‘repeat’ parameter is less than 1.
Example:
mouse_move
Moves the mouse cursor to the UI element identified by the provided instruction.
Arguments:
instruction
str - The identifier or description of the element to move to.model_name
str | None - The model name to be used for element detection. Optional.
Example:
mouse_scroll
Simulates scrolling the mouse wheel by the specified horizontal and vertical amounts.
Arguments:
x
int - The horizontal scroll amount. Positive values typically scroll right, negative values scroll left.y
int - The vertical scroll amount. Positive values typically scroll down, negative values scroll up.
Notes:
The actual scroll direction
depends on the operating system’s configuration.
Some systems may have “natural scrolling” enabled, which reverses the traditional direction.
The meaning of scroll units
varies acro
ss operating
systems and applications.
A scroll value of 10 might result in different distances depending on the application and system settings.
Example:
type
Types the specified text as if it were entered on a keyboard.
Arguments:
text
str - The text to be typed.
Example:
get
Retrieves text or information from the screen based on the provided instruction.
Arguments:
instruction
str - The instruction describing what information to retrieve.model_name
str | None - The model name to be used for information extraction. Optional.
Returns:
str
- The extracted text or information.
Example:
wait
Pauses the execution of the program for the specified number of seconds.
Arguments:
sec
float - The number of seconds to wait. Must be greater than 0.
Raises:
ValueError
- If the providedsec
is negative.
Example:
key_up
Simulates the release of a key.
Arguments:
key
PC_AND_MODIFIER_KEY - The key to be released.
Example:
key_down
Simulates the pressing of a key.
Arguments:
key
PC_AND_MODIFIER_KEY - The key to be pressed.
Example:
act
Instructs the agent to achieve a specified goal through autonomous actions.
The agent will analyze the screen, determine necessary steps, and perform actions to accomplish the goal. This may include clicking, typing, scrolling, and other interface interactions.
Arguments:
goal
str - A description of what the agent should achieve.model_name
str | None - The specific model to use for vision analysis. If None, uses the default model.
Example:
keyboard
Simulates pressing a key or key combination on the keyboard.
Arguments:
key
PC_AND_MODIFIER_KEY - The main key to press. This can be a letter, number, special character, or function key.modifier_keys
list[MODIFIER_KEY] | None - Optional list of modifier keys to press along with the main key. Common modifier keys include ‘ctrl’, ‘alt’, ‘shift’.
Example:
cli
Executes a command on the command line interface.
This method allows running shell commands directly from the agent. The command is split on spaces and executed as a subprocess.
Arguments:
command
str - The command to execute on the command line.
Example: