
How to Debug an n8n AI Agent Tool That Returns an Empty Result: 6 Checks
Debug an n8n AI Agent tool in six checks: trace the call, test workflow output, verify inputs, and fix field mapping so useful results reach the agent.
If a worker restarts while a LangGraph workflow is waiting for human approval, resume the saved thread instead of starting a new run. This guide is for developers using LangGraph’s Python Graph API; it shows how to preserve the checkpoint, locate the pending approval, and continue with a reviewer’s decision. The examples follow the current LangGraph Python documentation.
interrupt(), plus a persistent checkpointer such as PostgreSQL for production. The process-local InMemorySaver is suitable for examples, but its checkpoints disappear when the process stops.thread_id must be stored by your application alongside the approval request.A LangGraph checkpointer saves graph state as thread-scoped checkpoints. An interrupt pauses execution and surfaces its payload to the caller. The recovery key is the same thread_id, used with the same checkpoint store. A new ID points to a different thread and cannot recover the pending approval. See LangChain’s persistence guide and interrupt guide.
Compile the graph with a checkpointer and make sure production uses durable storage that survives worker replacement. For example, use LangGraph’s PostgreSQL checkpointer rather than an in-memory saver for a workflow expected to resume after a process restart. Configure the checkpointer once per application lifecycle and ensure restarted workers connect to the same database and checkpoint tables.
Keep the thread ID stable across the pause and recovery. Your application should persist it with the approval record, such as approval-7421. Do not generate a fresh thread ID in the worker startup or resume handler.
When LangGraph resumes an interrupt, it restarts the node containing interrupt() from the beginning. Any code before that call runs again. Put the interrupt before side effects, such as sending a notification or executing a write tool, or make those operations idempotent so repeating them has no duplicate effect.
from langgraph.types import interrupt
def approval_node(state):
decision = interrupt({
"action": "Approve database update?",
"request_id": state["request_id"],
})
return {"approval_decision": decision}
The interrupt payload must be JSON serializable. This example returns a small object the application can show to a reviewer; it does not execute the write before approval.
Start the graph with a stable thread ID in the configurable section of the runtime config. When the graph returns an interrupt, save the ID and approval context in your durable application database. This lets a replacement worker associate the reviewer’s response with the correct graph thread.
config = {"configurable": {"thread_id": "approval-7421"}}
result = graph.invoke({"request_id": "req-7421"}, config)
pending = result.get("__interrupt__", ())
if pending:
save_pending_approval(
thread_id="approval-7421",
request_id="req-7421",
interrupt_value=pending[0].value,
)
The invocation’s __interrupt__ field indicates that execution paused and includes the value passed to interrupt(). Store enough application data to route the decision, but do not treat an approval payload as proof that the requested operation already ran.
Start the replacement worker with the same graph definition and the same persistent checkpointer configuration. Load the pending approval record from your application database, then reuse its original thread ID. If needed, inspect the checkpoint state with the checkpointer’s supported state-reading API before continuing; this helps distinguish a pending interrupt from a thread that already completed.
Do not rebuild the graph with a new in-memory checkpointer and expect it to find old state. The checkpoint store must be the one that received the interrupt checkpoint. Do not invoke the original initial input again as if it were a new conversation; that can start new work instead of resolving the saved approval.
Pass a Command(resume=...) to the graph using the same config and thread ID. The resume value becomes the return value of interrupt() inside the approval node. Validate the reviewer’s response in your application and, where appropriate, define a typed response schema for the interrupt.
from langgraph.types import Command
config = {"configurable": {"thread_id": "approval-7421"}}
result = graph.invoke(
Command(resume={"approved": True, "reviewer": "user-18"}),
config,
)
# Inspect result or subsequent state to confirm the graph progressed.
For a rejection, send an explicit negative decision and route it to a safe stop or review path in your graph. Treat the approval decision and execution of the protected action as separate events: make the action idempotent, and record its outcome so retries do not accidentally apply it twice.
Check that the replacement worker uses the same durable checkpointer database and that the config contains the exact original thread_id. A different ID selects a different thread. If the previous deployment used InMemorySaver or MemorySaver, its state was lost when that process ended; switch to a persistent checkpointer for future approvals.
Confirm that the input is Command(resume=decision), not a plain dictionary or Command(update=...), and that it is invoked with the same thread config. Also inspect the node: because it restarts from its beginning, earlier logic may reach the interrupt again. Keep that logic deterministic and avoid changing the interrupt ordering between deployments while approvals are pending.
Review code before interrupt() and make side effects idempotent. Use an application-level operation key, such as the request ID, and have the receiving system reject duplicate execution where possible. Persist the decision and action result so a retry can determine whether the protected operation already completed.
Yes, if the interrupt checkpoint is in durable storage and the restarted worker uses that same checkpointer and thread ID. In-memory checkpoint data does not survive a process restart.
interrupt()?The resume value is returned by the interrupt call, but LangGraph reruns the containing node from its beginning. Code before the interrupt may run again, so keep it free of unsafe side effects or make those effects idempotent.
No, not when you mean to continue the same paused approval. Use the original thread ID to load its checkpoint. A new ID creates a separate thread with separate state.

Debug an n8n AI Agent tool in six checks: trace the call, test workflow output, verify inputs, and fix field mapping so useful results reach the agent.

Use this five-step MCP authentication checklist to confirm an expired login, reauthorize safely, and restore missing agent tools.
Follow these 6 steps to check a tool call, retry it safely, and prevent duplicate notifications with idempotency and delivery tracking.

Build a local Ollama workflow that generates structured SEO titles and meta descriptions in bulk, validates output, and flags results for human review.

Use this free modern real estate listing presentation PowerPoint blueprint to organize pricing, marketing, property prep, agent value, and seller next steps.

Build a printable construction job estimate template in Excel with clear labor, materials, formulas, markup, exclusions, and print-ready client totals.

Build stronger Luma Dream Machine video prompts with a practical cinematic lighting formula, reusable recipes, examples, and a fast troubleshooting checklist.

Build a minimalist tech startup investor pitch deck in PowerPoint with the right slide order, clear design rules, traction metrics, and investor-ready appendix.

Stop Excel from turning codes, IDs, and fractions into dates. Use Text format, apostrophes, import controls, and current Microsoft 365 options.

Speed up ComfyUI SDXL renders by reducing sampling work, controlling resolution and batch size, simplifying nodes, using caching, and tuning VRAM and attention safely.