Stop Writing If/Else to Handle Human Replies in LangGraph
Last Updated on October 6, 2026 by Editorial Team
Author(s): Nachiket Mehendale
Originally published on Towards AI.
Replace hand-written validation with response_schema in interrupt()
LangGraph is a Python library for building program that runs in steps. Each step is a node. Nodes are connected in a graph and share data through the state.

The article explains why handling human replies with manual if/else validation is fragile and repetitive, then shows how LangGraph’s optional response_schema argument for interrupt() enables automatic validation and structured replies. It details how response_schema uses JSON Schema/Pydantic to validate types (e.g., a boolean approved and optional text note) before the node continues, and notes how invalid replies keep the graph paused until the user provides a valid response. The post walks through setup requirements, a sample refund workflow (schema, state, node, graph, and resume loop), and demonstrates behavior across multiple tests (accepting valid variations like “yes”, rejecting invalid values like “Maybe”), along with key considerations such as state persistence (InMemorySaver) and practical production guidance. It concludes with common use cases for response_schema, including approval workflows, multiple interrupts, review/edit, tool-call interruption validation, and streaming human-in-the-loop interactions.
Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.
Published via Towards AI
Towards AI Academy
We Build Enterprise-Grade AI. We'll Teach You to Master It Too.
15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.
Start free — no commitment:
→ 6-Day Agentic AI Engineering Email Guide — one practical lesson per day
→ Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.
→ Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate, and apply AI for complex work tasks.
Note: Article content contains the views of the contributing authors and not Towards AI.