Skip to main content

Temporal CLI activity command reference

This page provides a reference for the temporal CLI activity command. The flags applicable to each subcommand are presented in a table within the heading for the subcommand. Refer to Global Flags for flags that you can use with every subcommand.

cancel

Request cancellation of a Standalone Activity.

temporal activity cancel \
--activity-id YourActivityId

Requesting cancellation transitions the Activity's run state to CancelRequested. If the Activity is heartbeating, a cancellation error will be raised when the next heartbeat response is received; if the Activity allows this error to propagate, the Activity transitions to canceled status.

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--reasonNostring Reason for cancellation.
--run-id, -rNostring Activity Run ID. If not set, targets the latest run.

complete

Complete an Activity, marking it as successfully finished. Specify the Activity ID and include a JSON result for the returned value:

temporal activity complete \
--activity-id YourActivityId \
--workflow-id YourWorkflowId \
--result '{"YourResultKey": "YourResultVal"}'

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID. This may be the ID of an Activity invoked by a Workflow, or of a Standalone Activity.
--resultYesstring Result JSON to return.
--run-id, -rNostring Run ID. For workflow Activities (when --workflow-id is provided), this is the Workflow Run ID. For Standalone Activities, this is the Activity Run ID.
--workflow-id, -wNostring Workflow ID. Required for workflow Activities. Omit for Standalone Activities.

count

Return a count of Standalone Activities. Use --query to filter the activities to be counted.

temporal activity count \
--query 'ActivityType="YourActivity"'

Visit https://docs.temporal.io/visibility to read more about Search Attributes and queries.

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--query, -qNostring Query to filter Activity Executions to count.

describe

Display information about a Standalone Activity.

temporal activity describe \
--activity-id YourActivityId

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--rawNobool Print properties without changing their format.
--run-id, -rNostring Activity Run ID. If not set, targets the latest run.

execute

Start a new Standalone Activity and block until it completes. The result is output to stdout.

temporal activity execute \
--activity-id YourActivityId \
--type YourActivity \
--task-queue YourTaskQueue \
--start-to-close-timeout 30s \
--input '{"some-key": "some-value"}'

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--fairness-keyNostring Fairness key (max 64 bytes) for proportional task dispatch.
--fairness-weightNofloat Weight [0.001-1000] for this fairness key.
--headersNostring[] Temporal activity headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times.
--heartbeat-timeoutNoduration Maximum time between successful Worker heartbeats. On expiry the current activity attempt fails.
--id-conflict-policyNostring-enum Policy for handling activity start when an Activity with the same ID is currently running. Accepted values: Fail, UseExisting.
--id-reuse-policyNostring-enum Policy for handling activity start when an Activity with the same ID exists and has completed. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate.
--input, -iNostring[] Input value. Use JSON content or set --input-meta to override. Can't be combined with --input-file. Can be passed multiple times to pass multiple arguments.
--input-base64Nobool Assume inputs are base64-encoded and attempt to decode them.
--input-fileNostring[] A path or paths for input file(s). Use JSON content or set --input-meta to override. Can't be combined with --input. Can be passed multiple times to pass multiple arguments.
--input-metaNostring[] Input payload metadata as a KEY=VALUE pair. When the KEY is "encoding", this overrides the default ("json/plain"). Can be passed multiple times. Repeated metadata keys are applied to the corresponding inputs in the provided order.
--priority-keyNoint Priority key (1-5, lower = higher priority). Default is 3 when not specified.
--retry-backoff-coefficientNofloat Coefficient for calculating the next retry interval. Must be 1 or larger.
--retry-initial-intervalNoduration Interval of the first retry. If "retry-backoff-coefficient" is 1.0, it is used for all retries.
--retry-maximum-attemptsNoint Maximum number of attempts. Setting to 1 disables retries. Setting to 0 means unlimited attempts.
--retry-maximum-intervalNoduration Maximum interval between retries.
--schedule-to-close-timeoutNoduration Maximum time for the Activity Execution, including all retries. Either this or "start-to-close-timeout" is required.
--schedule-to-start-timeoutNoduration Maximum time an Activity task can stay in a task queue before a Worker picks it up. On expiry it results in a non-retryable failure and no further attempts are scheduled.
--search-attributeNostring[] Search Attribute in KEY=VALUE format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times. See https://docs.temporal.io/visibility.
--start-to-close-timeoutNoduration Maximum time for a single Activity attempt. On expiry a new attempt may be scheduled if permitted by the retry policy and schedule-to-close timeout. Either this or "schedule-to-close-timeout" is required.
--static-detailsNostring Static Activity details for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. (Experimental)
--static-summaryNostring Static Activity summary for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. (Experimental)
--task-queue, -tYesstring Activity task queue.
--typeYesstring Activity Type name.

