human-in-the-loop

human-in-the-loop is an agent for coding agents from langchain-ai/langgraphjs. It costs 0 tokens per session (1,186 once invoked), scanned A, original, MIT.

A way to pause an AI agent until a person reviews, edits, or approves a tool call. LangGraph is a framework for building workflows with language-model agents, and it can save the paused workflow for later.

In plain words
What is it for?
Use it to add approval steps to actions such as booking, sending, changing, or otherwise executing tools in a LangGraph agent.
Why use it?
It keeps an agent from carrying out sensitive actions without human permission and lets work continue after a delayed decision.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/langchain-ai/langgraphjs/human-in-the-loop
Clone the repo
git clone --depth 1 https://github.com/langchain-ai/langgraphjs

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for human-in-the-loop

README.md
[![agentmods](https://agentmods.dev/badge/agents/langchain-ai/langgraphjs/human-in-the-loop.svg)](https://agentmods.dev/agents/langchain-ai/langgraphjs/human-in-the-loop)
Your own site
<a href="https://agentmods.dev/agents/langchain-ai/langgraphjs/human-in-the-loop"><img src="https://agentmods.dev/badge/agents/langchain-ai/langgraphjs/human-in-the-loop.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,186 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01186
Opus 5 $0.00000 $0.00593
Sonnet 5 $0.00000 $0.00237
Haiku 4.5 $0.00000 $0.00119

Measured 4d ago against content hash 862d0a37dbeb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

human-in-the-loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/docs/agents/human-in-the-loop.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Human-in-the-loop

To review, edit and approve tool calls in an agent you can use LangGraph's built-in human-in-the-loop features, specifically the interrupt() primitive.

LangGraph allows you to pause execution indefinitely — for minutes, hours, or even days—until human input is received.

This is possible because the agent state is checkpointed into a database, which allows the system to persist execution context and later resume the workflow, continuing from where it left off.

For a deeper dive into the human-in-the-loop concept, see the concept guide.

Review tool calls

To add a human approval step to a tool:

  1. Use interrupt() in the tool to pause execution.
  2. Resume with a Command({ resume: ... }) to continue based on human input.
import { MemorySaver } from "@langchain/langgraph-checkpoint";
import { interrupt } from "@langchain/langgraph";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { initChatModel } from "langchain/chat_models/universal";
import { tool } from "@langchain/core/tools";
import { z } from "zod";

// An example of a sensitive tool that requires human review / approval
const bookHotel = tool(
  async (input: { hotelName: string; }) => {
    let hotelName = input.hotelName;
    // highlight-next-line
    const response = interrupt(  // (1)!
      `Trying to call \`book_hotel\` with args {'hotel_name': ${hotelName}}. ` +
      `Please approve or suggest edits.`
    )
    if (response.type === "accept") {
      // proceed to execute the tool logic
    } else if (response.type === "edit") {
        hotelName = response.args["hotel_name"]
    } else {
        throw new Error(`Unknown response type: ${response.type}`)
    }
    return `Successfully booked a stay at ${hotelName}.`;
  },
  {
    name: "bookHotel",
    schema: z.object({
      hotelName: z.string().describe("Hotel to book"),
    }),
    description: "Book a hotel.",
  }
);

// highlight-next-line
const checkpointer = new MemorySaver();  // (2)!

const llm = await initChatModel("anthropic:claude-3-7-sonnet-latest");
const agent = createReactAgent({
  llm,
  tools: [bookHotel],
  // highlight-next-line
  checkpointer  // (3)!
});

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 119 lines · 0 tokens per session scan A 862d0a37dbeb

Subscribe to this mod's changes

human-in-the-loop is an agent published in the GitHub repository langchain-ai/langgraphjs (3,249 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,186 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.