Anthropic Claude
Use Claude's computer-use capabilities with Lightcone browser sessions.
Use Anthropic Claude’s computer use with Lightcone cloud browsers. Claude sees screenshots of the browser and decides what to click, type, and scroll. Lightcone provides the sandboxed execution environment.
pip install tzafon playwright anthropicplaywright install chromiumExample
Section titled “Example”import anthropicfrom tzafon import Lightconefrom playwright.sync_api import sync_playwrightimport base64
# Create a Lightcone browser sessionlc = Lightcone()session = lc.computers.create(kind="browser")cdp_url = session.endpoints.get("cdp")
# Connect Playwrightwith sync_playwright() as p: browser = p.chromium.connect_over_cdp(cdp_url) page = browser.contexts[0].pages[0]
page.goto("https://example.com") screenshot = page.screenshot() b64_screenshot = base64.b64encode(screenshot).decode()
# Ask Claude to analyze the page client = anthropic.Anthropic() response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, tools=[{ "type": "computer_20250124", "name": "computer", "display_width_px": 1280, "display_height_px": 720, "display_number": 1, }], messages=[{ "role": "user", "content": [ {"type": "text", "text": "Click on the 'More information' link"}, { "type": "image", "source": { "type": "base64", "media_type": "image/png", "data": b64_screenshot, }, }, ], }], )
# Process Claude's tool use response for block in response.content: if block.type == "tool_use": action = block.input if action.get("action") == "mouse_move" or action.get("action") == "left_click": x, y = action["coordinate"] page.mouse.click(x, y)
browser.close()
lc.computers.delete(session.id)Why use Lightcone with Claude?
Section titled “Why use Lightcone with Claude?”- Cloud execution — No need to run browsers locally; Lightcone handles the infrastructure
- Stealth mode — Access sites that block automation
- Session persistence — Save login sessions for reuse
- Scale — Run many agents in parallel on separate browser instances
Resources
Section titled “Resources”See also
Section titled “See also”- OpenAI CUA — OpenAI’s computer-use agent with Lightcone
- CUA protocol guide — build a CUA loop with Lightcone’s native API
- Playwright — CDP connection details