Skip to main content
Run tasks programmatically using the Python SDK, TypeScript SDK, or REST API.

Run a task

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.
Example response:
The response includes a run_id. Use this ID to check status, fetch results, and retrieve artifacts.
run_task returns immediately — the task is queued, not finished. Always poll or use webhooks to get results.

Get results

The run_task call queues the task and returns immediately. Use the run_id to fetch results once the task reaches a terminal state. You have three options for retrieving results:

Option 1: Polling

Poll get_run until status is terminal (completed, failed, terminated, timed_out, or canceled).
Your polling loop must check all terminal states: completed, failed, terminated, timed_out, canceled. Missing one causes infinite loops.

Option 2: Webhooks

Pass a webhook_url when creating the task. Skyvern sends a POST request to your URL when the task completes.
Skyvern sends a POST request with the full run data when the task completes or fails.

Option 3: Wait for completion (Python only)

Block until the task finishes instead of polling manually.
Python

Understand the response

The response from polling (get_run) and webhooks have slightly different structures. Both contain the core task data, but webhooks include additional metadata.
Common fields (both polling and webhook): Polling-only fields: Webhook-only fields:

Artifacts

Every run captures recordings, screenshots, and logs. See Using Artifacts for retrieval and the full artifact type reference.
For multi-step automations that chain multiple actions, see Browser Automation.