From 9a8477e1d8d7c11aefc6a131fce4c09250abf7fa Mon Sep 17 00:00:00 2001 From: Rudrendu Date: Sun, 12 Apr 2026 13:51:09 -0700 Subject: [PATCH] docs: add docstrings to Computer and AsyncComputer abstract methods The abstract methods on both Computer and AsyncComputer (screenshot, click, double_click, scroll, type, wait, move, keypress, drag) had no docstrings, leaving implementors without inline guidance on what each method should do. Add a one-line docstring to every abstract method so subclass authors and IDE tooltips have a clear contract description. Built by Rudrendu Paul, developed with Claude Code --- src/agents/computer.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/agents/computer.py b/src/agents/computer.py index dca2f155b7..137a174037 100644 --- a/src/agents/computer.py +++ b/src/agents/computer.py @@ -21,38 +21,47 @@ def dimensions(self) -> tuple[int, int] | None: @abc.abstractmethod def screenshot(self) -> str: + """Take a screenshot and return the base64-encoded image data.""" pass @abc.abstractmethod def click(self, x: int, y: int, button: Button) -> None: + """Click a mouse button at the given (x, y) screen coordinates.""" pass @abc.abstractmethod def double_click(self, x: int, y: int) -> None: + """Double-click at the given (x, y) screen coordinates.""" pass @abc.abstractmethod def scroll(self, x: int, y: int, scroll_x: int, scroll_y: int) -> None: + """Scroll at the given (x, y) coordinates by (scroll_x, scroll_y) units.""" pass @abc.abstractmethod def type(self, text: str) -> None: + """Type the given text at the current cursor position.""" pass @abc.abstractmethod def wait(self) -> None: + """Wait for the computer to be ready for the next action.""" pass @abc.abstractmethod def move(self, x: int, y: int) -> None: + """Move the mouse cursor to the given (x, y) screen coordinates.""" pass @abc.abstractmethod def keypress(self, keys: list[str]) -> None: + """Press one or more keys simultaneously (e.g. ``["ctrl", "c"]``).""" pass @abc.abstractmethod def drag(self, path: list[tuple[int, int]]) -> None: + """Click-and-drag the mouse along the sequence of (x, y) waypoints.""" pass @@ -72,36 +81,45 @@ def dimensions(self) -> tuple[int, int] | None: @abc.abstractmethod async def screenshot(self) -> str: + """Take a screenshot and return the base64-encoded image data.""" pass @abc.abstractmethod async def click(self, x: int, y: int, button: Button) -> None: + """Click a mouse button at the given (x, y) screen coordinates.""" pass @abc.abstractmethod async def double_click(self, x: int, y: int) -> None: + """Double-click at the given (x, y) screen coordinates.""" pass @abc.abstractmethod async def scroll(self, x: int, y: int, scroll_x: int, scroll_y: int) -> None: + """Scroll at the given (x, y) coordinates by (scroll_x, scroll_y) units.""" pass @abc.abstractmethod async def type(self, text: str) -> None: + """Type the given text at the current cursor position.""" pass @abc.abstractmethod async def wait(self) -> None: + """Wait for the computer to be ready for the next action.""" pass @abc.abstractmethod async def move(self, x: int, y: int) -> None: + """Move the mouse cursor to the given (x, y) screen coordinates.""" pass @abc.abstractmethod async def keypress(self, keys: list[str]) -> None: + """Press one or more keys simultaneously (e.g. ``["ctrl", "c"]``).""" pass @abc.abstractmethod async def drag(self, path: list[tuple[int, int]]) -> None: + """Click-and-drag the mouse along the sequence of (x, y) waypoints.""" pass