fail

Fail an Activity, marking it as having encountered an error:

temporal activity fail \
--activity-id YourActivityId \
--workflow-id YourWorkflowId

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID. This may be the ID of an Activity invoked by a Workflow, or of a Standalone Activity.
--detailNostring Failure detail (JSON). Attached as the failure details payload.
--reasonNostring Failure reason. Attached as the failure message.
--run-id, -rNostring Run ID. For workflow Activities (when --workflow-id is provided), this is the Workflow Run ID. For Standalone Activities, this is the Activity Run ID.
--workflow-id, -wNostring Workflow ID. Required for workflow Activities. Omit for Standalone Activities.

list

List Standalone Activities. Use --query to filter results.

temporal activity list \
--query 'ActivityType="YourActivity"'

Visit https://docs.temporal.io/visibility to read more about Search Attributes and queries.

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--limitNoint Maximum number of Activity Executions to display.
--page-sizeNoint Maximum number of Activity Executions to fetch at a time from the server.
--query, -qNostring Query to filter the Activity Executions to list.

pause

Pause an Activity. Not supported for Standalone Activities.

If the Activity is not currently running (e.g. because it previously failed), it will not be run again until it is unpaused.

However, if the Activity is currently running, it will run until the next time it fails, completes, or times out, at which point the pause will kick in.

If the Activity is on its last retry attempt and fails, the failure will be returned to the caller, just as if the Activity had not been paused.

Activities should be specified either by their Activity ID or Activity Type.

For example, specify the Activity and Workflow IDs like this:

temporal activity pause \
--activity-id YourActivityId \
--workflow-id YourWorkflowId

To later unpause the activity, see unpause. You may also want to reset the activity to unpause it while also starting it from the beginning.

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aNostring The Activity ID to pause. Either activity-id or activity-type must be provided, but not both.
--activity-typeNostring All activities of the Activity Type will be paused. Either activity-id or activity-type must be provided, but not both. Note: Pausing Activity by Type is an experimental feature and may change in the future.
--identityNostring The identity of the user or client submitting this request.
--run-id, -rNostring Run ID.
--workflow-id, -wYesstring Workflow ID.

reset

Reset an activity. Not supported for Standalone Activities. This restarts the activity as if it were first being scheduled. That is, it will reset both the number of attempts and the activity timeout, as well as, optionally, the heartbeat details.

If the activity may be executing (i.e. it has not yet timed out), the reset will take effect the next time it fails, heartbeats, or times out. If is waiting for a retry (i.e. has failed or timed out), the reset will apply immediately.

If the activity is already paused, it will be unpaused by default. You can specify keep_paused to prevent this.

If the activity is paused and the keep_paused flag is not provided, it will be unpaused. If the activity is paused and keep_paused flag is provided - it will stay paused.

Activities can be specified by their Activity ID or Activity Type.

Resetting activities that heartbeat

Activities that heartbeat will receive a Canceled failure the next time they heartbeat after a reset.

If, in your Activity, you need to do any cleanup when an Activity is reset, handle this error and then re-throw it when you've cleaned up.

If the reset_heartbeats flag is set, the heartbeat details will also be cleared.

Specify the Activity Type of ID and Workflow IDs:

temporal activity reset \
--activity-id YourActivityId \
--workflow-id YourWorkflowId
--keep-paused
--reset-heartbeats

Either activity-id, activity-type, or --match-all must be specified.

Activities can be reset in bulk with a visibility query list filter. For example, if you want to reset activities of type Foo:

