Skip to content

Commit 586aee3

Browse files
fix: add explicit conversion to int of mouse move coordinats, as the agent occasionaly provides the values as strigns
1 parent ac2caf1 commit 586aee3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/askui/tools/computer/move_mouse_tool.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ def __init__(self, agent_os: ComputerAgentOsFacade | None = None) -> None:
1414
"properties": {
1515
"x": {
1616
"type": "integer",
17-
"description": "The x coordinate of the mouse position.",
17+
"description": "The x coordinate of the mouse position as int.",
1818
},
1919
"y": {
2020
"type": "integer",
21-
"description": "The y coordinate of the mouse position.",
21+
"description": "The y coordinate of the mouse position as int.",
2222
},
2323
},
2424
"required": ["x", "y"],
@@ -29,5 +29,9 @@ def __init__(self, agent_os: ComputerAgentOsFacade | None = None) -> None:
2929
self.is_cacheable = True
3030

3131
def __call__(self, x: int, y: int) -> str:
32+
# for some reason, the agent occasionally calls the tool with the coords
33+
# encoded as strings, which will lead the tool to failing. To prevent this we
34+
# will explicitly convert to int here
35+
x, y = int(x), int(y)
3236
self.agent_os.mouse_move(x, y)
3337
return f"Mouse was moved to position ({x}, {y})."

0 commit comments

Comments
 (0)