[PR #469] fix: expose summarization middleware options #489

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/469
Author: @xinzine
Created: 4/15/2026
Status: 🔄 Open

Base: mainHead: fix/summarization-middleware-config


📝 Commits (6)

  • f327a56 fix: expose summarization middleware options
  • 419b270 Create big-geckos-lie.md
  • ea38325 chore: add changeset for summarization middleware options
  • 045b8e0 chore: remove duplicate changeset
  • 9177c7d chore: retrigger checks for code scanning
  • 108d6ce Merge branch 'main' into fix/summarization-middleware-config

📊 Changes

4 files changed (+126 additions, -3 deletions)

View changed files

.changeset/big-geckos-lie.md (+5 -0)
📝 libs/deepagents/src/agent.test.ts (+58 -0)
📝 libs/deepagents/src/agent.ts (+25 -2)
📝 libs/deepagents/src/types.ts (+38 -1)

📄 Description

Summary

This PR exposes summarization middleware configuration through createDeepAgent.

Changes

  • add summarization to CreateDeepAgentParams
  • add DeepAgentSummarizationOptions
  • forward supported summarization options to the built-in createSummarizationMiddleware
  • apply the same summarization config to both the root agent and inline subagents
  • add a regression test covering config forwarding

Supported options

The following built-in summarization options can now be passed through createDeepAgent:

  • trigger
  • keep
  • summaryPrompt
  • trimTokensToSummarize
  • truncateArgsSettings

All of them are optional. When omitted, the existing default behavior is preserved.

Why

Previously, createDeepAgent only passed backend into the built-in summarization middleware. That made it impossible to configure summarization behavior from the top-level deep agent API.

This change allows callers to customize summarization thresholds and behavior without changing middleware wiring manually.

Validation

  • ran pnpm --filter deepagents test -- agent.test.ts
  • targeted tests passed

🔄 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/469 **Author:** [@xinzine](https://github.com/xinzine) **Created:** 4/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/summarization-middleware-config` --- ### 📝 Commits (6) - [`f327a56`](https://github.com/langchain-ai/deepagentsjs/commit/f327a56772a6b0c32c045301cf1f4646b000182b) fix: expose summarization middleware options - [`419b270`](https://github.com/langchain-ai/deepagentsjs/commit/419b270283dffbfd873bb061da98da91ecb459f2) Create big-geckos-lie.md - [`ea38325`](https://github.com/langchain-ai/deepagentsjs/commit/ea38325d2b06355448e0ca1cddfaf25559a07eaa) chore: add changeset for summarization middleware options - [`045b8e0`](https://github.com/langchain-ai/deepagentsjs/commit/045b8e0de675402371b952fd9fe0091402dc04d5) chore: remove duplicate changeset - [`9177c7d`](https://github.com/langchain-ai/deepagentsjs/commit/9177c7daa8cb29b9f40384068632cc39bad0707d) chore: retrigger checks for code scanning - [`108d6ce`](https://github.com/langchain-ai/deepagentsjs/commit/108d6ceceba8f06663c7f036eeb6d2614ab5c201) Merge branch 'main' into fix/summarization-middleware-config ### 📊 Changes **4 files changed** (+126 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/big-geckos-lie.md` (+5 -0) 📝 `libs/deepagents/src/agent.test.ts` (+58 -0) 📝 `libs/deepagents/src/agent.ts` (+25 -2) 📝 `libs/deepagents/src/types.ts` (+38 -1) </details> ### 📄 Description ## Summary This PR exposes summarization middleware configuration through `createDeepAgent`. ## Changes - add `summarization` to `CreateDeepAgentParams` - add `DeepAgentSummarizationOptions` - forward supported summarization options to the built-in `createSummarizationMiddleware` - apply the same summarization config to both the root agent and inline subagents - add a regression test covering config forwarding ## Supported options The following built-in summarization options can now be passed through `createDeepAgent`: - `trigger` - `keep` - `summaryPrompt` - `trimTokensToSummarize` - `truncateArgsSettings` All of them are optional. When omitted, the existing default behavior is preserved. ## Why Previously, `createDeepAgent` only passed `backend` into the built-in summarization middleware. That made it impossible to configure summarization behavior from the top-level deep agent API. This change allows callers to customize summarization thresholds and behavior without changing middleware wiring manually. ## Validation - ran `pnpm --filter deepagents test -- agent.test.ts` - targeted tests passed --- <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:22 -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#489