[PR #566] [MERGED] fix(deepagents): propagate subagent lc_agent_name for delegated tasks #563

Closed
opened 2026-06-05 17:23:45 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/566
Author: @hntrl
Created: 6/1/2026
Status: Merged
Merged: 6/1/2026
Merged by: @hntrl

Base: mainHead: hunter/bump-langsmith-dep


📝 Commits (2)

  • 2925daf chore(deepagents): bump langsmith sdk version
  • 9fa68d8 fix(deepagents): propagate subagent lc_agent_name for delegated tasks

📊 Changes

5 files changed (+215 additions, -3 deletions)

View changed files

.changeset/subagent-agent-name-metadata.md (+9 -0)
📝 libs/deepagents/package.json (+1 -1)
📝 libs/deepagents/src/middleware/subagent.test.ts (+169 -0)
📝 libs/deepagents/src/middleware/subagents.ts (+4 -0)
📝 pnpm-lock.yaml (+32 -2)

📄 Description

Summary

Fixes #206.

This updates deepagents subagent delegation so tool executions can reliably identify the active subagent via config.metadata.lc_agent_name instead of inheriting the parent agent name. It also adds focused regression tests that validate both compiled subagents and standard subagent specs follow the same metadata behavior.

Changes

libs/deepagents subagent metadata propagation

  • Updated createTaskTool subagent invocation config to explicitly set:
    • metadata.lc_agent_name = subagent_type
    • existing configurable.ls_agent_type = "subagent" behavior remains unchanged
  • Added new regression coverage in subagent.test.ts:
    • compiled subagent (runnable) path
    • standard subagent spec (systemPrompt/tools/model) path
  • Tests assert tool-time metadata receives the delegated subagent name (worker), preventing parent-name leakage.

libs/deepagents dependency range update

  • Bumped langsmith peer dependency range in libs/deepagents/package.json from >=0.6.0 <1.0.0 to ^0.7.1.
  • Updated pnpm-lock.yaml accordingly.

🔄 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/566 **Author:** [@hntrl](https://github.com/hntrl) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@hntrl](https://github.com/hntrl) **Base:** `main` ← **Head:** `hunter/bump-langsmith-dep` --- ### 📝 Commits (2) - [`2925daf`](https://github.com/langchain-ai/deepagentsjs/commit/2925daf489aae0715573888c7760f723f50949ad) chore(deepagents): bump langsmith sdk version - [`9fa68d8`](https://github.com/langchain-ai/deepagentsjs/commit/9fa68d8ebd9d07a1f7fc7ef03ca433542e7e56f2) fix(deepagents): propagate subagent lc_agent_name for delegated tasks ### 📊 Changes **5 files changed** (+215 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/subagent-agent-name-metadata.md` (+9 -0) 📝 `libs/deepagents/package.json` (+1 -1) 📝 `libs/deepagents/src/middleware/subagent.test.ts` (+169 -0) 📝 `libs/deepagents/src/middleware/subagents.ts` (+4 -0) 📝 `pnpm-lock.yaml` (+32 -2) </details> ### 📄 Description ## Summary Fixes #206. This updates deepagents subagent delegation so tool executions can reliably identify the active subagent via `config.metadata.lc_agent_name` instead of inheriting the parent agent name. It also adds focused regression tests that validate both compiled subagents and standard subagent specs follow the same metadata behavior. ## Changes ### `libs/deepagents` subagent metadata propagation - Updated `createTaskTool` subagent invocation config to explicitly set: - `metadata.lc_agent_name = subagent_type` - existing `configurable.ls_agent_type = "subagent"` behavior remains unchanged - Added new regression coverage in `subagent.test.ts`: - compiled subagent (`runnable`) path - standard subagent spec (`systemPrompt/tools/model`) path - Tests assert tool-time metadata receives the delegated subagent name (`worker`), preventing parent-name leakage. ### `libs/deepagents` dependency range update - Bumped `langsmith` peer dependency range in `libs/deepagents/package.json` from `>=0.6.0 <1.0.0` to `^0.7.1`. - Updated `pnpm-lock.yaml` accordingly. --- <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 17:23:45 -04:00
yindo closed this issue 2026-06-05 17:23:46 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#563