Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

LangGraph HITL Tutorial Links interrupt and useStream for Human Approval

AI summary

A Juejin AI tutorial shows a minimal human-in-the-loop workflow in LangGraph, with the backend using interrupt to request approval before a search tool runs and the frontend using useStream to display the question and return a response. The frontend response becomes the interrupt return value, allowing the graph to resume along an approved or canceled branch. The article also notes that the function containing an interrupt runs again after confirmation.

In-depth insight

The tutorial provides a concrete implementation pattern for adding human approval to LangGraph agent workflows before consequential tool actions execute.

image.png

Human-in-the-loop(HITL)是 Agent 落地时绕不开的一环:模型能自己跑,但关键动作得让人点个头。LangGraph 把这套机制做成了 interrupt + useStream 的组合,后端抛问题、前端答问题,流程自动恢复。下面用一个“搜索前审批”的例子,把用法讲清楚。

一、后端:用 interrupt 把问题抛出去

python

queries = [state["messages"][-1].tool_calls.get("query") for call in calls]
approved = interrupt({
    "question": "模型想搜索以下内容,是否允许?",
    "queries": queries,
})

三件事值得注意:

#LangGraph#interrupt#useStream

Original · 2 min readRead the original
Group chat

No comments yet. Start the conversation.