[PR #218] [MERGED] fix(deepagents): pass on subagent name #220

Closed
opened 2026-02-16 06:17:28 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/218
Author: @christian-bromann
Created: 2/10/2026
Status: Merged
Merged: 2/11/2026
Merged by: @christian-bromann

Base: mainHead: cb/subagent-context


📝 Commits (4)

📊 Changes

6 files changed (+537 additions, -416 deletions)

View changed files

.changeset/quiet-doors-yawn.md (+5 -0)
📝 libs/deepagents/package.json (+6 -6)
📝 libs/deepagents/src/middleware/subagents.int.test.ts (+62 -1)
📝 libs/deepagents/src/middleware/subagents.ts (+2 -0)
📝 package.json (+6 -6)
📝 pnpm-lock.yaml (+456 -403)

📄 Description

Summary

  • Pass name to createAgent() when creating subagents, matching the Python implementation. This causes LangGraph to automatically set lc_agent_name in config.metadata during tool execution, enabling tools to identify which agent invoked them.
  • Add an integration test that verifies config.metadata.lc_agent_name is correctly propagated to tools running inside a named subagent.

Motivation

Users building hierarchical agent systems reported that they couldn't identify which subagent invoked a shared tool, and couldn't pass agent-specific configuration to subagents. The root cause was that the JS getSubagents() function wasn't passing the name parameter to createAgent() — unlike the Python version which does (create_agent(..., name=agent_["name"])). Without this, lc_agent_name was never set in metadata.


🔄 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/deepagentsjs/pull/218 **Author:** [@christian-bromann](https://github.com/christian-bromann) **Created:** 2/10/2026 **Status:** ✅ Merged **Merged:** 2/11/2026 **Merged by:** [@christian-bromann](https://github.com/christian-bromann) **Base:** `main` ← **Head:** `cb/subagent-context` --- ### 📝 Commits (4) - [`6fa03e8`](https://github.com/langchain-ai/deepagentsjs/commit/6fa03e871e834f530fa862d15e48e2e27e4c9cbf) fix(deepagents): pass on subagent name - [`8f81828`](https://github.com/langchain-ai/deepagentsjs/commit/8f818281a3c895dbe61a350dcea8a9471198abf9) Add changeset for deepagents patch - [`fd6be56`](https://github.com/langchain-ai/deepagentsjs/commit/fd6be56a08cc02b2c465992d3cac75d1f1de270a) update deps - [`4ac805b`](https://github.com/langchain-ai/deepagentsjs/commit/4ac805b277c78ac1d3659c346bde30bb0e01901f) format ### 📊 Changes **6 files changed** (+537 additions, -416 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/quiet-doors-yawn.md` (+5 -0) 📝 `libs/deepagents/package.json` (+6 -6) 📝 `libs/deepagents/src/middleware/subagents.int.test.ts` (+62 -1) 📝 `libs/deepagents/src/middleware/subagents.ts` (+2 -0) 📝 `package.json` (+6 -6) 📝 `pnpm-lock.yaml` (+456 -403) </details> ### 📄 Description ## Summary - Pass `name` to `createAgent()` when creating subagents, matching the Python implementation. This causes LangGraph to automatically set `lc_agent_name` in `config.metadata` during tool execution, enabling tools to identify which agent invoked them. - Add an integration test that verifies `config.metadata.lc_agent_name` is correctly propagated to tools running inside a named subagent. ## Motivation Users building hierarchical agent systems reported that they couldn't identify which subagent invoked a shared tool, and couldn't pass agent-specific configuration to subagents. The root cause was that the JS `getSubagents()` function wasn't passing the `name` parameter to `createAgent()` — unlike the Python version which does (`create_agent(..., name=agent_["name"])`). Without this, `lc_agent_name` was never set in metadata. --- <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-02-16 06:17:28 -05:00
yindo closed this issue 2026-02-16 06:17:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#220