fix(deepagents): add parent_tool_call_id to subagent streaming metadata#1136
Open
Yo-sure wants to merge 3 commits intolangchain-ai:mainfrom
Open
fix(deepagents): add parent_tool_call_id to subagent streaming metadata#1136Yo-sure wants to merge 3 commits intolangchain-ai:mainfrom
Yo-sure wants to merge 3 commits intolangchain-ai:mainfrom
Conversation
Closes langchain-ai#876 When streaming with subgraphs=True, subagent chunks now include parent_tool_call_id in metadata, allowing clients to correlate streaming chunks with their originating task tool calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #876
When streaming with
subgraphs=True, parallel subagent chunks now includeparent_tool_call_idin metadata, allowing clients to correlate streaming chunks with their originating task tool calls.Problem
When multiple
tasktool calls are made in parallel, streaming chunks from different subagents arrive interleaved. Previously, clients had no way to correlate which chunks belonged to which task invocation.Solution
_build_subagent_config()helper that merges the subagent's identity config (e.g.,lc_agent_name) withparent_tool_call_idmetadatatask()andatask()now pass this config tosubagent.invoke()/ainvoke()merge_configsfromlangchain_coreto preserve existing config propagationExample
Test plan
test_parent_tool_call_id_in_streaming_metadata- single subagent casetest_parallel_subagents_streaming_correlation- parallel subagents case (core scenario)lc_agent_name,tags)parent_tool_call_id