temporal activity reset \
--query 'TemporalResetInfo="property:activityType=Foo"'

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aNostring The Activity ID to reset. Mutually exclusive with --query, --match-all, and --activity-type. Requires --workflow-id to be specified.
--activity-typeNostring Activities of this Type will be reset. Mutually exclusive with --match-all and activity-id.
--headersNostring[] Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. Note: These are workflow headers, not gRPC headers.
--jitterNoduration The activity will reset at random a time within the specified duration. Can only be used with --query.
--keep-pausedNobool If the activity was paused, it will stay paused.
--match-allNobool Every activity should be reset. Every activity should be updated. Mutually exclusive with --activity-id and --activity-type.
--query, -qNostring Content for an SQL-like QUERY List Filter. You must set either --workflow-id or --query.
--reasonNostring Reason for batch operation. Only use with --query. Defaults to user name.
--reset-attemptsNobool Reset the activity attempts.
--reset-heartbeatsNobool Reset the Activity's heartbeats. Only works with --reset-attempts.
--restore-original-optionsNobool Restore the original options of the activity.
--rpsNofloat Limit batch's requests per second. Only allowed if query is present.
--run-id, -rNostring Run ID. Only use with --workflow-id. Cannot use with --query.
--workflow-id, -wNostring Workflow ID. You must set either --workflow-id or --query.
--yes, -yNobool Don't prompt to confirm signaling. Only allowed when --query is present.

result

Wait for a Standalone Activity to complete and output the result.

temporal activity result \
--activity-id YourActivityId

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--run-id, -rNostring Activity Run ID. If not set, targets the latest run.

start

Start a new Standalone Activity. Outputs the Activity ID and Run ID.

temporal activity start \
--activity-id YourActivityId \
--type YourActivity \
--task-queue YourTaskQueue \
--start-to-close-timeout 5m \
--input '{"some-key": "some-value"}'

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--fairness-keyNostring Fairness key (max 64 bytes) for proportional task dispatch.
--fairness-weightNofloat Weight [0.001-1000] for this fairness key.
--headersNostring[] Temporal activity headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times.
--heartbeat-timeoutNoduration Maximum time between successful Worker heartbeats. On expiry the current activity attempt fails.
--id-conflict-policyNostring-enum Policy for handling activity start when an Activity with the same ID is currently running. Accepted values: Fail, UseExisting.
--id-reuse-policyNostring-enum Policy for handling activity start when an Activity with the same ID exists and has completed. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate.
--input, -iNostring[] Input value. Use JSON content or set --input-meta to override. Can't be combined with --input-file. Can be passed multiple times to pass multiple arguments.
--input-base64Nobool Assume inputs are base64-encoded and attempt to decode them.
--input-fileNostring[] A path or paths for input file(s). Use JSON content or set --input-meta to override. Can't be combined with --input. Can be passed multiple times to pass multiple arguments.
--input-metaNostring[] Input payload metadata as a KEY=VALUE pair. When the KEY is "encoding", this overrides the default ("json/plain"). Can be passed multiple times. Repeated metadata keys are applied to the corresponding inputs in the provided order.
--priority-keyNoint Priority key (1-5, lower = higher priority). Default is 3 when not specified.
--retry-backoff-coefficientNofloat Coefficient for calculating the next retry interval. Must be 1 or larger.
--retry-initial-intervalNoduration Interval of the first retry. If "retry-backoff-coefficient" is 1.0, it is used for all retries.
--retry-maximum-attemptsNoint Maximum number of attempts. Setting to 1 disables retries. Setting to 0 means unlimited attempts.
--retry-maximum-intervalNoduration Maximum interval between retries.
--schedule-to-close-timeoutNoduration Maximum time for the Activity Execution, including all retries. Either this or "start-to-close-timeout" is required.
--schedule-to-start-timeoutNoduration Maximum time an Activity task can stay in a task queue before a Worker picks it up. On expiry it results in a non-retryable failure and no further attempts are scheduled.
--search-attributeNostring[] Search Attribute in KEY=VALUE format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times. See https://docs.temporal.io/visibility.
--start-to-close-timeoutNoduration Maximum time for a single Activity attempt. On expiry a new attempt may be scheduled if permitted by the retry policy and schedule-to-close timeout. Either this or "schedule-to-close-timeout" is required.
--static-detailsNostring Static Activity details for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. (Experimental)
--static-summaryNostring Static Activity summary for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. (Experimental)
--task-queue, -tYesstring Activity task queue.
--typeYesstring Activity Type name.

terminate

Terminate a Standalone Activity.

temporal activity terminate \
--activity-id YourActivityId \
--reason YourReason

Activity code cannot see or respond to terminations.

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aYesstring Activity ID.
--reasonNostring Reason for termination. Defaults to a message with the current user's name.
--run-id, -rNostring Activity Run ID. If not set, targets the latest run.

