python installation & run task docs (#2384)

This commit is contained in:
Shuchang Zheng
2025-05-19 00:31:04 -07:00
committed by GitHub
parent 52bbf3e18a
commit 622b4cb71d
4 changed files with 60 additions and 3 deletions

View File

@@ -102,6 +102,33 @@ This quickstart guide will walk you through getting Skyvern up and running on yo
skyvern run ui
```
5. **Run task**
Run a skyvern task locally:
```python
from skyvern import Skyvern
skyvern = Skyvern()
task = await skyvern.run_task(prompt="Find the top post on hackernews today")
print(task)
```
You should see your local browser
You can also send a task to Skyvern Cloud
```python
from skyvern import Skyvern
skyvern = Skyvern()
task = await skyvern.agent.run_task(prompt="Find the top post on hackernews today")
print(task)
```
Or anywhere Skyvern is hosted:
```python
skyvern = Skyvern(base_url="http://localhost:8000", api_key="SKYVERN API KEY in LOCAL SKYVERN")
task = await skyvern.agent.run_task(prompt="Find the top post on hackernews today")
print(task)
```
## Docker Compose setup
1. Make sure you have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running on your machine

View File

@@ -70,6 +70,36 @@ Skyvern was inspired by the Task-Driven autonomous agent design popularized by [
</CardGroup>
## Quickstart
### Python SDK Installation
```bash
pip install skyvern
```
### Run Task
After initializing your local Skyvern setup, you can run agent tasks in any python code:
```python
from skyvern import Skyvern
skyvern = Skyvern()
task = await skyvern.run_task(prompt="Find the top post on hackernews today")
print(task)
```
### Run Task In Skyvern Service
Get your API key from [Skyvern Cloud](https://app.skyvern.com/settings) and to use Skyvern Cloud to run the task:
```python
from skyvern import Skyvern
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")
task = await skyvern.agent.run_task(prompt="Find the top post on hackernews today")
print(task)
```
More API & SDK information can be found in the [API Reference](/api-reference) section.
<CardGroup cols={2}>
<Card
title="Quickstart (Skyvern Cloud)"

View File

@@ -106,7 +106,7 @@
"code-samples": [
{
"sdk": "python",
"code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"your_api_key\")\nawait skyvern.run_task(prompt=\"What's the top post on hackernews?\")\n"
"code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"your_api_key\")\nawait skyvern.agent.run_task(prompt=\"What's the top post on hackernews?\")\n"
}
]
}
@@ -354,7 +354,7 @@
"code-samples": [
{
"sdk": "python",
"code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"your_api_key\")\nrun = await skyvern.get_run(run_id=\"tsk_v2_123\")\nprint(run)\n"
"code": "from skyvern import Skyvern\n\nskyvern = Skyvern(api_key=\"your_api_key\")\nrun = await skyvern.agent.get_run(run_id=\"tsk_v2_123\")\nprint(run)\n"
}
]
}

View File

@@ -24,7 +24,7 @@ class BaseClientWrapper:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "skyvern",
"X-Fern-SDK-Version": "0.1.83",
"X-Fern-SDK-Version": "0.1.85",
}
if self._api_key is not None:
headers["x-api-key"] = self._api_key