### Install Skyvern Python SDK Source: https://docs.skyvern.com/getting-started/quickstart Installs the Skyvern Python SDK using pip. Ensure you have Python 3.11 or later installed. ```bash pip install skyvern ``` -------------------------------- ### Example Navigation V2 Block Prompt Source: https://docs.skyvern.com/getting-started/prompting-guide This prompt demonstrates the multi-goal capability of the Navigation V2 block, involving searching for an image, identifying its location, and extracting the address. ```Skyvern Prompt Your first goal is to search for an image using Google Lens. To do so, select the Google Lens camera icon. You will know you’re looking at Google Lens when you see the option to drag and drop an image. Then search using the provided image link: {{image_URL}} Now that you’ve searched google for the image, your goal is to identify the location. If you’re unsure about the location, default to the location that is most represented in the search results. Now that you have the location, your goal is to go to google maps and extract the address. Provide the address in the following format: {{schema}} ``` -------------------------------- ### Example Action Block Prompt Source: https://docs.skyvern.com/getting-started/prompting-guide A simple prompt for the Action block type, instructing to click a specific button. ```Skyvern Prompt Click the continue button ``` -------------------------------- ### Run Skyvern Task with Optional Parameters Source: https://docs.skyvern.com/api-reference This example shows how to run a Skyvern task with additional parameters, including the starting URL, engine choice, and proxy location. It utilizes a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --header 'x-user-agent: Skyvern' \ --data '{ \ "prompt": "Find the contact information on the Skyvern website.", \ "url": "https://skyvern.com", \ "engine": "skyvern-2.0", \ "proxy_location": "RESIDENTIAL_GB" \ }' ``` -------------------------------- ### Example Navigation/Task Block Prompt Source: https://docs.skyvern.com/getting-started/prompting-guide This prompt is designed for the Navigation or Task block type, focusing on filling out a form with provided data and confirming submission. ```Skyvern Prompt Your goal is to fill out the form. Only fill out required fields that you have information for. To add address information, you will need to select the Add button and input the information in a popup modal. Here is the information you need to get through the form: {{complete_payload}} Your goal is complete when you have filled out the form and submitted. You will know your goal is complete when you are viewing a confirmation message that it was submitted. ``` -------------------------------- ### Initialize Skyvern for Local Execution Source: https://docs.skyvern.com/getting-started/quickstart Sets up Skyvern for local task execution by running the initialization wizard, which generates a .env configuration file. ```bash skyvern init ``` -------------------------------- ### Create Workflow Request Example Source: https://docs.skyvern.com/api-reference/api-reference/workflows/create-workflow An example of how to construct a POST request to the Skyvern API to create a new workflow. This includes setting the necessary headers and providing the workflow definition in JSON format. ```json { "json_definition": { "steps": [ { "action": "navigate", "url": "https://example.com" } ] } } ``` -------------------------------- ### Run a Task with Skyvern Cloud (Python) Source: https://docs.skyvern.com/getting-started/quickstart Executes a task using the Skyvern Python SDK by sending it to Skyvern Cloud. Requires an API key obtained from Skyvern Cloud. ```python from skyvern import Skyvern import asyncio skyvern = Skyvern(api_key="YOUR API KEY") # OR pass the base_url to use any Skyvern service # skyvern = Skyvern(base_url="http://localhost:8000", api_key="YOUR API KEY") asyncio.run(skyvern.run_task(prompt="Find the top post on hackernews today")) ``` -------------------------------- ### Login Task API Request Example Source: https://docs.skyvern.com/api-reference/api-reference/agent/login This example demonstrates how to make a POST request to the Skyvern API to log in to a website. It shows the required headers and a sample request body with optional parameters. ```curl curl -X POST \ https://api.skyvern.com/v1/run/tasks/login \ -H 'x-api-keystring: YOUR_API_KEYSTRING' \ -H 'Content-Type: application/json' \ -d '{ \ "credential_type": "skyvern", \ "url": "https://example.com/login", \ "prompt": "Please enter your username and password.", \ "webhook_url": "https://your-callback.com/webhook", \ "proxy_location": "us_east_1", \ "totp_identifier": "your_totp_identifier", \ "totp_url": "your_totp_url", \ "browser_session_id": "pbs_your_session_id", \ "extra_http_headers": { \ "User-Agent": "SkyvernBot/1.0" \ }, \ "max_screenshot_scrolling_times": 5, \ "credential_id": "skyvern_credential_id", \ "bitwarden_collection_id": "your_bitwarden_collection_id", \ "bitwarden_item_id": "your_bitwarden_item_id", \ "onepassword_vault_id": "your_onepassword_vault_id", \ "onepassword_item_id": "your_onepassword_item_id", \ "azure_vault_name": "your_azure_vault_name", \ "azure_vault_username_key": "your_azure_vault_username_key", \ "azure_vault_password_key": "your_azure_vault_password_key", \ "azure_vault_totp_secret_key": "your_azure_vault_totp_secret_key" \ }' ``` -------------------------------- ### Initialize Skyvern Configuration Source: https://docs.skyvern.com/integrations/mcp Runs the Skyvern setup wizard to configure the connection to either Skyvern Cloud or a local Skyvern instance. ```bash $ skyvern init ``` -------------------------------- ### Run Workflow Example (API) Source: https://docs.skyvern.com/api-reference/api-reference/workflows/run-workflow This snippet demonstrates how to make a POST request to the Skyvern API to run a workflow. It includes required headers and a sample request body. ```http POST /v1/run/workflows HTTP/1.1 Host: api.skyvern.com Content-Type: application/json x-api-keystring: YOUR_API_KEYSTRING { "workflow_id": "wpid_your_workflow_id", "parameters": { "key1": "value1", "key2": 123 }, "title": "My Workflow Run", "proxy_location": "RESIDENTIAL_GB", "webhook_url": "https://your.domain.com/webhook", "totp_url": "https://your.domain.com/totp", "totp_identifier": "your_totp_identifier" } ``` -------------------------------- ### Run a Task Locally with Skyvern (Python) Source: https://docs.skyvern.com/getting-started/quickstart Executes a task using the Skyvern Python SDK locally. A local browser instance will be launched to perform the task. ```python from skyvern import Skyvern import asyncio skyvern = Skyvern() asyncio.run(skyvern.run_task(prompt="Find the top post on hackernews today")) ``` -------------------------------- ### Run Skyvern Task with Basic Parameters Source: https://docs.skyvern.com/api-reference/api-reference/agent/run-task_explorer=true This example demonstrates how to initiate a Skyvern task using the POST /v1/run/tasks endpoint with essential parameters like prompt and optional URL. ```curl POST https://api.skyvern.com/v1/run/tasks Content-Type: application/json { "prompt": "Find the cheapest flights from London to New York for next week.", "url": "https://www.google.com" } ``` -------------------------------- ### Run Skyvern Task with Required Parameters Source: https://docs.skyvern.com/api-reference This example demonstrates how to run a Skyvern task using the API, requiring only the prompt. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Search for the latest news on AI." \ }' ``` -------------------------------- ### GET /v1/workflows Source: https://docs.skyvern.com/api-reference/api-reference/workflows/get-workflows_explorer=true Retrieves all workflows with their latest versions for the organization. Supports pagination and filtering by title. ```APIDOC ## GET /v1/workflows ### Description Get all workflows with the latest version for the organization. ### Method GET ### Endpoint https://api.skyvern.com/v1/workflows ### Parameters #### Path Parameters None #### Query Parameters - **page** (integer) - Optional - `>=1` Defaults to `1` - **page_size** (integer) - Optional - `>=1` Defaults to `10` - **only_saved_tasks** (boolean) - Optional - Defaults to `false` - **only_workflows** (boolean) - Optional - Defaults to `false` - **title** (string) - Optional - Defaults to `` - **template** (boolean) - Optional - Defaults to `false` ### Request Example None ### Response #### Success Response (200) - **workflow_id** (string) - **organization_id** (string) - **title** (string) - **workflow_permanent_id** (string) - **version** (integer) - **is_saved_task** (boolean) - **workflow_definition** (object) - **created_at** (string, format: "date-time") - **modified_at** (string, format: "date-time") - **description** (string or null) - **proxy_location** (enum or null) - **webhook_callback_url** (string or null) - **totp_verification_url** (string or null) - **totp_identifier** (string or null) - **persist_browser_session** (boolean or null, Defaults to `false`) - **model** (map from strings to any or null) - **status** (enum or null, Allowed values: published, draft, auto_generated) - **max_screenshots_scrolls** (integer or null) - **extra_http_headers** (map from strings to strings or null) - **generate_script** (boolean or null, Defaults to `false`) - **ai_fallback** (boolean or null, Defaults to `false`) - **cache_key** (string or null) - **deleted_at** (string or null, format: "date-time") #### Response Example ```json { "workflow_id": "wf_123", "organization_id": "org_abc", "title": "Sample Workflow", "workflow_permanent_id": "wp_xyz", "version": 1, "is_saved_task": false, "workflow_definition": {}, "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T11:00:00Z", "description": "A sample workflow description.", "proxy_location": "us-east-1", "webhook_callback_url": null, "totp_verification_url": null, "totp_identifier": null, "persist_browser_session": false, "model": {}, "status": "published", "max_screenshots_scrolls": 5, "extra_http_headers": {}, "generate_script": false, "ai_fallback": false, "cache_key": null, "deleted_at": null } ``` ### Errors - **422** Unprocessable Entity Error ``` -------------------------------- ### Python SDK Integration Source: https://docs.skyvern.com/running-tasks/run-tasks Provides examples of how to integrate with the Skyvern API using the Python SDK, including connecting to a local browser and running tasks. ```APIDOC ## Python SDK Examples ### Using a Local Chrome Browser This example demonstrates how to initialize the Skyvern client and run a task, specifying a local Chrome browser path. ```python from skyvern import Skyvern # The path to your Chrome browser. This example path is for Mac. browser_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" skyvern = Skyvern( base_url="http://localhost:8000", api_key="YOUR_API_KEY", browser_path=browser_path, ) task = await skyvern.run_task( prompt="Find the top post on hackernews today", ) ``` ### Using Skyvern Service with CDP Connect This example shows how to configure the Skyvern service to connect to a local Chrome instance and then run a task using the SDK without explicitly specifying the browser path. **Skyvern Service Configuration:** ```bash CHROME_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" BROWSER_TYPE=cdp-connect ``` Restart your Skyvern service (`skyvern run server`) and then use the following Python code: ```python from skyvern import Skyvern skyvern = Skyvern( base_url="http://localhost:8000", api_key="YOUR_API_KEY", ) task = await skyvern.run_task( prompt="Find the top post on hackernews today", ) ``` ``` -------------------------------- ### Run Skyvern Task with Publish Workflow and Screenshot Options Source: https://docs.skyvern.com/api-reference This example demonstrates running a Skyvern task, publishing it as a reusable workflow, and configuring screenshot options. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Automate a data entry process.", \ "publish_workflow": true, \ "max_screenshots_scrolls": 5 \ }' ``` -------------------------------- ### Webhook Authentication (Python Example) Source: https://docs.skyvern.com/running-tasks/webhooks-faq Demonstrates how to authenticate incoming webhook requests using HMAC-SHA256 signature verification in Python. ```APIDOC ## How do we handle webhook authentication? ### Python Example ```python import hmac import hashlib from fastapi import Request # Assume SKYVERN_API_KEY is securely stored and accessible # SKYVERN_API_KEY = "your_secret_api_key" def validate_skyvern_request_headers(request: Request) -> bool: """Validates the X-Skyvern-Signature header for incoming webhook requests.""" header_skyvern_signature = request.headers.get("x-skyvern-signature") if not header_skyvern_signature: return False # Ensure the request body is read correctly (may vary based on framework) # For FastAPI, request.body() might consume the stream. Handle with care. payload = request.stream_response.body # Example for stream_response.body, check your framework's way to get raw body hash_obj = hmac.new(SKYVERN_API_KEY.encode("utf-8"), msg=payload, digestmod=hashlib.sha256) client_generated_signature = hash_obj.hexdigest() return hmac.compare_digest(header_skyvern_signature, client_generated_signature) ``` ``` -------------------------------- ### Run a task Source: https://docs.skyvern.com/api-reference/api-reference/agent/run-task_explorer=true Initiates a task execution on the Skyvern platform. You can specify the prompt, starting URL, engine, and various other parameters to control the task's behavior and output. ```APIDOC ## POST /v1/run/tasks ### Description Run a task on the Skyvern platform. ### Method POST ### Endpoint https://api.skyvern.com/v1/run/tasks ### Headers - **x-api-key** (string) - Required - API key for authentication. - **x-user-agent** (string) - Optional - User agent string for the request. ### Request Body This endpoint expects an object with the following properties: - **prompt** (string) - Required - The goal or task description for Skyvern to accomplish. - **url** (string) - Optional - The starting URL for the task. If not provided, Skyvern will attempt to determine an appropriate URL. - **engine** (enum) - Optional - The engine that powers the agent task. Allowed values: `skyvern-1.0`, `skyvern-2.0`, `openai-cua`, `anthropic-cua`, `ui-tars`. - **title** (string) - Optional - The title for the task. - **proxy_location** (enum) - Optional - Geographic Proxy location to route the browser traffic through. Available options include `RESIDENTIAL`, `RESIDENTIAL_ES`, `RESIDENTIAL_IE`, `RESIDENTIAL_GB`, `RESIDENTIAL_IN`, `RESIDENTIAL_JP`, `RESIDENTIAL_FR`, `RESIDENTIAL_DE`, `RESIDENTIAL_NZ`, `RESIDENTIAL_ZA`, `RESIDENTIAL_AR`, `RESIDENTIAL_AU`, `RESIDENTIAL_ISP`, `US-CA`, `US-NY`, `US-TX`, `US-FL`, `US-WA`, `NONE`. - **data_extraction_schema** (map from strings to any or list of any or string) - Optional - The schema for data to be extracted from the webpage. - **error_code_mapping** (map from strings to strings) - Optional - Custom mapping of error codes to error messages. - **max_steps** (integer) - Optional - Maximum number of steps the task can take. - **webhook_url** (string) - Optional - URL to send updates to after the run is finished. - **totp_identifier** (string) - Optional - Identifier for the TOTP/2FA/MFA code. - **totp_url** (string) - Optional - URL that serves TOTP/2FA/MFA codes. - **browser_session_id** (string) - Optional - ID of the Skyvern browser session to use. - **model** (map from strings to any) - Optional - Optional model configuration. - **extra_http_headers** (map from strings to strings) - Optional - Extra HTTP headers for requests within the browser. - **publish_workflow** (boolean) - Optional - Defaults to `false`. Whether to publish this task as a reusable workflow. - **include_action_history_in_verification** (boolean) - Optional - Defaults to `false`. Whether to include action history when verifying task completion. - **max_screenshots_scrolls** (integer) - Optional - Maximum number of scrolls for the post-action screenshot. - **browser_address** (string) - Optional - The CDP address for the task. ### Request Example ```json { "prompt": "Find the cheapest flights from New York to London for next week.", "url": "https://www.google.com", "engine": "skyvern-2.0", "max_steps": 50 } ``` ### Response #### Success Response (200) (Response structure will vary based on the task and data extraction schema.) #### Response Example ```json { "task_id": "task_12345", "status": "completed", "result": { "cheapest_flight": { "airline": "ExampleAir", "price": "$500", "departure": "2023-10-27", "arrival": "2023-10-28" } } } ``` ``` -------------------------------- ### Run Skyvern Task with Advanced Parameters Source: https://docs.skyvern.com/api-reference/api-reference/agent/run-task_explorer=true This example shows how to run a Skyvern task with advanced configurations including engine selection, data extraction schema, and proxy location. ```curl POST https://api.skyvern.com/v1/run/tasks Content-Type: application/json { "prompt": "Extract all product names and prices from the given URL.", "url": "https://example-shop.com/products", "engine": "skyvern-2.0", "data_extraction_schema": { "product_name": "string", "price": "float" }, "proxy_location": "RESIDENTIAL_GB", "max_steps": 50, "webhook_url": "https://your-callback-url.com/skyvern-webhook" } ``` -------------------------------- ### Launch Local Skyvern Server Source: https://docs.skyvern.com/integrations/mcp Starts the Skyvern server when running in local mode. This command is not required if connecting to Skyvern Cloud. ```bash $ skyvern run server ``` -------------------------------- ### Get Run Timeline Source: https://docs.skyvern.com/api-reference/api-reference/get-run-timeline Retrieves the timeline for a specified run, which can be a workflow run or a task_v2 run. ```APIDOC ## GET /v1/runs/:run_id/timeline ### Description Get timeline for a run (workflow run or task_v2 run) ### Method GET ### Endpoint https://api.skyvern.com/v1/runs/:run_id/timeline ### Parameters #### Path Parameters - **run_id** (string) - Required - The id of the workflow run or task_v2 run. #### Headers - **x-api-key** (string) - Required ### Response #### Success Response (200) - **type** (enum) - Allowed values: thoughtblock - **created_at** (string) `format: "date-time"` - **modified_at** (string) `format: "date-time"` - **block** (object or null) - Show 33 properties - **thought** (object or null) - Show 21 properties - **children** (list of objects or null) - Show 6 properties #### Response Example ```json { "type": "thoughtblock", "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:05:00Z", "block": {}, "thought": {}, "children": [ {} ] } ``` ### Errors - **400** - Bad Request Error - **404** - Not Found Error - **422** - Unprocessable Entity Error ``` -------------------------------- ### GET /v1/credentials Source: https://docs.skyvern.com/api-reference/api-reference/credentials/get-credentials_explorer=true Retrieves a paginated list of credentials for the current organization. ```APIDOC ## GET /v1/credentials ### Description Retrieves a paginated list of credentials for the current organization. ### Method GET ### Endpoint https://api.skyvern.com/v1/credentials ### Parameters #### Path Parameters None #### Query Parameters - **page** (integer) - Optional - Page number for pagination. Defaults to `1`. Must be `>=1`. - **page_size** (integer) - Optional - Number of items per page. Defaults to `10`. Must be `>=1`. #### Request Body None ### Request Example None ### Response #### Success Response (200) - **credential_id** (string) - Unique identifier for the credential. - **credential** (object) - The credential data. - **credential_type** (enum) - Type of the credential. Allowed values: `password`, `credit_card`. - **name** (string) - Name of the credential. #### Response Example ```json { "credentials": [ { "credential_id": "cred_12345", "credential": { "credential_type": "password", "name": "Example Credential" } } ], "total_items": 1, "page": 1, "page_size": 10 } ``` ### Errors - **422** - Unprocessable Entity Error ``` -------------------------------- ### GET /v1/credentials Source: https://docs.skyvern.com/api-reference/api-reference/credentials/get-credentials Retrieves a paginated list of credentials for the current organization. ```APIDOC ## GET /v1/credentials ### Description Retrieves a paginated list of credentials for the current organization. ### Method GET ### Endpoint https://api.skyvern.com/v1/credentials ### Headers - **x-api-keystring** (string) - Required - The API key for authentication. ### Query Parameters - **page** (integer) - Optional - Page number for pagination. Defaults to `1`. Minimum value: `1`. - **page_size** (integer) - Optional - Number of items per page. Defaults to `10`. Minimum value: `1`. ### Response #### Success Response (200) - **credential_id** (string) - Unique identifier for the credential. - **credential** (object) - The credential data. - **credential_type** (enum) - Type of the credential. Allowed values: `password`, `credit_card`. - **name** (string) - Name of the credential. #### Response Example ```json { "credentials": [ { "credential_id": "cred_12345", "credential": { "credential_type": "password", "name": "MyWebServiceLogin" } } ], "pagination": { "next_page": null, "prev_page": null, "total_pages": 1, "total_items": 1 } } ``` ### Errors #### Unprocessable Entity Error (422) Returned when the request parameters are invalid. ``` -------------------------------- ### Install Skyvern Package Source: https://docs.skyvern.com/integrations/mcp Installs the Skyvern Python package using pip. Ensure you have a compatible Python version (3.11, 3.12, or 3.13). ```bash $ pip install skyvern ``` -------------------------------- ### Run Skyvern Task with Max Steps and Webhook Source: https://docs.skyvern.com/api-reference This example shows how to run a Skyvern task with a limit on the number of steps and a webhook to receive completion updates. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Navigate through a multi-step form.", \ "max_steps": 10, \ "webhook_url": "https://example.com/webhook" \ }' ``` -------------------------------- ### Run Skyvern Task with Data Extraction Schema Source: https://docs.skyvern.com/api-reference This example illustrates running a Skyvern task and extracting specific data using a JSON schema. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Extract all product names and prices from the given webpage.", \ "data_extraction_schema": { \ "product_name": "string", \ "price": "number" \ } \ }' ``` -------------------------------- ### GET /v1/runs/:run_id/timeline Source: https://docs.skyvern.com/api-reference/api-reference/get-run-timeline_explorer=true Retrieves the timeline for a specified run, which can be a workflow run or a task_v2 run. ```APIDOC ## GET /v1/runs/:run_id/timeline ### Description Get timeline for a run (workflow run or task_v2 run) ### Method GET ### Endpoint https://api.skyvern.com/v1/runs/:run_id/timeline ### Parameters #### Path Parameters - **run_id** (string) - Required - The id of the workflow run or task_v2 run. #### Headers - **x-api-key** (string) - Required ### Response #### Success Response (200) - **type** (enum) - Allowed values: block - **created_at** (string `format: "date-time"`) - **modified_at** (string `format: "date-time"`) - **block** (object or null) - Shows 33 properties - **thought** (object or null) - Shows 21 properties - **children** (list of objects or null) - Shows 6 properties #### Response Example ```json { "type": "block", "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:05:00Z", "block": { "property1": "value1", "property2": "value2" }, "thought": { "thought1": "detail1", "thought2": "detail2" }, "children": [ { "child_id": "child1" }, { "child_id": "child2" } ] } ``` ### Errors - **400** - Bad Request Error - **404** - Not Found Error - **422** - Unprocessable Entity Error ``` -------------------------------- ### Initialize Laminar and Configure LiteLLM Callbacks for Skyvern Source: https://docs.skyvern.com/observability/overview This Python code demonstrates how to initialize Laminar for tracing Skyvern workflows and configure LiteLLM callbacks to capture all LLM calls. It includes importing necessary libraries, loading environment variables, initializing Laminar with disabled OpenAI instrumentation, and setting up LiteLLM callbacks. The example then runs a Skyvern task to automate a browser interaction. ```python from skyvern import Skyvern import asyncio import litellm from lmnr import Laminar, LaminarLiteLLMCallback, Instruments from dotenv import load_dotenv load_dotenv() # Initialize Laminar # This will automatically trace all Skyvern functions # Disable OpenAI to avoid double instrumentation of LLM calls Laminar.initialize(disabled_instruments=set([Instruments.OPENAI])) # Configure LiteLLM to trace all LLM calls made by Skyvern litellm.callbacks = [LaminarLiteLLMCallback()] skyvern = Skyvern() async def main(): task = await skyvern.run_task( prompt="go to lmnr.ai, summarize the pricing page." ) print(task) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Run Skyvern Task with Model Configuration and Extra Headers Source: https://docs.skyvern.com/api-reference This example shows how to run a Skyvern task with custom model configuration and additional HTTP headers for browser requests. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Perform an action requiring specific model parameters.", \ "model": { \ "temperature": 0.7 \ }, \ "extra_http_headers": { \ "Custom-Header": "Value" \ } \ }' ``` -------------------------------- ### Get a Browser Session Source: https://docs.skyvern.com/api-reference/api-reference/browser-sessions/get-browser-session Retrieve details about a specific browser session, including the browser address for CDP connection. Requires an API key for authentication. ```APIDOC ## GET /v1/browser_sessions/:browser_session_id ### Description Get details about a specific browser session, including the browser address for cdp connection. ### Method GET ### Endpoint https://api.skyvern.com/v1/browser_sessions/:browser_session_id ### Parameters #### Path Parameters - **browser_session_id** (string) - Required - The ID of the browser session. browser_session_id starts with `pbs_` #### Headers - **x-api-key** (string) - Required - Your Skyvern API key. ### Response #### Success Response (200) - **browser_session_id** (string) - Unique identifier for the browser session. starts with `pbs_`. - **organization_id** (string) - ID of the organization that owns this session. - **created_at** (string) - Timestamp when the session was created (format: "date-time"). - **modified_at** (string) - Timestamp when the session was last modified (format: "date-time"). - **runnable_type** (string or null) - Type of the current runnable associated with this session (workflow, task etc). - **runnable_id** (string or null) - ID of the current runnable. - **timeout** (integer or null) - Timeout in minutes for the session. Defaults to 60 minutes. - **browser_address** (string or null) - URL for connecting to the browser. - **app_url** (string or null) - URL for the browser session page. - **vnc_streaming_supported** (boolean or null) - Whether the browser session supports VNC streaming (defaults to `false`). - **started_at** (string or null) - Timestamp when the session was started (format: "date-time"). - **completed_at** (string or null) - Timestamp when the session was completed (format: "date-time"). - **deleted_at** (string or null) - Timestamp when the session was deleted, if applicable (format: "date-time"). #### Response Example { "browser_session_id": "pbs_abc123xyz", "organization_id": "org_456def", "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:05:00Z", "runnable_type": "workflow", "runnable_id": "wf_789ghi", "timeout": 60, "browser_address": "ws://localhost:9222/devtools/..., "app_url": "https://example.com", "vnc_streaming_supported": false, "started_at": "2023-10-27T10:01:00Z", "completed_at": null, "deleted_at": null } ### Errors - **403** Forbidden Error - **404** Not Found Error - **422** Unprocessable Entity Error ``` -------------------------------- ### Get Workflows Source: https://docs.skyvern.com/api-reference/api-reference/workflows/get-workflows Retrieves all workflows with the latest version for the organization. Supports filtering and pagination. ```APIDOC ## GET /v1/workflows ### Description Get all workflows with the latest version for the organization. ### Method GET ### Endpoint https://api.skyvern.com/v1/workflows ### Headers - **x-api-keystring** (string) - Required ### Query Parameters - **page** (integer) - Optional, `>=1`, Defaults to `1` - **page_size** (integer) - Optional, `>=1`, Defaults to `10` - **only_saved_tasks** (boolean) - Optional, Defaults to `false` - **only_workflows** (boolean) - Optional, Defaults to `false` - **title** (string) - Optional, Defaults to `` - **template** (boolean) - Optional, Defaults to `false` ### Response #### Success Response (200) - **workflow_id** (string) - **organization_id** (string) - **title** (string) - **workflow_permanent_id** (string) - **version** (integer) - **is_saved_task** (boolean) - **workflow_definition** (object) - **created_at** (string, format: "date-time") - **modified_at** (string, format: "date-time") - **description** (string or null) - **proxy_location** (enum or null) - **webhook_callback_url** (string or null) - **totp_verification_url** (string or null) - **totp_identifier** (string or null) - **persist_browser_session** (boolean or null, Defaults to `false`) - **model** (map from strings to any or null) - **status** (enum or null, Allowed values: `published`, `draft`, `auto_generated`) - **max_screenshots_scrolls** (integer or null) - **extra_http_headers** (map from strings to strings or null) - **generate_script** (boolean or null, Defaults to `false`) - **ai_fallback** (boolean or null, Defaults to `false`) - **cache_key** (string or null) - **deleted_at** (string or null, format: "date-time") #### Response Example ```json { "workflow_id": "wf_12345", "organization_id": "org_abcde", "title": "Sample Workflow", "workflow_permanent_id": "wp_abcdef", "version": 1, "is_saved_task": false, "workflow_definition": {}, "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:00:00Z", "description": null, "proxy_location": null, "webhook_callback_url": null, "totp_verification_url": null, "totp_identifier": null, "persist_browser_session": false, "model": null, "status": "published", "max_screenshots_scrolls": null, "extra_http_headers": null, "generate_script": false, "ai_fallback": false, "cache_key": null, "deleted_at": null } ``` ### Errors - **422** - Unprocessable Entity Error ``` -------------------------------- ### Create Browser Session (cURL) Source: https://docs.skyvern.com/api-reference/api-reference/browser-sessions/create-browser-session Example of creating a new browser session using cURL. This involves a POST request to the API with necessary headers and an optional timeout parameter. ```shell curl -X POST \ https://api.skyvern.com/v1/browser_sessions \ -H 'x-api-keystring: YOUR_API_KEYSTRING' \ -H 'Content-Type: application/json' \ -d '{ \ "timeout": 120 \ }' ``` -------------------------------- ### GET /v1/runs/:run_id/artifacts Source: https://docs.skyvern.com/api-reference/api-reference/artifacts/get-run-artifacts_explorer=true Retrieves a list of artifacts for a specified run ID. Supports filtering by artifact type. ```APIDOC ## GET /v1/runs/:run_id/artifacts ### Description Retrieves a list of artifacts associated with a specific run. ### Method GET ### Endpoint https://api.skyvern.com/v1/runs/:run_id/artifacts ### Parameters #### Path Parameters - **run_id** (string) - Required - The id of the task run or the workflow run. #### Query Parameters - **artifact_type** (list of enums) - Optional - Filters artifacts by type. There are 26 possible enum values. #### Headers - **x-api-key** (string) - Required - Your Skyvern API key. ### Response #### Success Response (200) - **created_at** (string) - The creation datetime of the task. - **modified_at** (string) - The modification datetime of the task. - **artifact_id** (string) - The unique identifier for the artifact. - **artifact_type** (enum) - The type of the artifact. There are 26 possible enum values. - **uri** (string) - The Uniform Resource Identifier for the artifact. - **organization_id** (string) - The ID of the organization the artifact belongs to. - **task_id** (string or null) - The ID of the task associated with the artifact, if applicable. - **step_id** (string or null) - The ID of the step associated with the artifact, if applicable. - **workflow_run_id** (string or null) - The ID of the workflow run associated with the artifact, if applicable. - **workflow_run_block_id** (string or null) - The ID of the workflow run block associated with the artifact, if applicable. - **observer_cruise_id** (string or null) - The ID of the observer cruise associated with the artifact, if applicable. - **observer_thought_id** (string or null) - The ID of the observer thought associated with the artifact, if applicable. - **ai_suggestion_id** (string or null) - The ID of the AI suggestion associated with the artifact, if applicable. - **signed_url** (string or null) - A pre-signed URL to access the artifact, if applicable. #### Response Example ```json { "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:05:00Z", "artifact_id": "art_abcdef123456", "artifact_type": "image/png", "uri": "s3://skyvern-artifacts/runs/run_xyz789/image.png", "organization_id": "org_abc123", "task_id": "task_def456", "step_id": null, "workflow_run_id": "wr_ghi789", "workflow_run_block_id": null, "observer_cruise_id": null, "observer_thought_id": null, "ai_suggestion_id": null, "signed_url": "https://skyvern-s3.s3.amazonaws.com/..." } ``` ### Errors #### 422 Unprocessable Entity - Indicates an issue with the request, such as an invalid `run_id` format or an unsupported `artifact_type`. ``` -------------------------------- ### GET /v1/artifacts/:artifact_id Source: https://docs.skyvern.com/api-reference/api-reference/artifacts/get-artifact_explorer=true Retrieves detailed information about a specific artifact using its unique identifier. Requires authentication via an API key. ```APIDOC ## GET /v1/artifacts/:artifact_id ### Description Retrieves detailed information about a specific artifact using its unique identifier. ### Method GET ### Endpoint https://api.skyvern.com/v1/artifacts/:artifact_id ### Parameters #### Path Parameters - **artifact_id** (string) - Required - The unique identifier of the artifact. #### Query Parameters None #### Headers - **x-api-key** (string) - Required - Your Skyvern API key for authentication. ### Request Example ```json { "example": "No request body for GET" } ``` ### Response #### Success Response (200) - **created_at** (string) - The creation datetime of the artifact. - **modified_at** (string) - The modification datetime of the artifact. - **artifact_id** (string) - The unique identifier of the artifact. - **artifact_type** (enum) - The type of the artifact. (Shows 26 enum values) - **uri** (string) - The Uniform Resource Identifier for the artifact. - **organization_id** (string) - The identifier of the organization the artifact belongs to. - **task_id** (string or null) - The ID of the task associated with the artifact, if any. - **step_id** (string or null) - The ID of the step within a task, if applicable. - **workflow_run_id** (string or null) - The ID of the workflow run, if associated. - **workflow_run_block_id** (string or null) - The ID of a specific block within a workflow run. - **observer_cruise_id** (string or null) - The ID of the observer cruise, if relevant. - **observer_thought_id** (string or null) - The ID of an observer's thought process. - **ai_suggestion_id** (string or null) - The ID of an AI suggestion, if provided. - **signed_url** (string or null) - A signed URL to access the artifact, if applicable. #### Response Example ```json { "created_at": "2023-10-27T10:00:00Z", "modified_at": "2023-10-27T10:05:00Z", "artifact_id": "art_123abc", "artifact_type": "image/jpeg", "uri": "s3://skyvern-artifacts/artifacts/art_123abc.jpg", "organization_id": "org_xyz789", "task_id": "task_456def", "step_id": null, "workflow_run_id": "wr_789ghi", "workflow_run_block_id": null, "observer_cruise_id": null, "observer_thought_id": null, "ai_suggestion_id": null, "signed_url": "https://skyvern-artifacts.s3.amazonaws.com/artifacts/art_123abc.jpg?AWSAccessKeyId=...&Signature=..." } ``` ### Errors - **404 Not Found Error**: The specified artifact ID does not exist. - **422 Unprocessable Entity Error**: The request could not be processed due to invalid data. ``` -------------------------------- ### Get A Browser Session Source: https://docs.skyvern.com/browser-sessions/introduction Retrieves the details of an existing browser session using its unique ID. ```APIDOC ## GET /browser_sessions/{browser_session_id} ### Description Retrieves an existing browser session by its ID. ### Method GET ### Endpoint /browser_sessions/{browser_session_id} ### Parameters #### Path Parameters - **browser_session_id** (string) - Required - The unique identifier of the browser session to retrieve. ### Request Example ```python from skyvern import Skyvern skyvern = Skyvern(api_key="YOUR_API_KEY") browser_session = await skyvern.get_browser_session( browser_session_id="YOUR_BROWSER_SESSION_ID", ) ``` ### Response #### Success Response (200) - **browser_session_id** (string) - The unique identifier of the browser session. - **status** (string) - The current status of the browser session (e.g., 'active', 'closed'). - **created_at** (string) - The timestamp when the session was created. #### Response Example ```json { "browser_session_id": "sess_12345abcde", "status": "active", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Run Skyvern Task with TOTP and Browser Session Source: https://docs.skyvern.com/api-reference This example demonstrates running a Skyvern task that requires Time-based One-Time Password (TOTP) and utilizes a persistent browser session. It sends a POST request to the '/v1/run/tasks' endpoint. ```bash curl --request POST \ --url https://api.skyvern.com/v1/run/tasks \ --header 'x-api-keystring: YOUR_API_KEY' \ --data '{ \ "prompt": "Complete a login process with 2FA.", \ "totp_identifier": "my-totp-id", \ "browser_session_id": "my-session-123" \ }' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.