unpause

Re-schedule a previously-paused Activity for execution. Not supported for Standalone Activities.

If the Activity is not running and is past its retry timeout, it will be scheduled immediately. Otherwise, it will be scheduled after its retry timeout expires.

Use --reset-attempts to reset the number of previous run attempts to zero. For example, if an Activity is near the maximum number of attempts N specified in its retry policy, --reset-attempts will allow the Activity to be retried another N times after unpausing.

Use --reset-heartbeat to reset the Activity's heartbeats.

Activities can be specified by their Activity ID or Activity Type. One of those parameters must be provided.

Specify the Activity ID or Type and Workflow IDs:

temporal activity unpause \
--activity-id YourActivityId \
--workflow-id YourWorkflowId
--reset-attempts
--reset-heartbeats

Activities can be unpaused in bulk via a visibility Query list filter. For example, if you want to unpause activities of type Foo that you previously paused, do:

temporal activity unpause \
--query 'TemporalPauseInfo="property:activityType=Foo"'

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aNostring The Activity ID to unpause. Mutually exclusive with --query, --match-all, and --activity-type. Requires --workflow-id to be specified.
--activity-typeNostring Activities of this Type will unpause. Can only be used without --match-all. Either activity-id or activity-type must be provided, but not both.
--headersNostring[] Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. Note: These are workflow headers, not gRPC headers.
--jitterNoduration The activity will start at random a time within the specified duration. Can only be used with --query.
--match-allNobool Every paused activity should be unpaused. This flag is ignored if activity-type is provided.
--query, -qNostring Content for an SQL-like QUERY List Filter. You must set either --workflow-id or --query.
--reasonNostring Reason for batch operation. Only use with --query. Defaults to user name.
--reset-attemptsNobool Reset the activity attempts.
--reset-heartbeatsNobool Reset the Activity's heartbeats. Only works with --reset-attempts.
--rpsNofloat Limit batch's requests per second. Only allowed if query is present.
--run-id, -rNostring Run ID. Only use with --workflow-id. Cannot use with --query.
--workflow-id, -wNostring Workflow ID. You must set either --workflow-id or --query.
--yes, -yNobool Don't prompt to confirm signaling. Only allowed when --query is present.

update-options

Update the options of a running Activity that were passed into it from a Workflow. Updates are incremental, only changing the specified options. Not supported for Standalone Activities.

For example:

temporal activity update-options \
--activity-id YourActivityId \
--workflow-id YourWorkflowId \
--task-queue NewTaskQueueName \
--schedule-to-close-timeout DURATION \
--schedule-to-start-timeout DURATION \
--start-to-close-timeout DURATION \
--heartbeat-timeout DURATION \
--retry-initial-interval DURATION \
--retry-maximum-interval DURATION \
--retry-backoff-coefficient NewBackoffCoefficient \
--retry-maximum-attempts NewMaximumAttempts

You may follow this command with temporal activity reset, and the new values will apply after the reset.

Either activity-id, activity-type, or --match-all must be specified.

Activity options can be updated in bulk with a visibility query list filter. For example, if you want to reset for activities of type Foo, do:

temporal activity update-options \
--query 'TemporalPauseInfo="property:activityType=Foo"'
...

Use the following options to change the behavior of this command. You can also use any of the global flags that apply to all subcommands.

