Video summary

Human in the loop (HITL) using LangGraph | CampusX

Main summary

Key takeaways

Educational

Summary

Nitesh introduces Human-in-the-Loop (HITL) for agentic AI systems and demonstrates how to implement it in LangGraph. HITL adds human checkpoints at important points in an AI workflow, allowing a person to supervise, approve, correct, or guide the system.

Why Agentic AI Needs Human Oversight

AI agents can automate repetitive tasks, such as answering routine customer-support questions. However, they can misinterpret requests, hallucinate, or make mistakes when judgment is required. For example, “book tickets for next Friday” could mean either the upcoming Friday or the following Friday. An agent should clarify rather than guess.

HITL also supports accountability. Since an AI system cannot take responsibility for harmful actions, humans should confirm consequential decisions—such as sending an important email or making a payment—before they happen.

Benefits of HITL

  • Improves accuracy: A person can catch errors, such as an incorrectly read invoice amount, before a payment is made.
  • Improves safety: A human can review potentially destructive actions, such as deleting files that may still be needed.
  • Supports ethical and organizational alignment: A person can adjust an AI-generated response to better reflect company values or show appropriate empathy.
  • Builds a better user experience: Combining AI speed with human judgment can make systems more reliable and trustworthy.

Common HITL Patterns

  1. Action approval: Pause before consequential actions—such as purchases, payments, important emails, or file deletion—and proceed only if a human approves.
  2. Output review or editing: Let a human review or refine generated content, such as a blog draft, before it is published.
  3. Ambiguity clarification: Ask the user to resolve unclear instructions instead of making an uncertain assumption.
  4. Escalation to a human: Transfer a case to a human agent when the AI cannot handle it, as may happen in customer support.

HITL in LangGraph

The LangGraph implementation centers on interrupting a running workflow and resuming it after receiving human input.

In the social-media-agent example, the graph researches a topic and drafts a tweet. Before posting, it pauses to request approval. The flow works as follows:

  1. The front end submits a topic and invokes the graph.
  2. The graph researches the topic and creates a draft.
  3. The posting node calls interrupt to pause execution and send an approval request to the front end.
  4. A checkpointer saves the graph’s current state so it can continue later. The saved state is associated with a thread ID.
  5. The front end displays the request and collects the human’s decision.
  6. The front end invokes the graph again, passing the decision through a command with a resume value.
  7. LangGraph restores the saved state and continues from the interrupted point. It proceeds with the action if approved or rejects it otherwise.

The key concepts are interrupts, checkpointing, and command-based resumption. Unlike a normal workflow that may be invoked once, an interrupted HITL workflow is invoked again when human input is ready.

Code Examples

  • Simple approval workflow: A user submits a question for an LLM. The graph interrupts to ask whether the question should be sent to the model. If the user declines, it returns a not-approved response; if approved, it invokes the LLM. This simple example demonstrates the pause-and-resume mechanics.
  • Stock chatbot: A chatbot can check stock prices and use a tool to purchase shares. Without HITL, it could place an order without confirmation. With HITL, the purchase tool interrupts to ask whether to buy a specified number of shares in a specified company. The user’s yes-or-no response is passed back through a command, and the tool either completes or declines the purchase.

Speakers and Sources

  • Nitesh: The video’s presenter and instructor.
  • Examples mentioned: Customer-support services, Google/Gmail email replies, flight booking, invoices and payments, file deletion, social-media publishing, and stock purchasing. These are illustrative examples, not additional speakers.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video