Skip to content

Usage

Python SDK - Minimal Example

Launches a cloud browser, navigates to a URL, and extracts data using a natural-language prompt.

python
import os
import asyncio
from skyvern import Skyvern

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

    try:
        await page.goto("https://news.ycombinator.com")
        result = await page.extract("Get the title of the #1 post")
        print(f"Extracted: {result}")
    finally:
        await browser.close()  # always close to free cloud resources

asyncio.run(main())

TypeScript SDK - Minimal Example

typescript
import { Skyvern } from "@skyvern/client";

async function main() {
  const skyvern = new Skyvern({ apiKey: process.env.SKYVERN_API_KEY });
  const browser = await skyvern.launchCloudBrowser();
  const page = await browser.getWorkingPage();

  try {
    await page.goto("https://news.ycombinator.com");
    const result = await page.extract("Get the title of the #1 post");
    console.log("Extracted:", result);
  } finally {
    await browser.close(); // always close to free cloud resources
  }
}

main();

Self-Hosted Task (Python SDK against local server)

python
from skyvern import Skyvern

async def main():
    skyvern = Skyvern()  # connects to localhost by default
    task = await skyvern.run_task(
        prompt="Find the top post on hackernews today"
    )
    print(task)

Common Use Cases

Use CasePattern
Web data extractionpage.extract("describe what you want in plain English")
Form filling at scalePass structured input to run_task with field mappings
Accounts payable (invoice download)Chain navigation + extract + download steps
Lead generationNavigate listing pages, extract contact data to JSON
Browser testing / QArun_task with assertions; test adapts to UI changes automatically

Key Rules

  • Always call browser.close() (or browser.close() in TypeScript) in a finally block. Unclosed sessions consume cloud credits.
  • The Python SDK requires Python 3.11, 3.12, or 3.13.
  • For high-volume or geo-targeted work, use the cloud tier (proxy network and CAPTCHA solvers are cloud-only).
  • Self-hosted installs do not include anti-bot features.