Skip to main content

Standalone Activities Demo

Standalone Activities let you run a single Activity straight from your application without writing a Workflow. Your code uses the Temporal Client to send the request to the Server, the Server durably enqueues the request for a Worker to pick up, and the result comes back through a handle that your code can wait on or check later.

Try the demo below to walk through the full flow, tweak the retry and timeout settings, and watch the SDK code and CLI command update as you go.

Configure Activity

Failure Simulation

SDK Code

result = await client.execute_activity(
compose_greeting,
"World",
id="my-activity-id",
task_queue="my-task-queue",
start_to_close_timeout=timedelta(seconds=10),
)
# result: "Hello, World!"

CLI Command

temporal activity execute \
--type compose_greeting \
--activity-id my-activity-id \
--task-queue my-task-queue \
--start-to-close-timeout 10s \
--input '"World"'

Execution Flow

Client
Your App
Server
Temporal
Task Queue
Worker
Activity
Function

Activity Log

Click "Execute Activity" to run the simulation

How it works

When you call client.execute_activity() (or the equivalent in your applicable SDK) from your application, the following happens:

  1. Connect: Your application opens a connection to the Temporal Server using a Temporal Client configured with your namespace and credentials.
  2. Schedule: The Server durably persists the Activity Task on the specified Task Queue so that the request survives Worker restarts and network interruptions.
  3. Poll: A Worker that is polling that Task Queue picks up the Activity Task and prepares to execute it.
  4. Execute: The Worker runs your Activity function with the provided arguments and reports the outcome back to the Server.
  5. Return: The Server stores the result and returns it to the original caller, either directly or via a handle, depending on which SDK method you use.

Standalone vs Workflow Activities

Workflow ActivityStandalone Activity
Orchestrated byA Workflow DefinitionYour application code (via the Temporal Client)
Started withworkflow.execute_activity() (or the equivalent in your applicable SDK) from inside a Workflow Definitionclient.execute_activity() (or the equivalent in your applicable SDK) from your application code
Retry policySet when calling the Activity from inside a WorkflowSet when calling the Activity from your application
VisibilityShown in the Workflow's Event HistoryShown in the Standalone Activity list and count views
Use caseMulti-step orchestration with multiple ActivitiesSingle, independent jobs like sending an email or processing a webhook

The Activity function and Worker registration are identical for both approaches, and only the execution path that triggers the Activity differs between them. If the Activity fails, the Server automatically retries it according to the Retry Policy you configure.


Next steps

For complete API reference and advanced usage, see the SDK-specific guides: