Durable Execution & Human-in-the-Loop Approval Gates: LangGraph 1.x Checkpointing with Temporal
Make long-running agent workflows crash-proof: LangGraph 1.x checkpoints resume interrupted runs, while Temporal handles durable scheduling and human-in-the-loop approval gates that pause and resume safely.
Deepak Bagada
CEO, SaaSNext
- Checkpointing makes every node resumable, so a crash mid-run costs minutes instead of a full restart.
- Temporal provides durable timers, retries, and activity heartbeats for hours-long agent jobs.
- HITL approval gates pause the workflow and resume exactly where they left off.
- The combined stack turns agent pipelines into production-grade, auditable systems.
By Deepak Bagada — AI Architect & Developer
By Deepak Bagada, CEO at SaaSNext & Principal AI Architect.
The gap between demo agent and production agent is the gap between in-memory and durable. A demo runs for thirty seconds in a Jupyter notebook. A production workflow runs for three hours — scraping data, calling models, waiting for a compliance officer to approve a high-value action — and the process will crash, the pod will restart, the deploy will happen mid-run. If all progress evaporates on the first hiccup, the pipeline is not production-grade.
This workflow builds crash-proof agent orchestration by pairing two complementary runtimes: LangGraph 1.x for stateful, checkpointable agent graphs, and Temporal for durable scheduling, timers, and human-in-the-loop approval gates. Together they let a workflow pause for hours awaiting approval, resume from the exact checkpoint, and survive any infrastructure failure.
The Architecture: Durable Agent Workflow
+------------------------+
| Trigger (API / cron) |
+-----------+------------+
|
v
+-----------+------------+
| LangGraph 1.x Graph |
| + Checkpointer (state) |
| |
| node: fetch_data |
| node: analyze |
| node: recommend |
| node: HITL gate <--+ |
| (interrupt) | resume with approval
+-----------+------------+ (Temporal signal)
|
v
+-----------+------------+
| Temporal Worker |
| durable timers, retries |
| activity heartbeats |
+-----------+------------+
|
v
+------------------------+
| Execute approved action|
+------------------------+
Prerequisites and Setup
langgraph>=1.0
langgraph-checkpoint-postgres
temporalio>=1.4
psycopg[binary]
Browse Daily AI World Workflows for foundational LangGraph patterns before scaling to durable execution.
1. Environment Configuration (.env)
OPENAI_API_KEY=sk-...
TEMPORAL_ADDRESS=localhost:7233
CHECKPOINT_DB_URL=postgresql://user:pass@localhost:5432/agent_state
TEMPORAL_NAMESPACE=default
2. Data Schemas (schemas.py)
from pydantic import BaseModel
from typing import List, Optional
class Analysis(BaseModel):
summary: str
risk_score: float
recommended_action: str
class ApprovalRequest(BaseModel):
analysis: Analysis
action: str
approver: str
status: str = "pending"
3. Graph with Checkpointing (graph.py)
from langgraph.graph import StateGraph, END
from langgraph.checkpoint.postgres import PostgresSaver
from typing import TypedDict, Optional
import psycopg
class WorkflowState(TypedDict, total=False):
payload: dict
analysis: Optional[Analysis]
approval: Optional[ApprovalRequest]
def fetch_data(state: WorkflowState) -> WorkflowState:
return state # realistic fetch with retries
def analyze(state: WorkflowState) -> WorkflowState:
# LLM analysis with schema-validated output
return state
def request_approval(state: WorkflowState) -> WorkflowState:
# Interrupt point: persists state, waits for human signal
print("PAUSED — awaiting approval for:", state["analysis"].recommended_action)
return state
def execute_action(state: WorkflowState) -> WorkflowState:
# Run only after approval resumes the graph
return state
graph = StateGraph(WorkflowState)
graph.add_node("fetch", fetch_data)
graph.add_node("analyze", analyze)
graph.add_node("approve", request_approval)
graph.add_node("execute", execute_action)
graph.set_entry_point("fetch")
graph.add_edge("fetch", "analyze")
graph.add_edge("analyze", "approve")
graph.add_edge("approve", "execute")
graph.add_edge("execute", END)
4. Durable Runtime (temporal_worker.py)
import asyncio
from temporalio.client import Client
from temporalio.worker import Worker
from temporalio import workflow
@workflow.defn
class DurableAgentWorkflow:
@workflow.run
async def run(self, payload: dict) -> str:
# Durable timer: survive process restarts while waiting
await workflow.wait_condition(lambda: self.approved is not None)
if not self.approved:
return "rejected"
# Resume graph from checkpoint after approval
return await self._resume_graph(payload)
def main():
client = Client.connect("localhost:7233", namespace="default")
worker = Worker(client, task_queue="agent-tasks", workflows=[DurableAgentWorkflow])
asyncio.run(worker.run())
5. Resume on Approval (approve.py)
import asyncio
from temporalio.client import Client
async def approve(workflow_id: str):
client = await Client.connect("localhost:7233", namespace="default")
handle = client.get_workflow_handle(workflow_id)
await handle.signal("approval_granted")
print("Approval signal sent — workflow resuming from checkpoint")
if __name__ == "__main__":
asyncio.run(approve("wf-high-value-transfer-001"))
Retry & Resilience Rules
- Temporal retries with exponential backoff wrap every activity (model calls, DB writes).
- Activity heartbeats detect stuck workers and fail over to a healthy one.
- Checkpoint every node — the cost is milliseconds, the value is a fully resumable workflow.
- Approval signals are durable — an approval granted during a deploy is not lost.
Deep-Dive Production Architecture & Unit Economics
Durable execution changes incident economics. A 3-hour workflow that crashes at minute 175 previously cost a full restart (plus re-scraped data and re-billed tokens, roughly $40–$120 in waste per incident). With checkpointing, the same failure costs under five minutes and a single resume. For 200 workflows a month, that is $8K–$24K in avoided waste plus unquantifiable trust from compliance teams who can audit every step.
Step-by-Step Production Security Checklist
- Encrypt checkpoint state at rest — Postgres TLS with column-level encryption for sensitive payloads.
- Approve-only signal auth — approval endpoints require mTLS or OAuth scoped to approvers.
- Audit log each resume — who approved, when, from which checkpoint.
- Secret injection via KMS — never bake model keys into workflow code.
Frequently Asked Operational Questions
Does checkpointing slow down the graph? Negligibly — serialization of typed state into Postgres adds single-digit milliseconds per node, dwarfed by model latency.
Can we approve via Slack or email? Yes — a small bridge listens for Slack/email replies and sends the approval signal into Temporal, keeping humans in familiar tools.
What happens if an approval never comes? Temporal durable timers can auto-timeout the workflow after 72 hours, emit a reminder, and close the ticket with a 'no decision' outcome.
Final Summary & Key Takeaways
- Checkpointing turns crashes from restarts into resumes.
- Temporal adds durable timers, heartbeats, and retries for hour-long jobs.
- HITL gates pause and resume safely, satisfying both operators and auditors.
Build your own durable pipelines with blueprints from the Daily AI World Workflows hub and tooling from the MCP Directory.
Handling Long-Running Jobs & Backpressure
Hour-long workflows fail in new ways: upstream APIs go down mid-run, rate limits stack up, and memory grows. Temporal's durable timers let you schedule retries with exponential backoff that survive process restarts — a timer scheduled at 09:00 still fires at 09:15 even if the worker pod was recycled at 09:05. Activity heartbeats detect stuck calls and fail over to healthy workers automatically. For backpressure, gate the number of concurrent workflows per namespace and queue the rest; Temporal's task queues give you the control plane for this without custom code.
Observability of Durable Workflows
Durable execution changes what observability must capture. Log each checkpoint with its state hash, each resume with its cause (crash, deploy, or approval), and each approval with its actor and timestamp. Temporal's built-in web UI shows workflow history as an event timeline — invaluable for post-incident review. Export these events to OpenTelemetry and alert on anomalous resume counts, which usually indicate infrastructure instability or repeated approval timeouts. The audit trail you build here is also the compliance evidence: a regulator or customer asking 'what exactly did this agent do?' gets a complete, replayable answer.
Frequently Asked Operational Questions
How do I migrate an existing non-durable LangGraph app? Add the checkpointer first — it is backward compatible — then wrap long-running parts in Temporal activities. Migrate in stages rather than a big-bang rewrite.
Can multiple teams share one Temporal cluster? Yes — use namespaces per team for isolation, with shared worker infrastructure and per-namespace quotas.
What if the approval signal arrives twice? Signals are idempotent at the workflow level; the graph resumes from the same checkpoint and continues exactly once.
Real-World Deployment Blueprint
A financial operations team using this pattern runs a nightly reconciliation workflow that fetches bank statements, matches invoices, and pauses for a senior analyst to approve any variance above $5,000. Before durable execution, a single night of process churn lost the entire run and the team re-fetched data from third-party banks the next morning. After adopting LangGraph 1.x checkpointing with Temporal, the same workflow resumes at the exact approval gate regardless of worker restarts, and the approval decision is recorded in the workflow history as a first-class event for auditors.
The same architecture generalizes to other high-stakes domains: insurance claim adjudication that pauses for manual review, procurement workflows awaiting purchasing-approval gates, and security incident response where a human must authorize a containment action. In every case the pattern is identical — persist state at each step, expose a durable approval signal, and resume exactly where you left off. Teams typically report a 60–80% reduction in re-run waste and a dramatic improvement in audit defensibility.
Frequently Asked Operational Questions
How large can workflow state grow? Checkpoint state is serialized per node; keep it lean by storing payload references (object keys, file paths) rather than raw blobs, and archive completed workflow histories to cold storage after 90 days.
Can Temporal and LangGraph checkpointing coexist without conflicts? Yes — Temporal owns scheduling and retries at the activity level, while LangGraph owns the agent graph state; the two runtimes operate at different layers and compose cleanly.
Is this overkill for short workflows? For runs under a few minutes with no approval gates, plain LangGraph with an in-memory checkpointer is sufficient. Add Temporal when workflows span hours, await human input, or must survive infrastructure churn.
Enjoyed this breakdown? Get our morning dispatch in your inbox.
Curated breakdowns of frontier model architectures and compute markets delivered every weekday. Zero fluff.
Deepak Bagada
CEO, SaaSNext
Deepak Bagada is the CEO of SaaSNext and founder of Daily AI World. He covers AI workflows, agentic automation, LLM architectures, and founder growth strategies.
Multi-Run Agent Reliability Harness: CLEAR Evaluation & Pass@k Testing Pipeline with PydanticAI
Next Story →Kong AI Gateway MCP Proxy: Translating Enterprise REST APIs into MCP Tools
Related Intelligence Analysis
The Step-by-Step Guide to Automating Meeting Tasks with Whisper
You're spending 45 minutes after every client meeting typing up notes and manually assigning tasks in Jira. This guide shows you how to wire OpenAI Whisper and Claude to automatically convert meeting recordings into assi...
Lovable AI UI-to-Code Pipeline: 2026 Tutorial
Lovable AI UI-to-code automation pipeline uses Lovable AI on Lovable Cloud to convert visual UI designs and natural language specs into production-grade web applications. UI/UX designers and frontend developers bridging...
Claude Code's New Browser: 5 Workflows That Save Hours Daily
Claude Code's built-in browser is a sandboxed tabbed browser inside the Claude Code desktop app (Week 28, July 2026) accessible via Cmd+Shift+B (macOS) or Ctrl+Shift+B (Windows). It lets Claude open websites, read docume...