Skip to content

docs: fix HITL interrupt schema typos (args and camelCase for JS)#2927

Open
Ezzat Esam (EzzatEsam) wants to merge 2 commits intolangchain-ai:mainfrom
EzzatEsam:docs/fix-hitl-args
Open

docs: fix HITL interrupt schema typos (args and camelCase for JS)#2927
Ezzat Esam (EzzatEsam) wants to merge 2 commits intolangchain-ai:mainfrom
EzzatEsam:docs/fix-hitl-args

Conversation

@EzzatEsam
Copy link

Overview

This PR corrects significant discrepancies in the Human-in-the-Loop (HITL) documentation for both Python and JavaScript.

  1. Both: Corrects the key arguments to args within the tool request objects.
  2. JavaScript/TypeScript: Fixes the casing and structure of the __interrupt__ object. The documentation incorrectly used snake_case (Python-style). The actual SDK output uses camelCase.

Type of change

Type: Fix typo

Related issues/PRs

N/A

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed

Additional notes

The documentation was updated to reflect the actual runtime output of the __interrupt__ state.

Key Changes:

  • Python: Updated argumentsargs.
  • JavaScript: * Updated argumentsargs.
  • Corrected property casing: action_requestsactionRequests, review_configsreviewConfigs, action_nameactionName, and allowed_decisionsallowedDecisions.

I verified these changes by running the replication scripts provided below.

Python Replication Code
from langchain.agents import create_agent
from langchain.agents.middleware import HumanInTheLoopMiddleware
from langchain_core.tools import tool
from langgraph.checkpoint.memory import InMemorySaver
from langchain_google_genai import ChatGoogleGenerativeAI

@tool
def write_file(file_name: str, content: str) :
    """Write content to a file with the given file name and return the file path."""
    pass

agent = create_agent(
    model=ChatGoogleGenerativeAI(model="gemini-3-flash-preview", temperature=1),
    tools=[write_file],
    middleware=[
        HumanInTheLoopMiddleware(
            interrupt_on={"write_file": True},
            description_prefix="Tool execution pending approval",
        ),
    ],
    checkpointer=InMemorySaver(),
)

config = {"configurable": {"thread_id": "some_id"}}
result = agent.invoke(
    {"messages": [{"role": "user", "content": "Create a file named 'test.txt' with the content 'Hello, World!'"}]},
    config=config 
)

# Output confirmed to use 'args'
print(result['__interrupt__'])
JavaScript/TypeScript Replication Code
import "dotenv/config";
import { createAgent, humanInTheLoopMiddleware, HumanMessage } from "langchain";
import { MemorySaver } from "@langchain/langgraph";
import * as z from "zod";
import { tool } from "langchain";
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";

const writeFileTool = tool(({ fileName, content }) => {}, {
  name: "write_file",
  description: "Write content to a file.",
  schema: z.object({
    fileName: z.string().describe("Name of the file to write to"),
    content: z.string().describe("Content to write into the file"),
  }),
});

const agent = createAgent({
  model: new ChatGoogleGenerativeAI("gemini-3-flash-preview"),
  tools: [writeFileTool],
  middleware: [
    humanInTheLoopMiddleware({
      interruptOn: { write_file: true },
      descriptionPrefix: "Tool execution pending approval",
    }),
  ],
  checkpointer: new MemorySaver(),
});

const config = { configurable: { thread_id: "some_id" } };

const result = await agent.invoke(
  {
    messages: [new HumanMessage("Create a file named 'test.txt' with the content 'Hello, World!'")],
  },
  config,
);

// Output confirmed to use camelCase (actionRequests, etc.) and 'args'
console.log(JSON.stringify(result.__interrupt__, null, 2));

@github-actions github-actions bot added external User is not a member of langchain-ai langchain For docs changes to LangChain oss labels Mar 4, 2026
@EzzatEsam Ezzat Esam (EzzatEsam) changed the title Docs/fix hitl args docs: fix HITL interrupt schema typos (args and camelCase for JS) Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant