最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - Langgraph - human in the loop, graph within graph not working - Stack Overflow

programmeradmin3浏览0评论

I have two graph, the graph "collectInfoBuilder" is inside the graph "builder". LLM used is Claude sonnet.

The workflow looks like:

collectInfoBuilder:


collectInfoBuilder = StateGraph(CollectInformationState)
collectInfoBuilder.add_node("create_analyst", create_analyst)
collectInfoBuilder.add_node("human_feedback_on_analyst", human_feedback_on_analyst)
collectInfoBuilder.add_node("forward_analyst_details", forward_analyst_details)
collectInfoBuilder.add_edge(START, "create_analyst")
collectInfoBuilder.add_edge("create_analyst", "human_feedback_on_analyst")
collectInfoBuilder.add_conditional_edges("human_feedback_on_analyst", should_continue_with_analyst,
                              {"create_analyst" : "create_analyst",
                               "forward_analyst_details": "forward_analyst_details"})
collectInfoBuilder.add_edge("forward_analyst_details", END)

builder - main graph


builder = StateGraph(BasicInformationState)
builder.add_node("get_info", get_info)
builder.add_node("human_feedback", human_feedback)
builder.add_node("forward_message", forward_message)
builder.add_node("prepare_analyst", collectInfoBuilderpile(interrupt_before=['human_feedback_on_analyst'], checkpointer=memory))
builder.add_node("print_analyst", print_analyst)

builder.add_edge(START, "get_info")
builder.add_edge("get_info", "human_feedback")
builder.add_conditional_edges("human_feedback", should_continue,
                              {"get_info" : "get_info",
                               "forward_message": "forward_message"})
builder.add_edge("forward_message", "prepare_analyst")
builder.add_edge("prepare_analyst", "print_analyst")
builder.add_edge("print_analyst", END)

graph = builderpile(interrupt_before=['human_feedback'], checkpointer=memory)

display(Image(graph.get_graph(xray=1).draw_mermaid_png()))

The workflow looks like below:

Upto the node "prepare_analyst" it works fine, generating the Analysts. But after that, the human in the loop node "human_feedback_on_analyst" does not call. The interrupt_before is triggered.

From "forward_message" to "create_analyst" it works fine. Here is the code:


for event in graph.stream(None, thread, stream_mode="values"):
    print( event.get('consolidated_message', '') )

After that what I have to do to know the next_state is "human_feedback_on_analyst" ?

发布评论

评论列表(0)

  1. 暂无评论