feat(temporal): expose extra_workflows in create_worker [BLDX-1281]#1784
feat(temporal): expose extra_workflows in create_worker [BLDX-1281]#1784BichitraCodesAtlan wants to merge 1 commit into
Conversation
Allow callers to register hand-rolled @workflow.defn classes alongside the SDK-generated App workflows. Use case: an LLM agent harness's generic single-activity dispatcher whose dynamic-activity-by-name shape doesn't fit the App entry-point pattern but still needs to run on the same worker. Tested via three new unit tests in tests/unit/execution/test_worker.py covering: appended-to-registration, None default, empty-sequence noop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📜 Docstring Coverage ReportRESULT: PASSED (minimum: 30.0%, actual: 77.9%) Detailed Coverage Report |
📦 Trivy Vulnerability Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtuv.lock |
📦 Trivy Secret Scan Results
Report SummaryCould not generate summary table (data length mismatch: 9 vs 8). Scan Result Detailsrequirements.txtuv.lock |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
|
🛠 Full Test Coverage Report: https://k.atlan.dev/coverage/application-sdk/pr/1784 |
🧪 SDR Integration Tests (testcontainer) — mysqlStatus: Passed ✅ Temporal workflows: ✅ workflow_include_main_db · ✅ workflow_mixed_filters Extracted + transformed assetsWorkflow run 1 — mysql-0822058c0bd5691a-44f5d4aa
Workflow run 2 — mysql-3b377dc2ca6be340-6356e188
What this validates
Re-runPush a new commit, or re-run from the Actions tab. |
Discussion-first PR
This PR is opened as a draft to anchor the team discussion on the problem statement before locking in the implementation shape. The patch is intentionally minimal (3 LOC in
create_worker) and is only meant to make the conversation concrete.Problem
application_sdk.execution._temporal.create_workerregisters workflows by callingget_all_app_workflows(), which returns SDK-generated workflows per registered App entry point. Apps that need to register hand-rolled@workflow.defnworkflow classes alongside the App-generated ones cannot do so without forkingcreate_workerentirely.Concrete consumer: Automation Engine (AUT-904) has a
SingleActivityWorkflow— a generic one-activity dispatcher used by an LLM agent harness'srun_activitytool. The LLM picks any registered activity by name; the workflow looks up the activity's task metadata, constructs the PydanticInput, and invokes the activity. It is fundamentally not an App entry point (dynamic activity selection, not a typed input/output schema), but it must still be a real Temporal workflow because the Temporal SDK requires activities to be invoked from within workflow execution context.Today AE maintains a copy of SDK's
create_workerinautomation_engine/clients/temporal.pyjust to inject this one extra workflow class. The fork has to track SDK upstream evolution (interceptor chain, sandbox config composition, deployment versioning) on every SDK release and is at risk of silent divergence.Open questions for the team
extra_workflows=the right shape, or would the team prefer an alternative — e.g. a synthetic-App wrapper, a new SDK-side "generic dispatch workflow" primitive, or a different abstraction?Summary of the proposed change
extra_workflows: Sequence[type] | None = Nonekeyword-only param tocreate_worker.get_all_app_workflows()before being passed toWorker(workflows=...).None(default), behavior is unchanged.Test plan
tests/unit/execution/test_worker.py:test_extra_workflows_appended_to_registration— extra workflow class lands inWorker(workflows=...).test_extra_workflows_none_is_default— omitting the param matches passingNone.test_extra_workflows_empty_sequence_is_noop— empty sequence behaves likeNone.tests/unit/execution/test_worker.pystill pass.uv run pre-commit run --files application_sdk/execution/_temporal/worker.py tests/unit/execution/test_worker.py— ruff, ruff-format, isort, pyright all pass.🤖 Generated with Claude Code