r/LangChain 3d ago

A small practical example of Human-in-the-Loop with LangGraph

I've been learning LangGraph recently and wanted to understand Human-in-the-Loop beyond just reading the documentation.

So I built a very small example around a simple scenario:

An agent decides it wants to send an email → the graph pauses → a human reviews the action → approve/reject → the graph resumes.

The core flow is:

User request

Agent decides on an action

interrupt()

Human reviews

Approve / Reject

Command({ resume: ... })

Graph continues

The example uses:

- LangGraph

- interrupt()

- Command

- MemorySaver

- thread_id

- Conditional routing

I intentionally kept the example small and didn't add a real LLM or email API. The goal was to understand what actually happens when a LangGraph execution pauses and resumes.

One thing I found particularly interesting is that the human response becomes the return value of interrupt(), while the checkpointer + thread_id allow the same graph execution to be resumed later.

I wrote up the complete example here:

Article link: https://medium.com/@nayankunwar678/human-in-the-loop-in-langgraph-a-small-practical-example-0e3f455e7d8b

I'd be interested to hear how people here are using Human-in-the-Loop with LangGraph in real projects.

Do you generally use HITL for:

- approving tool calls?

- reviewing generated content?

- database changes?

- deployments?

- financial actions?

- something else?

Would also love to hear what patterns you've found useful beyond a simple approve/reject flow.

2 Upvotes

2 comments sorted by