Run browser automation tasks programmatically using the Python SDK, TypeScript SDK, or REST API. Poll for results, use webhooks, or wait for completion.
Run tasks programmatically using the Python SDK, TypeScript SDK, or REST API.
A task has one required parameter and one commonly used optional parameter:
prompt (required): Natural language instructions describing what the AI should do
url (optional): The starting page for the automation
When you call run_task, Skyvern spins up a cloud browser, navigates to the URL, and executes your prompt. A typical task takes 30-90 seconds depending on complexity.
import osimport asynciofrom skyvern import Skyvernasync def main(): client = Skyvern(api_key=os.getenv("SKYVERN_API_KEY")) result = await client.run_task( prompt="Get the title of the top post", url="https://news.ycombinator.com", ) print(f"Run ID: {result.run_id}") print(f"Status: {result.status}")asyncio.run(main())
Pass a webhook_url when creating the task. Skyvern sends a POST request to your URL when the task completes.
result = await client.run_task( prompt="Get the title of the top post", url="https://news.ycombinator.com", webhook_url="https://your-server.com/webhook",)
Skyvern sends a POST request with the full run data when the task completes or fails.
Block until the task finishes instead of polling manually.
Python
result = await client.run_task( prompt="Get the title of the top post", url="https://news.ycombinator.com", wait_for_completion=True,)print(result.output)
The response from polling (get_run) and webhooks have slightly different structures. Both contain the core task data, but webhooks include additional metadata.
{ "run_id": "tsk_v2_486305187432193504", "status": "completed", "output": { "top_post_title": "Linux kernel framework for PCIe device emulation, in userspace" }, "downloaded_files": [], "recording_url": "https://skyvern-artifacts.s3.amazonaws.com/v1/production/.../recording.webm?...", "screenshot_urls": ["https://skyvern-artifacts.s3.amazonaws.com/.../screenshot_final.png?..."], "failure_reason": null, "errors": [], "step_count": 2, "run_type": "task_v2", "app_url": "https://app.skyvern.com/runs/wr_486305187432193510", "browser_session_id": null, "browser_profile_id": null, "created_at": "2026-01-20T11:52:29.276851", "modified_at": "2026-01-20T11:54:08.822807", "queued_at": "2026-01-20T11:52:29.483922", "started_at": "2026-01-20T11:52:31.835337", "finished_at": "2026-01-20T11:54:08.821985", "run_request": { "prompt": "Get the title of the top post", "url": "https://news.ycombinator.com/", "engine": "skyvern-2.0" }}
Common fields (both polling and webhook):
Field
Type
Description
run_id
string
Unique identifier for this run
status
string
Current status: queued, running, completed, failed, terminated, timed_out, canceled
output
object | null
Extracted data from the task
downloaded_files
array
Files downloaded during execution
recording_url
string | null
Video recording of the browser session
screenshot_urls
array | null
Screenshots captured (latest first)
failure_reason
string | null
Error message if the run failed
errors
array
List of errors encountered
step_count
integer | null
Number of steps executed
run_type
string
Type of run: task_v2, openai_cua, anthropic_cua
app_url
string
Link to view this run in Skyvern Cloud
created_at
datetime
When the run was created
modified_at
datetime
When the run was last updated
queued_at
datetime | null
When the run entered the queue
started_at
datetime | null
When execution began
finished_at
datetime | null
When execution completed
Polling-only fields:
Field
Type
Description
run_request
object
Original request parameters (prompt, url, engine, etc.)