[PR #222] [MERGED] fix(deepagents): unwrap responseFormat strategy types so structuredResponse is correctly typed #222

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/222
Author: @christian-bromann
Created: 2/11/2026
Status: Merged
Merged: 2/12/2026
Merged by: @christian-bromann

Base: mainHead: cb/structured-response-fix


📝 Commits (6)

  • e9edf34 fix(deepagents): unwrap responseFormat strategy types so structuredResponse is correctly typed
  • 57657c9 format
  • c226cc6 Create stale-planes-breathe.md
  • 84220d7 improve tests
  • a741aaa update deps
  • aa027ef add type tests

📊 Changes

10 files changed (+686 additions, -568 deletions)

View changed files

.changeset/stale-planes-breathe.md (+5 -0)
📝 examples/package.json (+6 -6)
📝 libs/deepagents/package.json (+2 -2)
📝 libs/deepagents/src/agent.int.test.ts (+197 -2)
📝 libs/deepagents/src/agent.test-d.ts (+49 -0)
📝 libs/deepagents/src/agent.ts (+6 -5)
📝 libs/deepagents/src/index.ts (+3 -0)
📝 libs/deepagents/src/testing/utils.ts (+2 -1)
📝 libs/deepagents/src/types.ts (+50 -1)
📝 pnpm-lock.yaml (+366 -551)

📄 Description

Summary

  • Fix structuredResponse type inference when using responseFormat with createDeepAgent -- previously it was typed as the strategy wrapper (e.g. ToolStrategy<{ city: string }>) instead of the unwrapped parsed type ({ city: string })
  • Add InferStructuredResponse<T> utility type that extracts T from ToolStrategy<T> / ProviderStrategy<T>, and correctly resolves to ResponseFormatUndefined when no responseFormat is provided
  • Add 5 integration tests covering responseFormat with toolStrategy, providerStrategy, combined tools, nested schemas, and subagent delegation

🔄 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/222 **Author:** [@christian-bromann](https://github.com/christian-bromann) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@christian-bromann](https://github.com/christian-bromann) **Base:** `main` ← **Head:** `cb/structured-response-fix` --- ### 📝 Commits (6) - [`e9edf34`](https://github.com/langchain-ai/deepagentsjs/commit/e9edf34b93cb65d7fc8c7283498bce226d044b0f) fix(deepagents): unwrap responseFormat strategy types so structuredResponse is correctly typed - [`57657c9`](https://github.com/langchain-ai/deepagentsjs/commit/57657c92bf6af5ee79bf83f5eee7457d5811e081) format - [`c226cc6`](https://github.com/langchain-ai/deepagentsjs/commit/c226cc6a9dd3dc4eca6819f08d7f6a3d22c70378) Create stale-planes-breathe.md - [`84220d7`](https://github.com/langchain-ai/deepagentsjs/commit/84220d7db453ffeb405c2e787c2963b53e310813) improve tests - [`a741aaa`](https://github.com/langchain-ai/deepagentsjs/commit/a741aaa6b1b6b9be78127422fe21db0f1b37cf85) update deps - [`aa027ef`](https://github.com/langchain-ai/deepagentsjs/commit/aa027ef7cf4cb96a973ac6d98aa020c048d57a66) add type tests ### 📊 Changes **10 files changed** (+686 additions, -568 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/stale-planes-breathe.md` (+5 -0) 📝 `examples/package.json` (+6 -6) 📝 `libs/deepagents/package.json` (+2 -2) 📝 `libs/deepagents/src/agent.int.test.ts` (+197 -2) 📝 `libs/deepagents/src/agent.test-d.ts` (+49 -0) 📝 `libs/deepagents/src/agent.ts` (+6 -5) 📝 `libs/deepagents/src/index.ts` (+3 -0) 📝 `libs/deepagents/src/testing/utils.ts` (+2 -1) 📝 `libs/deepagents/src/types.ts` (+50 -1) 📝 `pnpm-lock.yaml` (+366 -551) </details> ### 📄 Description ## Summary - Fix `structuredResponse` type inference when using `responseFormat` with `createDeepAgent` -- previously it was typed as the strategy wrapper (e.g. `ToolStrategy<{ city: string }>`) instead of the unwrapped parsed type (`{ city: string }`) - Add `InferStructuredResponse<T>` utility type that extracts `T` from `ToolStrategy<T>` / `ProviderStrategy<T>`, and correctly resolves to `ResponseFormatUndefined` when no `responseFormat` is provided - Add 5 integration tests covering `responseFormat` with `toolStrategy`, `providerStrategy`, combined tools, nested schemas, and subagent delegation --- <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#222