Skip to content

Conversation

nhuang-lc
Copy link
Contributor

  • Description: Adds before_agent hook to HITL middleware that will append ToolMessages for any dangling ToolCall from an AIMessage. This can happen when a new message comes in on a previously interrupted thread.

@github-actions github-actions bot added feature langchain Related to the package `langchain` v1 Issue specific to LangChain 1.0 labels Oct 15, 2025

patched_messages = []
# Iterate over the messages and add any dangling tool calls
for i, msg in enumerate(messages):
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to only check the last AIMessage? I have a helper for finding the last AI message + any tool messages after the fact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature langchain Related to the package `langchain` v1 Issue specific to LangChain 1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants