Skip to main content
import asyncio
from skyvern import Skyvern

async def main():
    skyvern = Skyvern(api_key="YOUR_API_KEY")
    browser = await skyvern.launch_cloud_browser()
    page = await browser.get_working_page()

    # Navigate with Playwright
    await page.goto("https://app.example.com")

    # Login with AI
    await page.agent.login(
        credential_type="skyvern",
        credential_id="cred_abc123",
    )

    # Mix Playwright and AI
    await page.click("#billing-tab")
    data = await page.extract(
        "Extract all invoice numbers and amounts",
        schema={
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "invoice_number": {"type": "string"},
                    "amount": {"type": "string"},
                },
            },
        },
    )
    print(data)

    await browser.close()

asyncio.run(main())