Skyvern

1.0.31 · active · verified Thu Apr 16

Skyvern is a Python library that enables AI-powered browser automation by extending Playwright with large language models (LLMs) and computer vision. It allows users to automate complex, multi-step web workflows using natural language prompts, aiming to be more robust than traditional selector-based automation tools. Skyvern also offers a no-code workflow builder and a managed cloud service. The current version is 1.0.31, with active development and frequent releases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes the Skyvern client with an API key (preferably from an environment variable) and runs a simple task to extract data from a website. For local setup, ensure you run `skyvern quickstart` first and may need to specify a `base_url`.

import os
import asyncio
from skyvern import Skyvern

async def main():
    # Ensure SKYVERN_API_KEY is set as an environment variable or replace with your actual key
    api_key = os.getenv("SKYVERN_API_KEY", "")
    if not api_key:
        print("Error: SKYVERN_API_KEY environment variable not set.")
        return

    client = Skyvern(
        api_key=api_key,
        # For self-hosted, use base_url="http://localhost:8000"
        # base_url="https://api.skyvern.com" # Default for cloud service
    )

    print("Running task...")
    try:
        result = await client.run_task(
            prompt="Go to news.ycombinator.com and get the title of the #1 post",
            url="https://news.ycombinator.com",
        )
        print(f"Run ID: {result.run_id}")
        print(f"Output: {result.output}")
    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    asyncio.run(main())

view raw JSON →