[PR #326] [MERGED] chore(sdk): unify sync subagents and async subagents into a single property #361

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/326
Author: @colifran
Created: 3/19/2026
Status: Merged
Merged: 3/20/2026
Merged by: @colifran

Base: mainHead: colifran/async-subagent-ux


📝 Commits (10+)

  • a5f2e60 launch tool, check tool
  • f040022 update tool and cancel tool
  • 06aa13b update and cancel tool tests
  • b1cf9b1 list async subagent jobs tool
  • 9cad384 list subagent jobs tool and create middleware
  • 8fadd45 wire in async subagents
  • f1d86f5 create and use state schema, update message to messages
  • a285e30 tests
  • a9be9fc AsyncSubagent -> AsyncSubAgent
  • 2d86040 fix import

📊 Changes

6 files changed (+65 additions, -51 deletions)

View changed files

.changeset/curvy-donkeys-walk.md (+5 -0)
📝 libs/deepagents/src/agent.ts (+16 -4)
📝 libs/deepagents/src/index.ts (+2 -0)
📝 libs/deepagents/src/middleware/async_subagents.ts (+14 -0)
📝 libs/deepagents/src/middleware/index.ts (+1 -0)
📝 libs/deepagents/src/types.ts (+27 -47)

📄 Description

Summary

Unifies the subagents and asyncSubAgents params on createDeepAgent into a single subagents array. Previously, sync and async subagents had to be passed separately. Now both go in the same array and are split at runtime using the isAsyncSubAgent type guard, which checks for the presence of graphId. The standalone middleware functions (createSubAgentMiddleware, createAsyncSubAgentMiddleware) are unchanged. This only affects the createDeepAgent convenience API.

Changes

  • Add AnySubAgent type alias (SubAgent | CompiledSubAgent | AsyncSubAgent) and isAsyncSubAgent type guard
  • Widen TSubagents generic bound to readonly AnySubAgent[]
  • Remove asyncSubAgents param from CreateDeepAgentParams
  • Split the unified array at runtime in createDeepAgent, passing sync subagents to createSubAgentMiddleware and async subagents to createAsyncSubAgentMiddleware
  • Export AnySubAgent and isAsyncSubAgent from package index

Example

// Before
createDeepAgent({
  subagents: [syncAgent],
  asyncSubAgents: [asyncAgent],
})

// After
createDeepAgent({
  subagents: [syncAgent, asyncAgent],
})

---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/326 **Author:** [@colifran](https://github.com/colifran) **Created:** 3/19/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@colifran](https://github.com/colifran) **Base:** `main` ← **Head:** `colifran/async-subagent-ux` --- ### 📝 Commits (10+) - [`a5f2e60`](https://github.com/langchain-ai/deepagentsjs/commit/a5f2e6085c07f88a9b9469f303739a08f64e201f) launch tool, check tool - [`f040022`](https://github.com/langchain-ai/deepagentsjs/commit/f0400220ba4788afddf3506215cb54ec79e7ea98) update tool and cancel tool - [`06aa13b`](https://github.com/langchain-ai/deepagentsjs/commit/06aa13b7eb6cdb466bdbfcb5b1bf026c4ca627ae) update and cancel tool tests - [`b1cf9b1`](https://github.com/langchain-ai/deepagentsjs/commit/b1cf9b1bec22a71dc75d21648b3bafdfce8f719a) list async subagent jobs tool - [`9cad384`](https://github.com/langchain-ai/deepagentsjs/commit/9cad38421449b646912383d531ee454804064ac4) list subagent jobs tool and create middleware - [`8fadd45`](https://github.com/langchain-ai/deepagentsjs/commit/8fadd4512528bd00d615c7805d5a543fc95b8064) wire in async subagents - [`f1d86f5`](https://github.com/langchain-ai/deepagentsjs/commit/f1d86f5256b1d7f575fcb4ef071e3fc28ad5382f) create and use state schema, update message to messages - [`a285e30`](https://github.com/langchain-ai/deepagentsjs/commit/a285e304f911743588d67a0724ffef9522aef5e7) tests - [`a9be9fc`](https://github.com/langchain-ai/deepagentsjs/commit/a9be9fc36cacff537504cdcf18744335d8d0ab45) AsyncSubagent -> AsyncSubAgent - [`2d86040`](https://github.com/langchain-ai/deepagentsjs/commit/2d860403ac1ecc497fef34c05f12c01ad031f5cc) fix import ### 📊 Changes **6 files changed** (+65 additions, -51 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/curvy-donkeys-walk.md` (+5 -0) 📝 `libs/deepagents/src/agent.ts` (+16 -4) 📝 `libs/deepagents/src/index.ts` (+2 -0) 📝 `libs/deepagents/src/middleware/async_subagents.ts` (+14 -0) 📝 `libs/deepagents/src/middleware/index.ts` (+1 -0) 📝 `libs/deepagents/src/types.ts` (+27 -47) </details> ### 📄 Description ### Summary Unifies the `subagents` and `asyncSubAgents` params on `createDeepAgent` into a single `subagents` array. Previously, sync and async subagents had to be passed separately. Now both go in the same array and are split at runtime using the `isAsyncSubAgent` type guard, which checks for the presence of `graphId`. The standalone middleware functions (`createSubAgentMiddleware`, `createAsyncSubAgentMiddleware`) are unchanged. This only affects the `createDeepAgent` convenience API. #### Changes - Add `AnySubAgent` type alias (`SubAgent | CompiledSubAgent | AsyncSubAgent`) and `isAsyncSubAgent` type guard - Widen `TSubagents` generic bound to `readonly AnySubAgent[]` - Remove `asyncSubAgents` param from `CreateDeepAgentParams` - Split the unified array at runtime in `createDeepAgent`, passing sync subagents to `createSubAgentMiddleware` and async subagents to `createAsyncSubAgentMiddleware` - Export `AnySubAgent` and `isAsyncSubAgent` from package index #### Example ```ts // Before createDeepAgent({ subagents: [syncAgent], asyncSubAgents: [asyncAgent], }) // After createDeepAgent({ subagents: [syncAgent, asyncAgent], }) --- <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:22:48 -04:00
yindo closed this issue 2026-06-05 17:22:49 -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#361