Skip to content

Add Standalone Activities Interactive Demo page [experimentation]#4331

Open
jsundai wants to merge 4 commits into
mainfrom
feat/standalone-activities-interactive-demo
Open

Add Standalone Activities Interactive Demo page [experimentation]#4331
jsundai wants to merge 4 commits into
mainfrom
feat/standalone-activities-interactive-demo

Conversation

@jsundai
Copy link
Copy Markdown
Contributor

@jsundai jsundai commented Mar 24, 2026

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment May 28, 2026 1:55pm

Request Review

@jsundai jsundai changed the title Add Standalone Activities Interactive Demo page Add Standalone Activities Interactive Demo page [experimentation] Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 24, 2026

📖 Docs PR preview links

@jsundai jsundai marked this pull request as ready for review May 28, 2026 12:50
@jsundai jsundai requested a review from a team as a code owner May 28, 2026 12:50
:::

Standalone Activities let you run a single Activity straight from your application without
writing a Workflow. Your code calls the Temporal Client, the Server durably enqueues the request
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
writing a Workflow. Your code calls the Temporal Client, the Server durably enqueues the request
writing a Workflow. Your code uses the Temporal Client to send the request to the Server, the Server durably enqueues the request

`ActivityHandle` that was created when the Activity was scheduled.

Because the Server durably persists the Activity, it survives Worker restarts and network
interruptions. If the Activity fails, the Server automatically retries it according to the Retry
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"it survives Worker restarts and network interruptions"

I feel like we use similar language for Workflows. Is it worth adding something like (I'm not saying this is the right phrasing)

However, unlike a Workflow, an Activity is by default re-executed from the beginning on each attempt, so you should typically do one operation with side effects in an Activity. If you need to do two different operations (both with side effects), you should typically use a Workflow with two Activities.

? config.failCount > config.maxRetries
? `All ${config.maxRetries + 1} attempt(s) will fail because failCount exceeds maxRetries.`
: `Activity will fail ${config.failCount} time(s), then succeed on attempt ${config.failCount + 1}.`
: null;
Copy link
Copy Markdown
Contributor

@dandavison dandavison Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to style this as an error because it's saying that the user input doesn't make sense.

Image

update(['completed', 'completed', 'pending', 'pending', 'pending'], null);

// ── Retry loop ───────────────────────────────────────────────────────
while (true) {
Copy link
Copy Markdown
Contributor

@dandavison dandavison Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does setting StartToClose timeout actually do anything? Here it succeeds even though StartToClose was zero.

Related, I thint here should be a way to set the duration that each attempt takes, so that user scan understand that a StartToClose timeout failure occurs when the duration of an individual attempt exceeds the specified timeout.

And related, shall we add ScheduleToStart timeout also, so that users can understand that it occurs when something spends too long in the queue (typically due to insufficient worker resources).

Image


## How it works

When you call `client.ExecuteActivity()` (or the equivalent in your SDK), the following happens:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code written there looks like Go SDK code. Unfortunately, the Go SDK is different from all other SDKs: "ExecuteFoo" in Go means what "StartFoo" means in other SDKs. So, ExecuteActivity() in Go does not poll. A simple fix would be to use Python code: client.execute_activity().

To see what I mean, see the Go code from the docs here:

	handle, err := c.ExecuteActivity(context.Background(), activityOptions, helloworld.Activity, "Temporal") // Just sends it to the server
    ...
	err = handle.Get(context.Background(), &result) // this does the polling for result in Go!

| Orchestrated by | A Workflow Definition | Your application code (via the Temporal Client) |
| Started with | SDK-specific (for example, `workflow.ExecuteActivity()` in Go) | SDK-specific (for example, `client.ExecuteActivity()` in Go, `client.StartActivityAsync()` in .NET) |
| Retry policy | Set in `ActivityOptions` inside your Workflow | Set in `StartActivityOptions` when calling the client |
| Visibility | Shown in the Workflow's Event History | Shown in the Activity list and count views |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is referring to what they see in the UI then

Suggested change
| Visibility | Shown in the Workflow's Event History | Shown in the Activity list and count views |
| Visibility | Shown in the Workflow's Event History | Shown in the Standalone Activity list and count views |

activityType = 'ComposeGreeting';
inputFlag = `--input '{"Greeting": "${GREETING}", "Name": "${name}"}'`;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's bothering me a bit that in one place the input is a class instance containing two fields, and in the CLI the user sees the JSON representation of that, but in the input form field in the simulation then just enter the "name" bit, and in the log it suggests that the activity only takes one argument. Maybe the whole thing would be simpler if it just has a single string argument and we don't try to teach them about using classes/structs as input in this demo?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants