Skip to content

Commit

Permalink
Add task and workflow docs (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
suchintan committed Jun 18, 2024
1 parent be86a33 commit fc99ed0
Show file tree
Hide file tree
Showing 18 changed files with 743 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/getting-started/quickstart-open-source.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
1 change: 1 addition & 0 deletions docs/getting-started/quickstart-skyvern-cloud.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
1 change: 1 addition & 0 deletions docs/getting-started/supported-functionality.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
Binary file added docs/images/api_key_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/integrations/api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
1 change: 1 addition & 0 deletions docs/integrations/make.com.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
1 change: 1 addition & 0 deletions docs/integrations/zapier.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
9 changes: 4 additions & 5 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@
"getting-started/skyvern-in-action",
"getting-started/quickstart-skyvern-cloud",
"getting-started/quickstart-open-source",
"getting-started/supported-features"
"getting-started/supported-functionality"
]
},
{
"group": "Tasks",
"pages": [
"running-tasks/introduction",
"running-tasks/prompting-tips",
"running-tasks/advanced-features",
"running-tasks/api-spec",
"running-tasks/webhooks",
"running-tasks/webhooks-faq",
"running-tasks/visualizing-results",
"running-tasks/visualizing-results-advanced"
"running-tasks/prompting-tips",
"running-tasks/advanced-features"
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions docs/running-tasks/advanced-features.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
99 changes: 99 additions & 0 deletions docs/running-tasks/api-spec.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: API Spec
description: 'The core building block in Skyvern'
---

Tasks are the building block of Skyvern. They represent a single instruction to the browser to go do something using language models. Ex. “Go to alibaba and extract this information”

## Request - Initiate a task (Webhook)

### Body

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| url | String | yes | https://jobs.lever.co/leverdemo-8/45d39614-464a-4b62-a5cd-8683ce4fb80a/apply | The website that you would like to browse / scrape. This should be the ideal starting point for the agent |
| webhook_callback_url | String | no || The callback URL once our system is finished processing this async task |
| navigation_goal | String | no | Apply for a job | The prompt that tells the agent what the user-facing goal is. This is the guiding light for the LLM as it navigates a particular website / sitemap to achieve this specified goal |
| data_extraction_goal | String | no | Was the job application successful? | The prompt that instructs the agent to extract information once the agent has achieved its user_goal |
| navigation_payload | Object | no | "name": "Chris P. Bacon",<br/>"email": "mailto:chris@pbacon.com" | JSON-formatted payload with any “facts” or information that would help the agent perform its job. In the case of navigating an insurance quote, this payload would include any user information to help fill out the insurance flow such as date of birth, or age they got their license, and so on<br/><br/>This can include nested information, and the formatting isn’t validated |
| proxy_location | String | yes | RESIDENTIAL | Proxy location for the web-browsing request. Please pass RESIDENTIAL as a value |
| extracted_information_schema | JSON | no | | Used to enforce a JSON schema spec to be enforced in the data_extraction_goal. Similar to https://json-schema.org/ definition. |

## Example Request (Apply for a job)

```python
{
"url": "https://jobs.lever.co/leverdemo-8/45d39614-464a-4b62-a5cd-8683ce4fb80a/apply",
"navigation_goal": "Apply for a job",
"data_extraction_goal": "Was the job application successful?",
"proxy_location": "RESIDENTIAL",
"navigation_payload": {
"name": "Chris P. Bacon",
"email": "chris@pbacon.com"
}
}
```

## Response

| Parameter | Type | Always returned? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| task_id | String | yes | t_123456 | The task id associated with this specific task |

## Response Webhook - Task conclusion (POST)

### Headers

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| x-skyvern-signature | String | yes | v0=a2114d57b48eac39b9ad189<br/>dd8316235a7b4a8d21a10bd275<br/>19666489c69b503 | Authentication token that allows our service to communicate with your backend service via callback / webhook <br/>We’ll be using the same strategy slack uses, as defined here: https://api.slack.com/authentication/verifying-requests-from-slack#making__validating-a-request |
| x-skyvern-timestamp | String | yes | 1531420618 | Timestamp used to decode and validate the incoming webhook call<br/><br/>We’ll be using the same strategy slack uses, as defined here: https://api.slack.com/authentication/verifying-requests-from-slack#making__validating-a-request |

### Body

| Parameter | Type | Always returned? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| task_id | String | yes | t_123456 | The task id associated with this specific task |
| extracted_information | Object | Yes | 'price’: ‘$100.0’ | Unstructured JSON payload containing the extracted information as specified by the users’ input prompt |
| screenshot_url | String | Yes | … url to screenshot … | Screenshot of the final page, where the data extraction occurs |
| recording_url | String | Yes | .. url to recording … | Recording of the entire browsing session to help debug any issues |
| failure_reason | String | No | “Failed to pass this page - missing information: date of birth” | A failure reason that caused the job to fail. This can range from internal errors (Skyvern side) or external errors (insufficient information provided) |

## Request - Task Details (GET)

You can use this API to poll for task status updates if you don’t want to wait for webhook callbacks.

Request type: `GET`

Production:`api.skyvern.com/api/v1/tasks/{task_id}`

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| task_id | String | yes | t_123 | The id of the task you want to check the status of |

## Request - List Task Details (GET)

Request type: `GET`

Production:`api.skyvern.com/api/v1/tasks/`

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| page | Integer | no | 1 | default=1
has to be ≥1 |
| page_size | Integer | no | 10 | default=10
has to be ≥1 |

## Response - Task Details (GET)

| Parameter | Type | Sample Value | Description |
| --- | --- | --- | --- |
| request | JSON | | Includes the initial request sent to create the task. Fields included: url,webhook_callback_url,navigation_goal,data_extraction_goal,navigation_payload,proxy_location,extracted_information_schema |
| task_id | String | t_123 | The id of the task you want to check the status of |
| status | String | SUCCESS / FAILURE / IN_PROGRESS | String indicating the status of this task |
| created_at | Timestamp | 2022-11-22T22:55:55 | Timestamp indicating when the task was created. |
| modified_at | Timestamp | 2022-11-22T22:55:55 | Timestamp indicating when the task was last updated. Used to detect long-running tasks. |
| extracted_information | Object | Yes | 'price’: ‘$100.0’ |
| screenshot_url | String | Yes | … url to screenshot … |
| recording_url | String | Yes | .. url to recording … |
| failure_reason | String | No | “Failed to pass this page - missing information: invalid password” |
16 changes: 16 additions & 0 deletions docs/running-tasks/introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Introduction
description: 'Tasks are the building block of Skyvern'
---

# Getting your API Key

1. Navigate to [app.skyvern.com](https://app.skyvern.com) and log into your account
1. Validate that you're in the correct account (personal vs organization)
1. Click on "Settings"
1. Click Reveal to see your API key. This is the unique key associated with your account that allows you to intract with Skyvern


<img src="images/api_key_image.png" />

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
2 changes: 2 additions & 0 deletions docs/running-tasks/prompting-tips.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
2 changes: 2 additions & 0 deletions docs/running-tasks/visualizing-results.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<img src="https://thumbs.dreamstime.com/b/pug-dog-holding-pliers-screwdriver-behind-old-wooden-sign-text-under-construction-white-background-constructor-92836854.jpg" />
36 changes: 36 additions & 0 deletions docs/running-tasks/webhooks-faq.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Webhooks FAQ
description: 'How Skyvern notifies you when its done'
---

# FAQ
## Webhooks vs HTTP requests?

We use Webhooks for executing tasks as the expected runtime of these jobs can exceed default HTTP timeouts (1 minute)

## How do we handle webhook authentication? (ie how can we handle callbacks?)

- a python example for how to generate the signature:

```python
def validate_skyvern_request_headers(request: Request) -> bool:
header_skyvern_signature = request.headers["x-skyvern-signature"]
payload = request.body() # this is a bytes
hash_obj = hmac.new(SKYVERN_API_KEY.encode("utf-8"), msg=payload, digestmod=hashlib.sha256)
client_generated_signature = hash_obj.hexdigest()
return header_skyvern_signature == client_generated_signature
```

SKYVERN_API_KEY: this is the [api key](/running-tasks/introduction) specific to your organization

# Webhook common parameters

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| webhook_callback_url | String | yes || |

# Required Headers

| Parameter | Type | Required? | Sample Value | Description |
| --- | --- | --- | --- | --- |
| x-api-key | String | yes | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e<br/>yJleHAiOjQ4MjU0MjI5NzUsInN1YiI6<br/>Im9fMTA2MTUxNzEyNjQ5ODUxMzQ2In0 | Bearer token that gives your backend access to the Skyvern API. This will be manually provided by us |
Loading

0 comments on commit fc99ed0

Please sign in to comment.