Skyvern
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
-
network error (Skyvern UI after changing Docker Compose ports)
cause Environment variables within the Docker Compose setup, particularly those related to WebSocket URLs (e.g., `VITE_WSS_BASE_URL`), were not updated to match the new port mappings.fixEdit `docker-compose.yml` and any associated `.env` files to ensure all port references and related environment variables are consistent with the new port configuration. Restart the Docker containers. -
Task timed_out / Status is timed_out
cause The task exceeded the `max_steps` limit (default 50), the AI got stuck in a navigation loop, or explicit completion criteria were missing for a complex task.fixIncrease `max_steps` in your task parameters (up to 75). Add clear completion criteria to your prompt (e.g., 'COMPLETE when you see "Order confirmed"'). Review the task recording to identify where the AI got stuck and refine the prompt or break the task into smaller steps. -
Status is completed, but extracted data is incorrect or incomplete.
cause The AI might have ended on the wrong page, targeted incorrect elements, or the schema description was ambiguous.fixCheck the `screenshot_final` and `llm_response_parsed` artifacts. Add specific descriptions to your schema (e.g., 'The price in USD, without currency symbol'). Provide visual hints in your prompt. Make schema fields optional if data might not always be present, and add validation instructions. -
Run stays in queued status and never starts.
cause Account concurrency limits were reached, a sequential run lock was active (another run with the same credential), or there was high platform load.fixWait for other runs to complete. Check your plan's concurrency limits in Skyvern settings. If using 'Run Sequentially' with credentials, ensure prior runs have finished. Contact support if the issue persists.
Warnings
- breaking Changing default ports in `docker-compose.yml` for self-hosted Skyvern deployments without updating related environment variables (like `VITE_WSS_BASE_URL`) can lead to 'network error' issues in the UI.
- gotcha Tasks can time out or get stuck in a 'queued' state due to complexity, insufficient `max_steps`, missing explicit completion criteria, concurrency limits, or LLM-related configuration issues.
- gotcha Authentication failures (e.g., login-related termination) commonly occur due to expired credentials, CAPTCHAs, Multi-Factor Authentication (MFA), or detection of automation.
Install
-
pip install skyvern -
skyvern quickstart
Imports
- Skyvern
from skyvern import Skyvern
Quickstart
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())