Skip to main content
The run object is the main object returned by Realtime subscriptions (e.g., runs.subscribeToRun()). It contains all the information about the run, including the run ID, task identifier, payload, output, and more. Type-safety is supported for the run object, so you can infer the types of the run’s payload and output. See type-safety for more information.

The run object

Properties

string
required
The run ID.
string
required
The task identifier.
object
required
The input payload for the run.
object
The output result of the run.
Date
required
Timestamp when the run was created.
Date
required
Timestamp when the run was last updated.
RunStatus
required
Current status of the run.
number
required
Duration of the run in milliseconds.
number
required
Total cost of the run in cents.
number
required
Base cost of the run in cents before any additional charges.
string[]
required
Array of tags associated with the run.
string
Key used to ensure idempotent execution.
Date
Timestamp when the run expired.
Date
Timestamp when the run finished.
Date
Timestamp when the run started.
Date
Timestamp until which the run is delayed.
Date
Timestamp when the run was queued.
Record<string, DeserializedJson>
Additional metadata associated with the run.
SerializedError
Error information if the run failed.
boolean
required
Indicates whether this is a test run.
string[]
required
Names of the Realtime streams on the run.
boolean
required
true if the run is queued, delayed or waiting for a version update.
boolean
required
true if the run is dequeued or executing.
boolean
required
true if the run is waiting.
boolean
required
true if the run has finished, either successfully or with any failure status.
boolean
required
true if the run failed, crashed, hit a system failure, expired or timed out.
boolean
required
true if the run completed successfully.
boolean
required
true if the run was canceled.

Type-safety

You can infer the types of the run’s payload and output by passing the type of the task to the subscribeToRun function. This will give you type-safe access to the run’s payload and output.
When using subscribeToRunsWithTag, you can pass a union of task types for all the possible tasks that can have the tag.
This works with all realtime subscription functions:
  • runs.subscribeToRun<TaskType>()
  • runs.subscribeToRunsWithTag<TaskType>()
  • runs.subscribeToBatch<TaskType>()