--- title: OpenAI CUA | Lightcone description: Run OpenAI's Computer-Using Agent on Lightcone browser sessions. --- Run [OpenAI’s Computer-Using Agent (CUA)](https://platform.openai.com/docs/guides/computer-use) on Lightcone cloud browsers. CUA is OpenAI’s protocol for AI agents that see and interact with computer screens. Lightcone provides the sandboxed browser environment; OpenAI’s CUA model provides the vision and reasoning. ## How it works 1. Create a Lightcone browser session 2. Connect to it via Playwright using the CDP endpoint 3. Run the OpenAI CUA loop — the model sees screenshots, decides actions, and Playwright executes them ## Setup Terminal window ``` pip install tzafon playwright openai playwright install chromium ``` ## Example ``` from tzafon import Lightcone from playwright.sync_api import sync_playwright from openai import OpenAI # Create a Lightcone browser session lc = Lightcone() session = lc.computers.create(kind="browser") # Get the CDP endpoint cdp_url = session.endpoints.get("cdp") # Connect Playwright to the remote browser with sync_playwright() as p: browser = p.chromium.connect_over_cdp(cdp_url) page = browser.contexts[0].pages[0] # Navigate page.goto("https://example.com") # Take a screenshot for CUA screenshot = page.screenshot() # Use OpenAI CUA to reason about the page client = OpenAI() response = client.responses.create( model="computer-use-preview", tools=[{ "type": "computer_use_preview", "display_width": 1280, "display_height": 720, "environment": "browser", }], input=[{ "role": "user", "content": [ {"type": "input_text", "text": "Find the main heading on this page"}, {"type": "input_image", "image_url": f"data:image/png;base64,{screenshot.hex()}"}, ], }], ) print(response.output) browser.close() lc.computers.delete(session.id) ``` You can also use Lightcone’s built-in [Responses API](/guides/responses-api/index.md) with `tzafon.northstar-cua-fast` for computer-use tasks without needing the OpenAI SDK. See the [CUA protocol guide](/guides/cua-protocol/index.md). ## Why use Lightcone with OpenAI CUA? - **Stealth browsers** — Lightcone’s browsers include anti-detection features that prevent sites from blocking automation - **Residential proxies** — Route traffic through residential IPs for additional stealth - **Session persistence** — Save and restore browser state (cookies, local storage) across runs - **Scalability** — Spin up hundreds of concurrent browser sessions ## Resources - [OpenAI CUA documentation](https://platform.openai.com/docs/guides/computer-use) - [openai-cua-sample-app](https://github.com/openai/openai-cua-sample-app) - [Lightcone Playwright integration](/integrations/playwright/index.md) ## See also - [**CUA protocol guide**](/guides/cua-protocol/index.md) — build a CUA loop with Lightcone’s native API - [**Anthropic Claude**](/integrations/anthropic-claude/index.md) — Claude’s computer-use with Lightcone - [**Playwright**](/integrations/playwright/index.md) — CDP connection details