Skip to content

💥 Standalone activity support - #1307

Merged
cretz merged 18 commits into
mainfrom
standalone-activity
Feb 10, 2026
Merged

💥 Standalone activity support#1307
cretz merged 18 commits into
mainfrom
standalone-activity

Conversation

@cretz

@cretzcretz commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

What was changed

General list of things changed for standalone activity support:

  • Added client.start_activity() (and overloads)
  • Added client.execute_activity() (and overloads)
  • Add overload to client.get_async_activity_handle() with activity_id kwarg
  • Added client.list_activities() and associated iterator and models
  • Added client.count_activities() and associated models
  • Added client.get_activity_handle() and associated handle with common activity options
  • Added interceptors for many activity calls
  • Added client.ActivityFailureError
  • Added common enumerates ActivityIDReusePolicy and ActivityIDConflictPolicy
  • activity.Info modified to make workflow_id, workflow_namespace, workflow_run_id, and workflow_type optional
    • 💥 SLIGHT BREAKING CHANGE for those manually expecting non-None fields or manually creating the info for tests
  • converter.BaseWorkflowSerializationContext intermediate base class removed
    • 💥 SLIGHT BREAKING CHANGE for those that may have counted on this newly created class, though most should use specific types
  • Updated converter.ActivitySerializationContext to make workflow_id and workflow_type optional, updated activity_type and activity_task_queue to be optional and deprecated, and added optional activity_id
    • 💥 SLIGHT BREAKING CHANGE for those that may have expected these to always be present during serialization, though they'll continue to be present unless you use standalone activities

This is basically a re-submitted PR of the original form at #1138 but with some slight alterations. Reviewers should set the "Hide Whitespace" option to review this more clearly.

Checklist

  1. Closes[Feature Request] Support standalone activities #1230

dandavisonand others added 10 commits January 6, 2026 18:36
Implement list/count activities
alphabetical order
ActivityHandle.result
Implement start_activity
Update sdk-core
Server isn't returning RunID yet
Add activity IDs to test since they are now set in context
Eliminate base serialization context class
Extend tests
Don't hardcode workflow IDs
Fix AsyncActivityHandle
TEMP: Alter manual activity tests to not require worker
Skip tests globally
Revert "TEMP: Alter manual activity tests to not require worker"
This reverts commit 7127c0f.
Assert describe returns new state after transition
Fix cancellation and failure tests
Cleanup
Add experimental notices
Workaround mypy bug
Skip Standalone Activity tests in CI
Only support TypedSearchAttributes
This commit updates the Python SDK standalone activity implementation to match
Maciej's cross-language design specification.
- ActivityIdReusePolicy → ActivityIDReusePolicy
- ActivityIdConflictPolicy → ActivityIDConflictPolicy
- Renamed property 'id' → 'activity_id'
- Renamed property 'run_id' → 'activity_run_id'
- Updated internal _id and _run_id variables accordingly
- Renamed 'run_id' → 'activity_run_id'
- Renamed 'schedule_time' → 'scheduled_time'
- Added 'namespace' field (copied from calling client)
- Removed 'state_transition_count' field
- Removed the separate class; all list results now return ActivityExecution
- Renamed 'run_id' → 'activity_run_id'
- Renamed 'schedule_time' → 'scheduled_time'
- Added 'namespace', 'close_time', 'execution_duration' fields
- Removed 'state_transition_count' field
- Added ActivityExecutionCountAggregationGroup class
- Added 'groups' field for aggregation support
- Renamed 'ret_type' → 'result_type'
- Renamed 'static_summary' → 'summary'
- Renamed 'static_details' → 'details'
- CancelActivityInput.run_id → activity_run_id
- TerminateActivityInput.run_id → activity_run_id
- DescribeActivityInput.run_id → activity_run_id
- Added 'wait_for_cancel_completed: bool' field
- Renamed parameter 'run_id' → 'activity_run_id'
- Added 'namespace: str' field
- Added 'activity_run_id: str | None' field (None for workflow activities)
- Added 'in_workflow' property
- Made workflow_id, workflow_namespace, workflow_run_id, workflow_type optional
(None for standalone activities)
- Deprecated 'workflow_namespace' in favor of 'namespace'
- Updated tests/test_activity.py and tests/worker/test_activity.py
- Fixed temporalio/contrib/opentelemetry.py
- Fixed temporalio/contrib/openai_agents/_mcp.py
- GetActivityResultInput and interceptor method - would require significant
refactoring of the result caching mechanism in ActivityHandle
…tivity
# Conflicts:
#	temporalio/api/activity/v1/message_pb2.py
#	temporalio/api/activity/v1/message_pb2.pyi
#	temporalio/api/workflowservice/v1/__init__.py
#	temporalio/api/workflowservice/v1/request_response_pb2.py
#	temporalio/api/workflowservice/v1/request_response_pb2.pyi
#	temporalio/api/workflowservice/v1/service_pb2.py
#	temporalio/api/workflowservice/v1/service_pb2_grpc.py
#	temporalio/api/workflowservice/v1/service_pb2_grpc.pyi
#	temporalio/bridge/sdk-core
#	temporalio/bridge/services_generated.py
#	temporalio/bridge/src/client_rpc_generated.rs
Comment threadtests/conftest.py Outdated
str(http_port),
],
dev_server_download_version=DEV_SERVER_DOWNLOAD_VERSION,
dev_server_existing_path="../next-server-cli/cli/temporal.exe",

@cretzcretzJan 28, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Waiting for next CLI release to get a version of dev server that supports standalone activities. Until then, CI will not pass.

@cretz
cretz marked this pull request as ready for review January 28, 2026 16:02
@cretz
cretz requested a review from a team as a code ownerJanuary 28, 2026 16:02
@cretzcretz changed the title Standalone activity support💥 Standalone activity supportJan 28, 2026
Comment threadtemporalio/client.py
@@ -1266,1436 +1273,3180 @@ async def count_workflows(
)
)

# async no-param

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.

Oh boy git diff has done such a bad job here.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah not great, though the PR does read a bit better if you "hide whitespace"

Comment threadtests/test_activity.py Outdated
Comment threadtemporalio/activity.py
@tconley1428

Copy link
Copy Markdown
Contributor

Looks okay to me. Will wait for cli release to fix CI for approval.

@cretzcretzFeb 9, 2026

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

The change in this commit/file is due to server-side change where operation no longer guaranteed to start for really short schedule to close timeout (we test interruption behavior elsewhere, this can just test the timeout error looks proper)

@cretz
cretzforce-pushed the standalone-activity branch from 7054a1f to f4fef5eCompareFebruary 10, 2026 13:03

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

All tests in this file have been skipped during the time-skipping run until temporalio/sdk-java#2741 is handled.

@cretz
cretz merged commit bd63236 into mainFeb 10, 2026
15 checks passed
@cretz
cretz deleted the standalone-activity branch February 10, 2026 16:24
Sign up for freeto 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.

[Feature Request] Support standalone activities

3 participants

@cretz@tconley1428@dandavison