Skip to content

Conversation

eyurtsev
Copy link
Collaborator

@eyurtsev eyurtsev commented Sep 26, 2025

Overview

  • Add human in the loop page
  • Link from middleware

Outstanding:

  • Update code snippets
  • Update comments in code snippets
  • Figure out how to consolidate the page structurally (response types is in a few different places).
  • Add link to reference for HumanInTheLoopMiddleware (we can't do this right now - no reference)
  • Explain message prefix

Type of change

New documentation page

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
  • I have gotten approval from the relevant reviewers
  • (Internal team members only / optional) I have created a preview deployment using the Create Preview Branch workflow

Additional notes

Copy link

Preview ID generated: preview-eugene-1758914338-69fe33e

@eyurtsev eyurtsev force-pushed the eugene/human-in-the-loop branch from cfa130b to a044f96 Compare September 26, 2025 19:24
Copy link

Preview ID generated: preview-eugene-1758914717-5b68b8a

@eyurtsev eyurtsev changed the title human-in-the-loop (wip) human-in-the-loop Sep 26, 2025
@eyurtsev eyurtsev marked this pull request as ready for review September 26, 2025 19:26
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 19:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive human-in-the-loop documentation page for LangChain, moving detailed middleware documentation from a general middleware page to a dedicated page focused on human oversight capabilities.

  • Replaces extensive human-in-the-loop middleware documentation with a brief summary and link to the new dedicated page
  • Creates a new detailed human-in-the-loop documentation page with comprehensive examples and configuration details
  • Updates link mapping to correct the interrupt reference

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/oss/langchain/middleware.mdx Condenses human-in-the-loop section to summary with link to dedicated page
src/oss/langchain/human-in-the-loop.mdx Creates comprehensive documentation page covering middleware configuration, interrupt handling, and response types
pipeline/preprocessors/link_map.py Corrects link reference for interrupt function to use lowercase
Comments suppressed due to low confidence (1)

src/oss/langchain/human-in-the-loop.mdx:1

  • This documentation link creates a circular reference since it's on the human-in-the-loop page itself. This appears to be copied from the middleware.mdx file and should be removed or replaced with appropriate content for this page.
---

@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 19:32
Copy link

Preview ID generated: preview-eugene-1758915174-ff34a81

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment on lines +108 to +111
You must configure a checkpointer to persist the graph state across interrupts.
In production, use a persistent checkpointer like @[AsyncPostgresSaver]. For testing or prototyping, use @[InMemorySaver].
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference '@[AsyncPostgresSaver]' appears to have a typo - it should be 'AsyncPostgresSaver' (with 'Postgres' not 'Postgress').

Copilot uses AI. Check for mistakes.

@eyurtsev eyurtsev force-pushed the eugene/human-in-the-loop branch from 82ae034 to eb6b085 Compare September 26, 2025 19:39
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 19:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Copy link

Preview ID generated: preview-eugene-1758915627-c75f251

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 19:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

}),
],
// Human-in-the-loop requires checkpointing to handle interrupts.
// In production, use a persistent checkpointer like AsyncPostgresSaver.
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in 'AsyncPostgressSaver'. It should be 'AsyncPostgresSaver' (with an 'e' after 'Postgr').

Suggested change
// In production, use a persistent checkpointer like AsyncPostgresSaver.
// In production, use a persistent checkpointer like AsyncPostgresSaver.

Copilot uses AI. Check for mistakes.

Copy link

Preview ID generated: preview-eugene-1758916208-c2ce9f6

Copy link
Collaborator

@lnhsingh lnhsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nits

| ✏️ `edit` | The tool call is executed with modifications. | Change the recipient before sending an email |
|`respond` | The tool call is rejected, with an explanation added to the conversation. | Reject an email draft and explain how to rewrite it |

<Note>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be in a note callout

:::


<Important>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be <Warning> -- we don't have an Important callout

Co-authored-by: Lauren Hirata Singh <lauren@langchain.dev>
@Copilot Copilot AI review requested due to automatic review settings September 29, 2025 13:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


<Important>
You must configure a checkpointer to persist the graph state across interrupts.
In production, use a persistent checkpointer like @[AsyncPostgresSaver]. For testing or prototyping, use @[InMemorySaver].
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @[AsyncPostgresSaver] and @[InMemorySaver] use the same custom link notation that may not render correctly. Consider using standard markdown links or verifying this notation is supported.

Suggested change
In production, use a persistent checkpointer like @[AsyncPostgresSaver]. For testing or prototyping, use @[InMemorySaver].
In production, use a persistent checkpointer like `AsyncPostgresSaver`. For testing or prototyping, use `InMemorySaver`.

Copilot uses AI. Check for mistakes.

Comment on lines +360 to +362
3. If any calls require human input, the middleware builds a list of `HumanInterrupt` objects and calls @[interrupt].
4. The agent waits for human responses.
5. Based on responses, the middleware executes approved or edited calls, synthesizes @[ToolMessage]'s for rejected calls, and resumes execution.
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @[interrupt] and @[ToolMessage] custom link notations are inconsistent with standard markdown linking. Consider using proper markdown links or verify the custom notation is supported throughout the documentation system.

Copilot uses AI. Check for mistakes.


## Custom HITL logic

For more specialized workflows, you can build custom HITL logic directly using the @[interrupt] primitive and [middleware](/oss/langchain/middleware) abstraction.
Copy link
Preview

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed usage of @[interrupt] custom notation and standard markdown link [middleware](/oss/langchain/middleware) in the same sentence creates inconsistency. Consider standardizing the link format throughout the document.

Suggested change
For more specialized workflows, you can build custom HITL logic directly using the @[interrupt] primitive and [middleware](/oss/langchain/middleware) abstraction.
For more specialized workflows, you can build custom HITL logic directly using the [interrupt](/oss/langchain/interrupt) primitive and [middleware](/oss/langchain/middleware) abstraction.

Copilot uses AI. Check for mistakes.

Copy link

Preview ID generated: preview-eugene-1759153626-dd7e685

Copy link

Preview ID generated: preview-eugene-1759154154-4ec77fe

@eyurtsev eyurtsev merged commit 3c78d86 into main Sep 29, 2025
14 of 15 checks passed
@eyurtsev eyurtsev deleted the eugene/human-in-the-loop branch September 29, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-infra langchain For docs changes to LangChain oss python For content related to the Python version of LangChain projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants