Why Continue-As-New matters for long-running Temporal workflows
Continue-As-New lets a long-running workflow close its current run and start a fresh run under the same Workflow ID, so the workflow can keep going for days, months or indefinitely without its event history growing without bound. Teams need it when a workflow loops or waits for a long time, such as an entity workflow that lives as long as an account or device, or a polling loop that checks an external system on a schedule. A short workflow that starts, runs a handful of activities and completes has no need for it, and adding it there only adds code to review.
The main risk of skipping it is that every event the workflow records, including activity results, timers, signals and updates, is appended to one history that Temporal keeps for that run. As the history grows, the workflow becomes slower to load, replay and recover after a worker restart, and it eventually reaches a history limit at which Temporal stops accepting new events for that run. The failure is quiet until it happens, which is why a workflow that works in testing can fail in production weeks later. Teams should check the limits for their Temporal Server version in the Temporal documentation and estimate how many events a single loop iteration creates in their own design.
Plan for this at design time. Decide what state must survive a new run, such as entity data, pending work and identifiers, and confirm that it can be passed as workflow input. Decide when the workflow will call Continue-As-New, using event counts or the history length the SDK exposes, and test that path before launch. Ask your Temporal SDK team to confirm how pending signals and in-flight updates are handled at the boundary, because a signal that arrives during the hand-off must not be lost.
Continue-As-New trigger options and when each fits
This table compares four ways teams decide when a looping Temporal workflow should call Continue-As-New: a fixed iteration count, a history-size check, a time-based cadence, and a drain step before restart. Read each row for what the trigger depends on, what it risks, and which workflow types it suits. The main takeaway is that any trigger needs a plan for signals and updates that arrive near the restart point.
| Trigger option | What it depends on | Risks to plan for | When it fits |
|---|---|---|---|
| Fixed iteration count | A loop counter the workflow carries in its input, set to a value the team chooses from its own testing | Event count per iteration varies with activity retries and signal volume, so a fixed count can still grow history too far or restart too early | Batch-style loops with predictable work per pass, such as processing a known number of pages |
| History-size or event-count check | A history length or event count value exposed by the SDK; confirm the exact call and signal for your language in the official Temporal docs | The check must run often enough to act before limits are reached; signals received between the check and the restart need handling | Entity or long-lived workflows with uneven traffic, where the event volume per period is hard to predict |
| Time-based cadence | A timer or schedule inside the workflow that fires at a chosen interval, plus the expected event rate | Quiet periods restart needlessly, and busy periods can grow history faster than the timer expects; timers still need draining | Polling or monitoring loops with steady, low event rates where restarts are cheap and predictable |
| Drain step before restart | A signal and update handler that stops accepting new work, a check that in-flight handlers have finished, and a carry-forward of any pending messages | Without draining, signals or updates sent just before the restart can be lost or rejected, and callers may see errors | Workflows that receive signals or updates continuously, such as entity workflows, where no message may be dropped |
How one Workflow ID moves across runs
A workflow execution starts its first run under a Workflow ID, processes signals and activities, and reaches a Continue-As-New decision once its history grows. Before the run closes, pending signals are drained so none are lost, then a new run starts under the same Workflow ID with the state passed as input. Check the drain step and the handling of a stuck or failed run, because those are where state and messages most often go missing.
One Workflow ID carries state across a chain of runs, with signal draining before each hand-off.
How Continue-As-New closes a run and starts the next one
Continue-As-New closes the current run of a workflow and starts a new run with fresh event history, while the Workflow ID stays the same. The workflow code calls the Continue-As-New operation with the input for the next run, and that input becomes the carried state. The current run completes with a status indicating it continued as new, and the server records the new run ID as the successor. Nothing from the old event history is copied across, so the state the next run needs must be passed explicitly as arguments. Designers should therefore decide early which fields belong in that input and keep them small, because the input is the only state that survives the transition.
Callers identify the workflow by its Workflow ID, so signals, queries, updates and cancellation requests sent by ID continue to reach the open run without the caller knowing a transition happened. What does change is the Run ID, which is the value to check if your logs, dashboards or support runbooks record run-level identifiers. Anything that stored a Run ID to address a specific execution will point at a closed run after the transition. Confirm which of your systems persist Run IDs, and decide whether they should hold the Workflow ID instead. Also confirm how your SDK version exposes the previous run ID and the continued-as-new status to workflow code, since some teams use that link to reconcile records across runs.
The precise behavior of pending timers, child workflows and activities at the moment of the call is specified in the Temporal documentation, and it differs in ways that matter for design. Read the Continue-As-New section of the Temporal docs for your SDK before writing the loop, and verify with a test that signals arriving near the transition are not lost. Work through each in-flight timer, child workflow and activity in your design and confirm, for that SDK, whether it is awaited, abandoned or cancelled when the run closes. Those answers determine whether a loop can safely continue-as-new while it has outstanding work.
What to carry forward into the next run
Continue-As-New closes the current run and starts a new one with the same Workflow ID and a fresh history. Everything the loop still needs has to be passed as input or fetched again, so each item below is a decision about what travels and what stays outside the workflow.
Business state the loop needs
Carry the minimum state required to resume: a cursor or high-water mark, running aggregates, and the list of pending items not yet processed. Check that the cursor points to the last completed unit of work, so the next run neither skips nor repeats records. Store the cursor as a plain value, and confirm that a restart after Continue-As-New resumes from the same position as a run that never rolled over. Test the boundary explicitly with a run that rolls over in the middle of a batch.
Visibility docsConfiguration and version markers
Settings such as thresholds, feature flags and the code version that produced the current state must survive the handover. A new run starts with whatever workflow code is deployed at that moment, so older state may need to be read by newer logic. Record the version marker in the input and confirm that the new code path accepts state written by the old one before rolling out a change.
Pending signals and updates
Signals and updates that arrive while the workflow is closing can be lost or rejected if the handover is not planned. Stop accepting new work, let in-flight updates finish, and decide whether unhandled signals are carried in the input or sent again by the caller. Confirm how your SDK reports signals received during the rollover and what callers see when an update arrives mid-handover.
Child workflow handles and timers
Child workflow handles and pending timers belong to the current run and do not carry forward as objects. Decide whether each child is awaited, detached or re-created in the new run, and set the parent close policy so that children are not orphaned or duplicated. Timers need a recomputed deadline in the next run. Check that every child you start has a known ID, so the new run can find it again.
Large data stays out of the input
Workflow input and Continue-As-New arguments count toward payload size limits, and history grows with every payload passed around. Keep bulk records in a database, object store or activity result, and pass only identifiers or a pointer to them. Confirm the payload size your Temporal deployment and SDK accept, and test a run with the largest expected state before you rely on it. Encrypted payloads still count toward size.
Deployment docsTrigger thresholds and history checks
Decide when the loop rolls over, using both an event count and a loop iteration count, and read the history length from the workflow info at each iteration. Rolling over too early adds overhead; rolling over too late risks hitting history limits. Confirm the limits that apply to your Temporal Server version and set alerts on history size for long-running workflow types.
Setting up Continue-As-New in a workflow loop
This sequence turns a looping Temporal workflow into one that restarts its history on a planned schedule while keeping the same Workflow ID and no lost messages. Each step ends with a check you can run before the change reaches production.
Map the loop and its growth sources
The workflow owner and a Temporal developer list every construct inside the loop that adds events to history, including activities, timers, child workflows, signals, and updates. They mark which ones run per iteration and which ones can accumulate without limit. The output is a short written inventory of growth sources per iteration, reviewed with the team that owns the business process. You know this step is done when every loop variable that grows has an owner and a reason it stays bounded or gets carried forward.
Choose the trigger and set its threshold
Decide what causes Continue-As-New to run, such as the SDK's suggestion flag from the server, an iteration counter kept in workflow state, or both. Place the threshold in configuration, such as an environment variable or config file, so operators can tune it without a code change. Log the trigger reason each time it fires. The check is a test that sets the threshold low, runs the loop, and confirms the trigger fires at the configured point and writes the reason to the log.
Define the carried state and version field
Create the input type for the next run with only the state the loop needs to continue, plus a schema version field so future changes can be read safely. Set defaults for fields that older runs may not have. Avoid carrying full result lists or large payloads, which add to the new run's input. The check is a unit test that decodes an input from the previous schema version and confirms the new run starts with the expected defaults and no lost fields.
Add a drain step for signals and updates
Before calling Continue-As-New, stop accepting new updates, wait until in-flight signal and update handlers finish, and decide how buffered signals are handled. Either process them in the current run or include them in the next run's input, and document which path your SDK supports. Confirm the exact drain pattern in your SDK documentation. The check is a test that sends signals and updates during the drain window and confirms that every message is applied exactly once across the boundary.
Call Continue-As-New from the loop
Return the Continue-As-New call from the workflow code with the same workflow type, the same task queue, the drained state, and the new version field. Cancel or wait on any timers and pending activities that should not carry over. The Workflow ID stays the same while the Run ID changes. The check is a run in a development environment where you confirm the Workflow ID is unchanged, the Run ID is new, and the new run's history begins with only the carried state.
Test replay and a forced boundary crossing
Replay workflow histories recorded before the change to confirm that the modified code is deterministic. Then run a workflow with a low threshold so it crosses the boundary several times while a test driver sends signals and updates. Compare the final state with a ledger of expected messages. The check is a replay with no non-determinism errors and a ledger match that shows each message was applied once and in order, with no gaps at any boundary.
Confirm history size and visibility after rollout
After release, open a long-running workflow in the Temporal Web UI and confirm that each new run has a smaller history than the run before it, and that the chain of runs is visible under one Workflow ID. Check which visibility store your self-hosted service uses, since search results for runs depend on it. Keep the threshold and trigger reason in your monitoring so operators can see how often the loop restarts. The check is a documented baseline of history size and restart frequency that the team can compare against later.
Storage savings and what they depend on
Continue-As-New helps storage because each run keeps its own event history. When a long-running workflow closes one run and starts a new one, the history of the old run stops growing on that run, so no single execution accumulates events without bound. The savings do not come from deleting anything at the moment of the switch. Closed history stays in the persistence store until the namespace retention period removes it, so the drop in storage shows up as older runs age out rather than as an immediate reclaim.
The size of the savings depends on three things: how many events each iteration produces, how large the payloads in those events are, and how the namespace retention settings are configured. A workflow that receives many signals and schedules many activities per loop will generate far more history than one that wakes once a day, and large payloads multiply the bytes stored per event. This page does not give a figure for any of these, because the outcome is specific to each workload. Ask your Temporal contact or your own platform team what volumes to expect, and do not treat a savings estimate from another environment as your own.
Measure before and after the change on your own workload. Record the history length and history size of representative workflow executions, the storage used by the persistence database for the namespace, and the visibility store load, then repeat the measurements after Continue-As-New is in place and after the retention period has passed. Review the namespace retention settings against the Temporal persistence docs and the Temporal visibility docs, because retention controls both how long closed history remains and how long visibility records remain queryable. Shorter retention reduces stored history but can remove the record your auditors or support staff need, so agree the retention period with compliance owners before you rely on it.
Security and operational considerations for looping workflows
Workflows that continue as new keep state alive across many runs, so the data they carry, the people who can reach them and the procedures for stuck runs all need deliberate design. The cards below cover the controls and checks that matter most when a self-hosted Temporal Service runs Continue-As-New workflows in your infrastructure.
Protect data carried across runs
State passed into the next run is stored as workflow input and history, so it can contain personal or regulated data that persists longer than you expect. Route those payloads through a custom codec and encryption setup so they are encrypted before they reach the persistence layer. Confirm which fields are carried forward, which can be dropped at each run boundary, and who holds the encryption keys.
Temporal security docsRestrict who can start and stop
Anyone who can signal, terminate or reset a long-running looping workflow can disrupt state that may have accumulated over thousands of runs. Limit those operations to named operator roles and review them in your audit trail. Check which namespace roles your identity provider's claims map to, and test that a read-only user cannot terminate a workflow.
Read visibility across many runs
Each Continue-As-New creates a new run under the same workflow ID, so searches and dashboards show one ID with many run IDs. Teams reviewing executions can mistake a healthy long-running workflow for a stuck one, or miss a failure in an earlier run. Confirm that your visibility store, Elasticsearch or OpenSearch for larger deployments, indexes the fields your queries need, and build dashboards that group by workflow ID.
Plan for runs that will not drain
A run that keeps producing events without reaching a Continue-As-New point can approach history limits or hold resources longer than planned. Write a runbook that identifies the workflow, checks its current history length and pending signals, and decides between waiting, signaling it to finish, or terminating it with a documented reason. Rehearse the steps in a non-production namespace before an incident.
Apply authorization to every API call
Continue-As-New is triggered from workflow code, but the surrounding operations that start, describe, signal and terminate workflows arrive through the Temporal frontend API. If no Authorizer is configured, the default noopAuthorizer allows every request without authentication. Configure an Authorizer and ClaimMapper before any production use, and verify that each role is denied the operations it should not have.
Questions buyers ask about Continue-As-New effort and cost
What drives the effort of adding Continue-As-New to a Temporal workflow?
The effort is driven mainly by how many loops the workflow runs, how much state it carries between iterations, how signals and updates arrive while it is running, and whether the workflow is already in production. A workflow that loops a few times with simple state is a small change. A workflow that accumulates large collections, handles signals at any point in its loop, and has live executions with histories already built up needs more design, more tests and a planned rollout. Each of these factors widens the scope and the verification work.
Can our in-house team add Continue-As-New without a partner?
Yes, a team with working Temporal SDK skills and a disciplined testing practice can make this change in-house. The work involves restructuring the workflow entry point, deciding what state is passed to the next run, draining or handling in-flight signals and updates, and writing replay tests that prove the code remains deterministic. Teams without prior Temporal experience usually find the replay and versioning steps the hardest part, so they should plan time to learn those before changing production workflows.
How long does a Continue-As-New change typically take?
Duration depends on the scope of the change, so it should be taken from the written scope rather than estimated in advance. The main variables are the number of workflow types affected, the complexity of the state carried forward, the number of signal and update handlers, the test coverage that already exists, and how many running executions must be migrated safely. Ask any provider for a timeline tied to the specific workflows, the test environments available and the deployment steps agreed up front.
What must our team provide before the work can start?
Expect to provide the workflow code that needs to change, the activity and worker code it calls, and any existing tests. You will also need test environments that can run Temporal workflows at realistic history sizes, decisions on retention and visibility settings for closed runs, and access to the Temporal cluster or Temporal Cloud namespace where the workflows run. Confirm who can approve changes to production workflow types and how running executions will be handled during rollout.
What does each part of the work cost, and what recurs afterwards?
The one-time costs are design, code changes, replay and integration testing, and the rollout plan. Recurring costs come from operating the Temporal service itself, which for self-hosted deployments includes infrastructure, persistence and visibility stores, upgrades and on-call effort. Ask any quote to separate one-time engineering from ongoing operations, to state which workflow types are covered, and to list the test and rollout steps included.
Does running on Temporal Cloud change how Continue-As-New is built?
The workflow logic is the same on Temporal Cloud and on a self-hosted Temporal Service, so the design of the loop, the state carried forward and the replay tests carry over. What changes is the operating model: Temporal Cloud handles the server, persistence and upgrades, and your team manages namespaces, identity and usage. Temporal Cloud pricing starts at 50 US dollars per million actions, with storage charged per GB-hour, according to the Temporal pricing page, so usage patterns from loops and history size should be modeled before you choose a deployment. Confirm the current figures on the Temporal pricing page before budgeting.
What breaks if Continue-As-New is added incorrectly?
The most common failures are non-determinism errors during replay, where a code change alters the command sequence of running workflows, and lost or duplicated signals when a run ends while messages are still arriving. State that is not carried into the new run also causes silent data loss. Each of these is caught by replaying existing histories against the new code, testing signal arrival during the transition, and rolling out with a versioning strategy for executions already running.
Limits to confirm for your Temporal version and SDK
Continue-As-New depends on limits that move with the Temporal Server release, the SDK and the persistence and visibility stack you run. The items below are facts to confirm in your own environment rather than values to copy from this page. Check each one against the release you plan to deploy, then record the result in your design.
History size and event count thresholds
Confirm the exact history-size and event-count thresholds that trigger warnings and hard failures for your server and SDK release. Our sources reference Temporal Server v1.32.1, published October 8, 2026, but the thresholds themselves must come from the release notes and configuration for the version you run. Set your Continue-As-New trigger below the lowest limit you find, and test it with a workflow that loops until it reaches that trigger.
Temporal releasesMaximum input size per run
Check the maximum payload size that a new run accepts as input, because Continue-As-New carries state forward as arguments to the next run. A workflow that copies a growing list into each new run can fail at the boundary even when its history is short. Measure the serialized size of the carried state with your data converter and codec in place, since encryption and encoding change payload size.
In-flight signals and updates at the boundary
Confirm how signals and updates that arrive while a workflow is closing are handled by your SDK and server version. Check whether they are delivered to the old run, carried into the new run, or rejected, and whether callers receive a clear error. Write a test that sends a signal and an update during a Continue-As-New, then verify that no message is lost or applied twice.
History-length signal in your SDK
Check whether your SDK exposes a way to read the current history length or an equivalent suggestion to continue as new, and how it behaves during replay. Confirm the exact name and behavior in the SDK reference for your language and version. If the signal is not available, plan a counter in workflow state, and document how that counter stays deterministic.
Child workflows and timers across runs
Confirm how open child workflows, pending timers and parent close policies behave when a parent continues as new. Children that are still running may need to be tracked, signaled or allowed to finish before the parent restarts, so the new run does not duplicate work. Test that timers resume at the intended time and that child workflow IDs stay unique across runs.
Effects of your upgrade path
Confirm whether the Continue-As-New limits, the signal behavior and the persistence schema change between the versions in your upgrade path. Temporal documents that backward compatibility is guaranteed only between two successive minor versions, and that schema upgrades must run before server upgrades when release notes require it. Retest these limits at each step, and do not assume the values you measured on the old version still hold.
Upgrade docsHow DeployOpen scopes and delivers Continue-As-New work
DeployOpen treats Continue-As-New as a design and operations decision, not a one-line code change. We agree the written scope for your long-running workflows, build and test the carry-forward logic against your own Temporal deployment, and hand over documentation your engineers can run. Engagements are fixed-scope, with ongoing support available as a retainer.
How we scope
- Inventory the long-running and looping workflows and estimate their event counts per run.
- Record which workflows need Continue-As-New and which state must carry across each run.
- Agree in writing which Temporal SDK, server and persistence versions the work covers.
How we build
- Implement the trigger logic based on history length and the event thresholds your SDK exposes.
- Test state carry-forward, pending signals, timers and child workflows across run boundaries.
- Verify replay and versioning behavior so in-flight runs survive deployments without non-determinism errors.
How we hand over
- Deliver the workflow design document, trigger thresholds and state inventory for your team.
- Provide runbooks covering monitoring of history size and what to check when a run restarts.
- Walk your engineers through the code and tests so they can extend the pattern without us.
How we support
- Offer ongoing support and upgrade work for Temporal workflows as a retainer, scoped in writing.
- Re-test Continue-As-New paths when SDK or Temporal Server upgrades change workflow behavior.
- Confirm with your team which support tier and response times fit your operating hours before signing.

