October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Capture a Website Screenshot with an AI Agent in the OpenAI Agents SDK

Use ComputerTool with a developer-provided browser harness to let an OpenAI Agents SDK agent capture and inspect website screenshots.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the OpenAI Agents SDK’s ComputerTool when the agent needs to control a browser and inspect its screen. You provide the local browser harness: it implements the SDK’s Computer or AsyncComputer interface, including screenshot(), which returns a base64-encoded PNG. Then add ComputerTool to an agent and run it with Runner. The SDK documentation points to a Playwright-based example for the browser implementation.

How the screenshot flow works

ComputerTool connects the agent to a computer or browser runtime that your application provides. The SDK exposes the harness through the computer-use tool interface; it does not itself launch or host your local Playwright browser.

As an Amazon Associate I earn from qualifying purchases.

  1. Start a browser runtime in your application and open the page to capture.
  2. Implement the required computer actions for that runtime, including a screenshot() method.
  3. Construct ComputerTool with the implementation and add it to an Agent‘s tools.
  4. Use Runner to run the agent with instructions to navigate, interact with, or inspect the page.
  5. Return the screenshot in the format the interface requires: base64-encoded PNG data for screenshot().

The official guide links to a runnable Playwright-based harness at the Agents SDK computer-use guide. Use that example as the reference for browser setup and interface implementation; the code below shows the integration boundary, not a complete Playwright harness.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the synchronous or asynchronous interface

Match the computer interface to the execution model of your browser driver. Use Computer for a synchronous implementation and AsyncComputer for an asynchronous one. The screenshot method has the same important output contract in either case: a base64-encoded PNG of the current display.

A screenshot alone is not enough for the full computer-use loop. Implement the interaction methods required by the selected interface, such as clicking, scrolling, typing, waiting, and keyboard input. The guide’s Playwright example demonstrates the browser-harness approach; consult it for the exact interface details for your SDK version.

Connect your harness to an agent

The following is an integration sketch for the synchronous path. Replace my_computer with an instance of your own complete Computer implementation, following the SDK example. It is deliberately not presented as a standalone runnable browser program: browser creation, navigation and the required action methods belong to that harness.

from agents import Agent, ComputerTool, Runner

# Implement the SDK Computer interface for your local browser runtime.
# Its screenshot() method must return a base64-encoded PNG string.
my_computer = ...

computer_tool = ComputerTool(computer=my_computer)
agent = Agent(
    name="Website screenshot agent",
    instructions="Use the browser to open the requested website and inspect its screenshot.",
    tools=[computer_tool],
)

result = Runner.run_sync(
    agent,
    "Open https://example.com and describe what is visible on the page.",
)
print(result.final_output)

For an asynchronous browser driver, implement AsyncComputer and follow the asynchronous pattern in the SDK’s computer-use example. Do not substitute an ordinary browser screenshot method without adapting it to the interface’s expected base64 PNG return value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the effective model and tool format

Computer-use request behavior depends on the model actually used for the Responses API request. The current guide distinguishes the documented GA computer tool path, which sends a computer tool payload and can return batched actions[], from the older computer-use-preview path, which uses a computer_use_preview payload and a single action per call.

Check the model after accounting for any override in run configuration or prompt templates. A configured override can change which tool format applies, so do not assume the model named when constructing the agent is necessarily the effective one. Model names, defaults and preview behavior are version-sensitive; verify the current guide and the model used by your application before relying on a specific action shape.

When you need a screenshot, not browser interaction

ComputerTool is the documented choice for an agent that must operate a browser through computer-style actions. If the task is simply to capture a page and return an image or PDF, a screenshot API can avoid building and maintaining that browser harness. ScreenshotNeo is a website screenshot API and MCP server; its MCP tools let compatible AI-agent clients request screenshots directly.

Or skip the browser setup

Make one GET request to capture a page as an image. For this example, the response is saved as a WebP file; consult the ScreenshotNeo API documentation for request options and supported output formats.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

Troubleshoot common integration problems

  • The agent cannot take a screenshot: Check that the harness implements the selected Computer or AsyncComputer interface and that ComputerTool receives that implementation.
  • The screenshot result is rejected or unusable: Verify that screenshot() returns base64-encoded PNG data, rather than a file path, raw image bytes, or a different image format.
  • The agent can capture but cannot interact: Add the other methods required by the interface and route each action to the local browser driver. A screenshot method alone does not implement clicks, scrolling, typing or waiting.
  • The request uses an unexpected action format: Check the effective model on the actual request and any run-level or prompt-template override. The GA and preview paths differ in payload naming and whether actions may be batched.
  • The example does not match your installed SDK: Compare against the current official computer-use guide and its linked Playwright example. The interface and model behavior can change across SDK versions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability and implementation costs

Your application owns the browser runtime and its lifecycle, so it must handle browser startup, page loading, navigation and action execution. The guide specifies the harness contract but does not establish a universal runtime setup or performance figure; actual capture time and reliability depend on your browser environment and the sites you visit. For a one-off capture workflow, compare that maintenance with a screenshot API call. For interactive tasks where the agent must act on what it sees, the computer-use loop is the more direct fit.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.