FlagRequiredDescription
--activity-id, -aNostring The Activity ID to update options. Mutually exclusive with --query, --match-all, and --activity-type. Requires --workflow-id to be specified.
--activity-typeNostring Activities of this Type will be updated. Mutually exclusive with --match-all and activity-id.
--headersNostring[] Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. Note: These are workflow headers, not gRPC headers.
--heartbeat-timeoutNoduration Maximum permitted time between successful worker heartbeats.
--match-allNobool Every activity should be updated. Mutually exclusive with --activity-id and --activity-type.
--query, -qNostring Content for an SQL-like QUERY List Filter. You must set either --workflow-id or --query.
--reasonNostring Reason for batch operation. Only use with --query. Defaults to user name.
--restore-original-optionsNobool Restore the original options of the activity.
--retry-backoff-coefficientNofloat Coefficient used to calculate the next retry interval. The next retry interval is previous interval multiplied by the backoff coefficient. Must be 1 or larger.
--retry-initial-intervalNoduration Interval of the first retry. If retryBackoffCoefficient is 1.0 then it is used for all retries.
--retry-maximum-attemptsNoint Maximum number of attempts. When exceeded the retries stop even if not expired yet. Setting this value to 1 disables retries. Setting this value to 0 means unlimited attempts(up to the timeouts).
--retry-maximum-intervalNoduration Maximum interval between retries. Exponential backoff leads to interval increase. This value is the cap of the increase.
--rpsNofloat Limit batch's requests per second. Only allowed if query is present.
--run-id, -rNostring Run ID. Only use with --workflow-id. Cannot use with --query.
--schedule-to-close-timeoutNoduration Indicates how long the caller is willing to wait for an activity completion. Limits how long retries will be attempted.
--schedule-to-start-timeoutNoduration Limits time an activity task can stay in a task queue before a worker picks it up. This timeout is always non retryable, as all a retry would achieve is to put it back into the same queue. Defaults to the schedule-to-close timeout or workflow execution timeout if not specified.
--start-to-close-timeoutNoduration Maximum time an activity is allowed to execute after being picked up by a worker. This timeout is always retryable.
--task-queueNostring Name of the task queue for the Activity.
--workflow-id, -wNostring Workflow ID. You must set either --workflow-id or --query.
--yes, -yNobool Don't prompt to confirm signaling. Only allowed when --query is present.

Global Flags

The following options can be used with any command.

FlagRequiredDescriptionDefault
--addressNostring Temporal Service gRPC endpoint.localhost:7233
--api-keyNostring API key for request.
--client-authorityNostring Temporal gRPC client :authority pseudoheader.
--client-connect-timeoutNoduration The client connection timeout. 0s means no timeout.
--codec-authNostring Authorization header for Codec Server requests.
--codec-endpointNostring Remote Codec Server endpoint.
--codec-headerNostring[] HTTP headers for requests to codec server. Format as a KEY=VALUE pair. May be passed multiple times to set multiple headers.
--colorNostring-enum Output coloring. Accepted values: always, never, auto.auto
--command-timeoutNoduration The command execution timeout. 0s means no timeout.
--config-fileNostring File path to read TOML config from, defaults to $CONFIG_PATH/temporalio/temporal.toml where $CONFIG_PATH is defined as $HOME/.config on Unix, $HOME/Library/Application Support on macOS, and %AppData% on Windows. (Experimental)
--disable-config-envNobool If set, disables loading environment config from environment variables. (Experimental)
--disable-config-fileNobool If set, disables loading environment config from config file. (Experimental)
--envNostring Active environment name (ENV).default
--env-fileNostring Path to environment settings file. Defaults to $HOME/.config/temporalio/temporal.yaml.
--grpc-metaNostring[] HTTP headers for requests. Format as a KEY=VALUE pair. May be passed multiple times to set multiple headers. Can also be made available via environment variable as TEMPORAL_GRPC_META_[name].
--identityNostring The identity of the user or client submitting this request. Defaults to "temporal-cli:USER@USER@HOST".
--log-formatNostring-enum Log format. Accepted values: text, json.text
--log-levelNostring-enum Log level. Default is "info" for most commands and "warn" for "server start-dev". Accepted values: debug, info, warn, error, never.info
--namespace, -nNostring Temporal Service Namespace.default
--no-json-shorthand-payloadsNobool Raw payload output, even if the JSON option was used.
--output, -oNostring-enum Non-logging data output format. Accepted values: text, json, jsonl, none.text
--profileNostring Profile to use for config file. (Experimental)
--time-formatNostring-enum Time format. Accepted values: relative, iso, raw.relative
--tlsNobool Enable base TLS encryption. Does not have additional options like mTLS or client certs. This is defaulted to true if api-key or any other TLS options are present. Use --tls=false to explicitly disable.
--tls-ca-dataNostring Data for server CA certificate. Can't be used with --tls-ca-path.
--tls-ca-pathNostring Path to server CA certificate. Can't be used with --tls-ca-data.
--tls-cert-dataNostring Data for x509 certificate. Can't be used with --tls-cert-path.
--tls-cert-pathNostring Path to x509 certificate. Can't be used with --tls-cert-data.
--tls-disable-host-verificationNobool Disable TLS host-name verification.
--tls-key-dataNostring Private certificate key data. Can't be used with --tls-key-path.
--tls-key-pathNostring Path to x509 private key. Can't be used with --tls-key-data.
--tls-server-nameNostring Override target TLS server name.