Add workflow runs links from scheduler pages (#SKY-8468) (#5162)

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
This commit is contained in:
Shuchang Zheng 2026-03-19 14:19:07 -07:00 committed by GitHub
parent 7ed9cfebac
commit 1d2a398cbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 645 additions and 421 deletions

View file

@ -47,6 +47,264 @@ All methods are async. Use `await` inside `async def`, with `asyncio.run()` as e
---
## Browser control
The SDK can launch and connect to browsers directly, giving you a Playwright-compatible page with AI capabilities layered on top. This is separate from the API-level browser session methods — here you get a live `SkyvernBrowser` and `SkyvernBrowserPage` you can script against.
### `launch_local_browser`
Launch a local Chromium browser with CDP enabled. Requires local mode (`Skyvern.local()`).
```python
browser = await client.launch_local_browser(
headless: bool = False, # Run headless or with a visible window.
port: int = 9222, # CDP port.
args: list[str] | None = None, # Extra Chromium flags.
user_data_dir: str | None = None,# Persistent profile directory.
) -> SkyvernBrowser
```
### `connect_to_browser_over_cdp`
Connect to any running browser via Chrome DevTools Protocol.
```python
browser = await client.connect_to_browser_over_cdp(
cdp_url: str, # e.g. "http://localhost:9222"
) -> SkyvernBrowser
```
### `connect_to_cloud_browser_session`
Connect to an existing cloud browser session by ID.
```python
browser = await client.connect_to_cloud_browser_session(
browser_session_id: str,
) -> SkyvernBrowser
```
### `launch_cloud_browser`
Create a new cloud browser session and connect to it.
```python
browser = await client.launch_cloud_browser(
timeout: int | None = None, # Minutes (5-1440). Default 60.
proxy_location: ProxyLocation | None = None,
) -> SkyvernBrowser
```
### `use_cloud_browser`
Reuse the most recent available cloud session, or create a new one if none exists.
```python
browser = await client.use_cloud_browser(
timeout: int | None = None,
proxy_location: ProxyLocation | None = None,
) -> SkyvernBrowser
```
### Getting a page
```python
page = await browser.get_working_page() # Most recent page, or creates one
page = await browser.new_page() # Always creates a new tab
```
Both return a `SkyvernBrowserPage` — a Playwright `Page` with AI methods added.
---
## Page-level AI methods
`SkyvernBrowserPage` extends Playwright's `Page`. You can use all standard Playwright methods (`goto`, `fill`, `locator`, `screenshot`, etc.) plus these AI-powered methods.
### `page.act`
Perform an action described in natural language.
```python
await page.act(prompt: str) -> None
```
```python
await page.act("Click the login button")
await page.act("Select 'United States' from the country dropdown")
```
### `page.click` (AI-enhanced)
Click an element using a CSS selector, an AI prompt, or both with fallback.
```python
await page.click(
selector: str | None = None, # CSS selector.
prompt: str | None = None, # Natural language target description.
ai: str | None = "fallback", # "fallback" (try selector, then AI) or None.
**kwargs, # Standard Playwright click options.
) -> str | None
```
```python
# Selector only
await page.click("#submit-btn")
# AI only
await page.click(prompt="Click the 'Submit Order' button")
# Selector with AI fallback
await page.click("#submit-btn", prompt="Click the submit button")
```
### `page.extract`
Extract structured data from the current page using AI.
```python
result = await page.extract(
prompt: str, # What to extract.
schema: dict | list | str | None = None, # JSON Schema for the output.
error_code_mapping: dict[str, str] | None = None,
) -> dict | list | str | None
```
```python
products = await page.extract(
prompt="Extract all products with name and price",
schema={
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"price": {"type": "number"},
},
},
},
)
```
### `page.agent.run_task`
Run an AI task in the context of the current page. Always waits for completion.
```python
result = await page.agent.run_task(
prompt: str,
engine: RunEngine = RunEngine.skyvern_v2,
url: str | None = None, # Defaults to current page URL.
data_extraction_schema: dict | str | None = None,
max_steps: int | None = None,
timeout: float = 1800,
# Plus: model, webhook_url, totp_identifier, totp_url, title, error_code_mapping, user_agent
) -> TaskRunResponse
```
### `page.agent.login`
Run a login workflow in the context of the current page. Supports all credential types.
```python
# Skyvern credentials
await page.agent.login(
credential_type=CredentialType.skyvern,
credential_id="cred_123",
)
# Bitwarden
await page.agent.login(
credential_type=CredentialType.bitwarden,
bitwarden_item_id="item_id",
)
# 1Password
await page.agent.login(
credential_type=CredentialType.onepassword,
onepassword_vault_id="vault_id",
onepassword_item_id="item_id",
)
# Azure Key Vault
await page.agent.login(
credential_type=CredentialType.azure_vault,
azure_vault_name="vault_name",
azure_vault_username_key="username_key",
azure_vault_password_key="password_key",
)
```
### `page.agent.download_files`
Download files using AI navigation, in the context of the current page.
```python
result = await page.agent.download_files(
prompt: str,
url: str | None = None,
download_suffix: str | None = None,
download_timeout: float | None = None,
max_steps_per_run: int | None = None,
timeout: float = 1800,
) -> WorkflowRunResponse
```
### `page.agent.run_workflow`
Run a workflow in the context of the current page.
```python
result = await page.agent.run_workflow(
workflow_id: str,
parameters: dict | None = None,
timeout: float = 1800,
) -> WorkflowRunResponse
```
### Full example
```python
from skyvern import Skyvern
from skyvern.schemas.run_blocks import CredentialType
async def main():
client = Skyvern(api_key="YOUR_API_KEY")
browser = await client.launch_cloud_browser()
page = await browser.get_working_page()
# Navigate and log in with AI
await page.goto("https://app.example.com")
await page.agent.login(
credential_type=CredentialType.skyvern,
credential_id="cred_123",
)
# Mix Playwright and AI
await page.click("#invoices-tab")
data = await page.extract(
prompt="Extract all invoice numbers and amounts",
schema={
"type": "array",
"items": {
"type": "object",
"properties": {
"invoice_number": {"type": "string"},
"amount": {"type": "number"},
},
},
},
)
print(data)
await browser.close()
import asyncio
asyncio.run(main())
```
---
## Imports
```python
@ -591,3 +849,6 @@ print(run.output)
- Only workflow runs with `persist_browser_session=True` produce archives for profile creation.
- Session archiving is async — profile creation may need a short retry delay after a run completes.
- `engine` accepts `RunEngine` enum values: `skyvern_v1`, `skyvern_v2`, `openai_cua`, `anthropic_cua`, `ui_tars`.
- `launch_local_browser` only works in local mode (`Skyvern.local()`). Cloud browser methods (`launch_cloud_browser`, `use_cloud_browser`, `connect_to_cloud_browser_session`) require cloud environment.
- `page.agent` methods always wait for completion — they don't support `wait_for_completion=False`.
- TypeScript SDK does not support browser control (local or cloud) — use the Python SDK for browser automation.