Skip to content

Prompt for human feedback in LangGraph HITL sample#324

Open
DABH wants to merge 2 commits into
mainfrom
langgraph-hitl-interactive-feedback
Open

Prompt for human feedback in LangGraph HITL sample#324
DABH wants to merge 2 commits into
mainfrom
langgraph-hitl-interactive-feedback

Conversation

@DABH

@DABH DABH commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

The graph_api human-in-the-loop chatbot sample didn't actually involve a human when you ran it — it auto-approved the draft via signal and returned a hardcoded placeholder response. This change makes the sample live up to its name:

  • Real draft generation: generate_draft now calls an LLM (claude-sonnet-4-6) instead of returning a canned string.
  • Interactive review: run_workflow.py prompts at the terminal for approve or revision feedback, then signals the workflow.
  • LLM-based revision: on revision feedback, human_review regenerates the draft with the LLM incorporating the reviewer's notes.
  • Updated the README to describe the new interactive flow.
  • Updated tests to mock the chat model so they remain deterministic and offline.

Test plan

  • uv run --group langgraph pytest tests/langgraph_plugin/human_in_the_loop_test.py passes
  • ruff check --select I and ruff format --check pass
  • mypy passes on changed files
  • Manually run worker + workflow and confirm the terminal prompt appears and revision feedback reshapes the draft

The graph_api human-in-the-loop sample previously auto-approved the draft
and used a hardcoded placeholder response, so running it didn't actually
involve a human. Now the draft is generated by an LLM, the runner prompts
interactively at the terminal for approval or revision feedback, and the
review node revises the draft with the LLM based on that feedback.

Tests mock the chat model so they stay deterministic and offline.
@DABH DABH requested review from a team as code owners June 29, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant