This sample demonstrates how to use a Standalone Activity (executing an Activity without wrapping it in a Workflow).
It also shows you how to use the ListActivities and CountActivities APIs.
Note: Standalone activities are supported in CLI version v1.7.0.
- Run a Temporal server. (If you are going to run locally, you will want to start it in another terminal; this command is blocking and runs until it receives a SIGINT (Ctrl + C) command.)
If you used the above instructions to start the server, you should see a line about the CLI, Server and UI versions, and one line each for the Server URL, UI URL and Metrics endpoint. It should look something like this:
> temporal server start-dev
Temporal CLI 1.7.0 (Server 1.31.0, UI 2.49.1)
Server: localhost:7233
UI: http://localhost:8233
Metrics: http://localhost:57058/metrics- Open a second terminal, and run the following command to start the worker. The worker is a blocking process that runs until it receives a SIGINT (Ctrl + C) command.
go run standalone-activity/helloworld/worker/main.goYou should see two console log lines:
- Creating the logger
- Starting the Worker with Namespace
default, and TaskQueuestandalone-activity-helloworldand it will list the WorkerID for the created worker.
For example:
2025/12/22 15:00:15 INFO No logger configured for temporal client. Created default one.
2025/12/22 15:00:16 INFO Started Worker Namespace default TaskQueue standalone-activity-helloworld WorkerID 82087Note
Timestamps and IDs will differ on your machine.
- In a third terminal, run the following command to start the example
go run standalone-activity/helloworld/starter/main.goYou should see something similar to the following output.
For example:
2026/02/23 14:12:00 INFO No logger configured for temporal client. Created default one.
2026/02/23 14:12:00 Started standalone activity ActivityID standalone_activity_helloworld_ActivityID RunID 019c8c8f-324f-7c06-a92e-a9f7e612ce69
2026/02/23 14:12:00 Activity result: Hello Temporal!
2026/02/23 14:12:00 ListActivity results
2026/02/23 14:12:00 ActivityID: standalone_activity_helloworld_ActivityID, Type: Activity, Status: Completed
2026/02/23 14:12:00 CountActivities: 1If you run the starter code multiple times, you should see additional ListActivity results, as more activities are run.
The same goes for the number of activities from CountActivities.