Jobs
Choose your language:
Long-running operations return a job. Use client.jobs to inspect or wait for those operations.
client.jobs.get(jobId)
Read a public async job by id or task id.
| SDK | client.jobs.get(job_id) |
|---|---|
| Returns | JobRef |
Parameters:
| Location | Parameter | Type | Required | Description |
|---|---|---|---|---|
| Path | job_id | string | Required | Job id or task id returned by an async operation. |
Return fields:
| Field | Type | Description |
|---|---|---|
id | string | Job id. |
type | string | Job type, for example test_plan_generation, evaluation or agent_run. |
status | string | Current job status. |
resource | object | Related ids such as system_id, evaluation_id, agent_id or run_id. |
task_id | string | Background task id when available. |
result | any | Job result when available. |
error | string | Error message when available. |
client.jobs.wait(jobId, options)
SDK helper that polls client.jobs.get(...) until the job reaches a terminal state.
| SDK | client.jobs.wait(job_id, timeout_ms=..., interval_ms=..., on_poll=None) |
|---|---|
| Returns | job.result when present, otherwise JobRef |
Parameters:
| Location | Parameter | Type | Required | Default | Description |
|---|---|---|---|---|---|
| SDK | job_id | string | Required | — | Job id or task id. |
| SDK | timeout_ms | integer | Optional | 900000 | Maximum wait time in milliseconds. |
| SDK | interval_ms | integer | Optional | 5000 | Poll interval in milliseconds. |
| SDK | on_poll | callable | Optional | — | Callback called with each job payload. |
Raises PollTimeoutError on timeout and JobFailedError if the terminal job status is failed, canceled or timed out.
Was this page helpful?