October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Add Human-in-the-Loop to an Async Queue with LangGraph

LangGraph can pause a graph for human review and resume it later with a checkpointer and the same thread_id. Here’s how to coordinate that with an async queue and guard against replayed side effects.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use LangGraph’s interrupt() to pause a workflow, a checkpointer to save its graph state, and the same thread_id to resume it after a person responds. The queue handles scheduling and delivery; it does not replace the checkpointer. This separation lets a worker finish its current job rather than remain occupied while a reviewer makes a decision.

What LangGraph checkpointing does—and what the queue does

LangGraph’s documented interrupt mechanism pauses graph execution at a chosen point and waits for external input. When the graph interrupts, the persistence layer saves its state. The interrupt payload is returned to the caller so an application can present it to a reviewer. Later, the application invokes the graph with a resume value, and execution continues from the saved thread. See the LangGraph JavaScript interrupts guide.

As an Amazon Associate I earn from qualifying purchases.

These are separate responsibilities. LangGraph provides checkpointed graph state and resume semantics. Your application or managed runtime coordinates queue jobs, reviewer notifications, response collection, and the later resume call. A queue message by itself does not restore the graph; the checkpointer and thread identifier do that.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How a queued review-and-resume cycle works

  1. Start a graph run. The worker invokes the graph with a stable application job ID mapped to a thread_id.
  2. Pause at the review point. The graph calls interrupt() with a JSON-serializable payload, such as the proposed action and the information the reviewer needs.
  3. Save the paused work. A configured checkpointer stores the graph state for that thread. The caller receives the interrupt payload and can mark the application job as waiting for review.
  4. Collect the human response. The application displays the payload, records an approval, rejection, or edit, and applies its own timeout or cancellation policy.
  5. Enqueue a resume job. The message should carry the same thread_id and the reviewer’s response. A worker invokes the graph again with a Command containing that response as its resume value.

When the graph resumes, the value supplied through Command({ resume: value }) becomes the return value of the corresponding interrupt() call. Reusing the original thread_id selects the saved thread; using a new one starts a separate thread instead. These are LangGraph’s documented semantics, while the queue messages and application job mapping are an architectural pattern for a custom system.

Minimal JavaScript shape

The core setup requires a checkpointer, a thread ID, and an interrupt at the point where outside input is needed. This abbreviated example shows the graph-side contract; it does not implement a queue, reviewer interface, or durable application-job mapping.

import { Command, interrupt } from "@langchain/langgraph";

// Compile the graph with a checkpointer appropriate to your deployment.
const graph = builder.compile({ checkpointer });

const config = {
  configurable: { thread_id: "review-job-123" },
};

// Initial invocation runs until it completes or interrupts.
const paused = await graph.invoke(input, config);

// After collecting a reviewer response, resume the same thread.
const resumed = await graph.invoke(
  new Command({ resume: reviewerResponse }),
  config,
);

Inside a graph node, call interrupt() where the workflow needs the external response, and pass a JSON-serializable payload that the application can present to the reviewer. Use the exact API and graph setup for the LangGraph version and runtime in your application; the linked examples are for JavaScript/TypeScript documentation.

The critical replay rule: the interrupted node starts over

On resume, LangGraph starts the node containing the interrupt from its beginning. Statements before interrupt() therefore run again. If such a statement sends an email, charges an account, writes to an external system, or performs another non-idempotent action, resuming can duplicate that effect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put the interrupt before effects that should wait for approval. Where earlier effects are unavoidable, make them safe to replay—for example, use a durable idempotency key or an outbox-based delivery pattern. These safeguards are application design choices, not a single side-effect strategy prescribed by LangGraph. The replay behavior and interrupt requirements are documented in the interrupt guide.

Checkpointer, store, and queue: choose each for its job

A checkpointer saves snapshots of a graph thread so that execution can resume. A LangGraph store is for application-defined data that needs to persist across threads; it is not a substitute for the thread’s checkpoints. The checkpointer guide and persistence guide describe these roles.

In-memory savers are useful for experiments, but the JavaScript persistence documentation notes that their checkpoints disappear when the process restarts. For workflows expected to survive restarts, configure an appropriate persistent checkpointer and decide how long checkpoints and related job records should be retained.

The application’s queue and job store need their own durable relationship to the graph thread. Persist the mapping between the application job and its thread_id; do not rely on an in-memory mapping if a later worker must resume the thread. Define how the system handles duplicate deliveries, retries, reviewer timeouts, rejection, and cancellation, including which state transition wins if a response and cancellation arrive close together.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose checkpoint durability for the recovery point you need

The JavaScript checkpointer documentation describes three durability modes. They trade write timing against the amount of intermediate progress available after a crash; none should be treated as a blanket guarantee against every failure.

Mode When checkpoint data is written Practical implication
exit When execution exits Does not save intermediate state for recovery from a mid-execution process crash.
async While the next step runs Balances performance and durability, with a small crash window.
sync Before the next step begins Improves durability relative to deferred writes, at some performance cost.

Select a mode based on how much work the application can afford to repeat after a crash and the latency cost it can accept. The documented options are in the LangGraph checkpointer guide.

LangGraph checkpoints at super-step boundaries. Its checkpointer guide also describes node-level pending writes, which can preserve completed work within a super-step when another node fails. That recovery behavior is distinct from the external side effects your application must make safe to replay.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

LangSmith Agent Server is one managed architecture, not a custom-queue requirement

LangSmith Agent Server’s documented data plane illustrates how a managed runtime can coordinate runs and workers. In that architecture, PostgreSQL stores server resources such as threads and runs and is the default checkpoint backend. MongoDB can be configured for checkpoint storage, while PostgreSQL remains required for other server resources. Redis is used for worker communication and ephemeral metadata rather than user or run data. In the described flow, a Redis list wakes a worker with a sentinel, and the worker retrieves run information from PostgreSQL. Redis communication also supports cancellation and streaming. Details are in the LangSmith data-plane documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The same documentation says Agent Server runs execute in background worker pools: queue workers scale on pending run count, while API servers scale on CPU and memory. Those statements describe Agent Server deployments. They do not require a custom application to use Redis and PostgreSQL in the same arrangement, and they do not establish comparative performance for third-party queue brokers.

Operational choices that affect reliability

Keep work units observable and recoverable

The Thinking in LangGraph guide recommends retry policies for transient failures, interrupts for problems a user can fix, and allowing unexpected errors to surface for debugging. Smaller nodes can improve observability and limit repeated work after failure. Caching is an application-level decision.

Make retries and delivery idempotent

Queue systems may deliver work more than once or retry after a worker fails. Treat the application’s job transitions and resume operation as part of one recovery design: retain the thread mapping, record whether a review response has already been accepted, and ensure duplicate messages cannot apply the same external action twice. Coordinate this with the node replay rule rather than assuming a checkpoint makes external systems transactional.

Specify human and job lifecycle behavior

Decide what happens if a reviewer never responds, submits conflicting responses, rejects the proposed action, or responds after a job has been cancelled. Define which component owns the canonical status and how it prevents a stale resume message from advancing a thread after cancellation. LangGraph supplies the pause-and-resume primitive; these workflow policies belong to the application or managed runtime.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.