Skip to main content
The get_screenshot method captures a screenshot of the current browser window and returns it as base64-encoded image data along with metadata. Unlike asking Agent.run() to take a screenshot and save it to disk, this method returns the screenshot data programmatically.
This method returns screenshot data directly in your code rather than saving it to disk. If you need screenshots saved automatically to your Downloads folder, use Agent.run() with a prompt like “take a screenshot of this page” instead.

Method Signature

Parameters

timeout
int | None
default:"None"
Maximum time in seconds to wait for the screenshot capture to complete. If None, uses the default system timeout.

Return Value

Returns a GetScreenshotResponse object with the following structure:
base64_content
str
required
The screenshot image encoded as a base64 string. This can be decoded and saved to a file, displayed, or processed programmatically.
name
str
required
A suggested filename for the screenshot, typically in a format like “Screenshot 2026-01-14 at 10.54.54 AM”.
mime_type
str
required
The MIME type of the image format (e.g., “image/png”, “image/jpeg”).
timestamp
str
required
ISO 8601 formatted timestamp indicating when the screenshot was captured.

Example