Skip to main content

Interface: ActivityOptions


Options for remote activity invocation - will be processed from a task queue.




Optional activityId: string

Identifier to use for tracking the activity in Workflow history. The activityId can be accessed by the activity function. Does not need to be unique.

default an incremental sequence number


Optional cancellationType: ActivityCancellationType

Determines what the SDK does when the Activity is cancelled.

  • TRY_CANCEL - Initiate a cancellation request and immediately report cancellation to the workflow.
  • WAIT_CANCELLATION_COMPLETED - Wait for activity cancellation completion. Note that activity must heartbeat to receive a cancellation notification. This can block the cancellation for a long time if activity doesn't heartbeat or chooses to ignore the cancellation request.
  • ABANDON - Do not request cancellation of the activity and immediately report cancellation to the workflow.


Optional heartbeatTimeout: string | number

Heartbeat interval. Activity must heartbeat before this interval passes after a last heartbeat or activity start.

format ms formatted string or number of milliseconds


Optional namespace: string

Namespace to schedule this activity in.

default current worker namespace


Optional retry: RetryOptions

RetryOptions that define how activity is retried in case of failure. If this is not set, then the server-defined default activity retry policy will be used. To ensure zero retries, set maximum attempts to 1.


Optional scheduleToCloseTimeout: string | number

Total time that a workflow is willing to wait for Activity to complete. scheduleToCloseTimeout limits the total time of an Activity's execution including retries (use startToCloseTimeout to limit the time of a single attempt).

Either this option or startToCloseTimeout is required

default unlimited

format ms formatted string or number of milliseconds


Optional scheduleToStartTimeout: string | number

Time that the Activity Task can stay in the Task Queue before it is picked up by a Worker. Do not specify this timeout unless using host specific Task Queues for Activity Tasks are being used for routing. scheduleToStartTimeout is always non-retryable. Retrying after this timeout doesn't make sense as it would just put the Activity Task back into the same Task Queue.

default unlimited

format ms formatted string or number of milliseconds


Optional startToCloseTimeout: string | number

Maximum time of a single Activity execution attempt. Note that the Temporal Server doesn't detect Worker process failures directly. It relies on this timeout to detect that an Activity that didn't complete on time. So this timeout should be as short as the longest possible execution of the Activity body. Potentially long running Activities must specify heartbeatTimeout and call activity.Context.heartbeat periodically for timely failure detection.

Either this option or scheduleToCloseTimeout is required.

format ms formatted string or number of milliseconds


Optional taskQueue: string

Task queue name.

default current worker task queue