Skyvern/docs/sdk-reference/tasks/get-run.mdx

72 lines
2.1 KiB
Text

---
title: "get_run"
slug: sdk-reference/tasks/get-run
---
Get the current status and results of any run (task or workflow).
<CodeGroup>
```python Python
run = await client.get_run("tsk_v2_486305187432193504")
print(run.status, run.output)
```
```typescript TypeScript
const run = await skyvern.getRun("tsk_v2_486305187432193504");
console.log(run.status, run.output);
```
</CodeGroup>
### Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `run_id` | `str` | Yes | The run ID returned by `run_task` or `run_workflow`. |
| `request_options` | `RequestOptions` | No | Per-request configuration (see below). |
### Returns `GetRunResponse`
A discriminated union based on `run_type`. All variants share the same core fields as `TaskRunResponse` above, plus a `run_type` field (`task_v1`, `task_v2`, `openai_cua`, `anthropic_cua`, `ui_tars`, `workflow_run`).
Workflow run responses additionally include `run_with` and `ai_fallback` fields.
---
### Request options
Override timeout, retries, or headers for this call by passing `request_options` (Python) or a second options argument (TypeScript).
<CodeGroup>
```python Python
from skyvern.client.core import RequestOptions
request_options=RequestOptions(
timeout_in_seconds=120,
max_retries=3,
additional_headers={"x-custom-header": "value"},
)
```
```typescript TypeScript
// Pass as second argument to any method
{
timeoutInSeconds: 120,
maxRetries: 3,
headers: { "x-custom-header": "value" },
}
```
</CodeGroup>
| Option (Python) | Option (TypeScript) | Type | Description |
|-----------------|---------------------|------|-------------|
| `timeout_in_seconds` | `timeoutInSeconds` | `int` / `number` | HTTP timeout in seconds. |
| `max_retries` | `maxRetries` | `int` / `number` | Retry count. |
| `additional_headers` | `headers` | `dict` / `Record<string, string>` | Extra headers. |
| `additional_query_parameters` | - | `dict` | Extra query parameters. |
| `additional_body_parameters` | - | `dict` | Extra body parameters. |
| - | `abortSignal` | `AbortSignal` | Signal to cancel the request. |
| - | `apiKey` | `string` | Override API key. |
---