Continue-As-New - Python SDK - Temporal Platform Documentation
Continue-As-New - Python SDK - Temporal Platform Documentation
2025, 17:10
Develop
Continue-As-New -
Python SDK
How to Continue-As-New using
the Temporal Python SDK.
Continue-As-New enables a
Workflow Execution to close
successfully and create a new
Workflow Execution in a single
atomic operation if the number of
Events in the Event History is
becoming too large. The Workflow
Execution spawned from the use of
Continue-As-New has the same
Workflow Id, a new Run Id, and a
fresh Event History and is passed all
the appropriate parameters.
# ... Ask AI
@workflow.defn
https://docs.temporal.io/develop/python/continue-as-new Page 1 of 3
Continue-As-New - Python SDK | Temporal Platform Documentation 10.04.2025, 17:10
class LoopingWorkflow:
@workflow.run
async def run(self, iteration
int) -> None:
if iteration == 5:
return
await asyncio.sleep(
workflow.continue_as_new(iteration
+ 1)
USING CONTINUE-AS-NEW
AND UPDATES
Temporal does not support
Continue-as-New
functionality within Update
handlers.
Complete all handlers
before using Continue-as-
New.
Use Continue-as-New from
your main Workflow
Definition method, just as
you would complete or fail
a Workflow Execution.
Tags: Workflows
Temporal SDKs
https://docs.temporal.io/develop/python/continue-as-new Page 2 of 3
Continue-As-New - Python SDK | Temporal Platform Documentation 10.04.2025, 17:10
Help us make
Temporal
better.
Contribute to
our
documentation.
https://docs.temporal.io/develop/python/continue-as-new Page 3 of 3