Checkpointing LLM chains with Temporal
When call three fails, you pay for six
Multi-step LLM inference chains are structurally fragile. Temporal workflow durability turns retry-from-scratch into replay-from-checkpoint.
The Problem
The pipeline everyone pretends is simple.
The moment you move past a demo, inference becomes a chain of compute-dependent calls:
- Classify the user's intent.
- Generate a response based on that classification.
- Validate the output against your schema or safety rules.
- Post-process: parse, format, guardrail checks.
Four calls minimum - often more if you're doing RAG retrieval, summarization, or agent tool selection upstream. Each call depends on the one before it. The generation needs the classification. The validation needs the generation. Post-processing needs all of it.
Most teams build this with try/catch blocks and exponential backoff.
It works on the most trivial of issues. On anything else, a failure restarts the
entire chain from scratch.
The Cost
When call three fails, you've already paid for calls one and two.
A four-call chain where the validation step times out loses the validation and the classification and generation that preceded it. Those tokens and that latency are already spent, and the user is still waiting.
The duct-tape solutions are well-known. Retry with exponential backoff handles transient failures but re-executes every completed step. Circuit breakers prevent cascade failures but don't preserve intermediate results. Manual caching (Redis, DynamoDB) can checkpoint results, but now you're writing and maintaining state management code for every pipeline stage - TTLs, invalidation, coherency, the full distributed state nightmare.
These are band-aids on structural problems, ones that have been solved for years by other software engineering domains.[1] The pipeline has no durable checkpoints. Every failure is a full restart because nothing remembers what already succeeded.
The Solution
Temporal turns the chain into a workflow.
Temporal is a durable execution platform.[1] Each LLM call becomes a Temporal activity - or its own child workflow. When an activity completes, Temporal durably records the result as a checkpoint, without you writing any persistence code. If the workflow crashes, restarts, or times out on step three, it replays from the last checkpoint. Steps one and two don't re-execute. Their results are already recorded.
The workflow definition is the retry logic. No dead letter queues, no manual state reconciliation, no Redis cache to keep coherent. You write the pipeline as a sequence of activity calls. Temporal handles the rest - timeouts, retries, replay, and recovery.[2]
Longer chains gain more: agent loops that iterate 10+ times; RAG pipelines with retrieval, ranking, generation, and validation; multi-model routing where different models handle different parts of the response. Each additional step is another checkpoint that Temporal preserves. OpenAI's Codex agent and Replit's Agent both run on Temporal.[3]
The Math
One failed Validate call costs six LLM calls instead of four.
Three of the four pipeline steps are LLM calls: Classify, Generate, Validate. Post-processing is deterministic. When step three (Validate) fails, three LLM calls have run, including the one that failed. The retry re-runs all three from scratch. That's six total LLM calls to get one successful result, double the cost. With Temporal, the retry runs only the failed Validate call again, for four total LLM calls.
Scale that to an agent loop doing 10 LLM calls where call 8 fails. Without durability, the retry runs all 10 again, for 18 calls in total. With Temporal it runs call 8 again and carries on, for 11.
Durability itself is cheap. Measured against the same model call made directly, 200 runs per arm on two runtimes, wrapping it in a Temporal workflow costs 24 to 28 ms at p95 outside the call, and 25 to 32 ms at p99. Continuum's whole platform around the call, with Redis Streams for I/O, PostgreSQL for state and a notice back to the client, is a separate, real-world number: 35 to 43 ms at p95 outside the model's activity, on LM Studio. Both are broken down, stretch by stretch, in the durable inference benchmark.
Your Numbers
What does this cost you?
You think those LLM calls are just a few pennies you're spending? What about next year?
Assumptions [ − ] [ + ]
This calculator is a visual aid, not a billing estimate.
Not all errors cost an inference charge. Most providers don't bill for 5xx or timeout responses. But some managed services do charge for calls that return tokens your validation rejects - the call "succeeded" as far as the API is concerned.
The retry math also assumes a single retry attempt. In practice, even with in-place retry, there are only so many attempts you can make before the Client → API timeout fires. This doesn't account for retries that keep running after the client has already disconnected - a common misconfiguration where the server burns tokens for a response nobody will ever read.
Temporal doesn't have these problems. There's no cascading retry pressure from client timeouts. The workflow runs to completion regardless of client connection state, and the client gets the result when it's ready - by push notification or signal + query.
Tiered action pricing applies
Without Temporal
~2,740 / day
2.97% compounded across 3 calls
$75,000 at $0.025/call
$750 - full chain re-run on failure
$500 - already succeeded, re-run anyway
With Temporal
~2,740 / day
each replayed individually
$45,000 at $0.015/call
$150 - only the failed step re-runs
0.11% of total spend
Net annual savings
$15
After Temporal costs
Wasted LLM calls eliminated
1,000
This is before any SLA or contractual cost. A full retry also repeats the latency of every call before the failure, where a Temporal retry repeats only the failed call's.
How Temporal cost is calculated[8] [ − ] [ + ]
Energy cost of retries [ − ] [ + ]
Every wasted LLM call burns real electricity on work that produced nothing.
Sources [ − ] [ + ]
Documents
Repos