[PR #2927] [MERGED] docs: fix HITL interrupt schema typos (args and camelCase for JS) #3012

Closed
opened 2026-06-05 18:20:46 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2927
Author: @EzzatEsam
Created: 3/4/2026
Status: Merged
Merged: 5/28/2026
Merged by: @npentrel

Base: mainHead: docs/fix-hitl-args


📝 Commits (2)

  • 53eaf01 fix: Rename 'arguments' to 'args' in action requests
  • e2a540e fix: Rename keys in action requests and review configs in the JS version

📊 Changes

1 file changed (+4 additions, -4 deletions)

View changed files

📝 src/oss/langchain/human-in-the-loop.mdx (+4 -4)

📄 Description

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));


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/2927 **Author:** [@EzzatEsam](https://github.com/EzzatEsam) **Created:** 3/4/2026 **Status:** ✅ Merged **Merged:** 5/28/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `docs/fix-hitl-args` --- ### 📝 Commits (2) - [`53eaf01`](https://github.com/langchain-ai/docs/commit/53eaf01da3c63b9074fefe9b6894a333ccb9ed16) fix: Rename 'arguments' to 'args' in action requests - [`e2a540e`](https://github.com/langchain-ai/docs/commit/e2a540ee770127dd3ef7141045ed208215d85799) fix: Rename keys in action requests and review configs in the JS version ### 📊 Changes **1 file changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/human-in-the-loop.mdx` (+4 -4) </details> ### 📄 Description ## 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 * [x] I have read the [contributing guidelines](README.md) * [x] I have tested my changes locally using `docs dev` * [x] All code examples have been tested and work correctly * [x] I have used **root relative** paths for internal links * [x] 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 `arguments` → `args`. * **JavaScript:** * Updated `arguments` → `args`. * Corrected property casing: `action_requests` → `actionRequests`, `review_configs` → `reviewConfigs`, `action_name` → `actionName`, and `allowed_decisions` → `allowedDecisions`. I verified these changes by running the replication scripts provided below. <details> <summary><b>Python Replication Code</b></summary> ```python 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__']) ``` </details> <details> <summary><b>JavaScript/TypeScript Replication Code</b></summary> ```javascript 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)); ``` </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:20:46 -04:00
yindo closed this issue 2026-06-05 18:20:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#3012