[PR #1173] [MERGED] feat(deepagents): refactor summarization middleware #1185

Closed
opened 2026-02-16 09:18:22 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/1173
Author: @ccurme
Created: 2/6/2026
Status: Merged
Merged: 2/6/2026
Merged by: @ccurme

Base: v0.4Head: revert-1172-revert-1138-cc/summarization_refactor


📝 Commits (1)

  • 1f4c782 Revert "revert(deepagents): refactor summarization middleware (#1172)"

📊 Changes

10 files changed (+691 additions, -270 deletions)

View changed files

📝 libs/cli/tests/unit_tests/test_end_to_end.py (+45 -2)
📝 libs/cli/uv.lock (+16 -16)
📝 libs/deepagents/deepagents/graph.py (+4 -4)
📝 libs/deepagents/deepagents/middleware/summarization.py (+206 -82)
📝 libs/deepagents/pyproject.toml (+3 -3)
📝 libs/deepagents/tests/integration_tests/test_summarization.py (+8 -6)
📝 libs/deepagents/tests/unit_tests/middleware/test_summarization_middleware.py (+367 -115)
📝 libs/deepagents/uv.lock (+16 -16)
📝 libs/harbor/uv.lock (+16 -16)
📝 libs/partners/daytona/uv.lock (+10 -10)

📄 Description

Migrate SummarizationMiddleware from the inherited before_model/abefore_model pattern to the wrap_model_call protocol. Instead of mutating LangGraph state with RemoveMessage(REMOVE_ALL_MESSAGES) on each summarization, the middleware now tracks a SummarizationEvent in private state and reconstructs the effective message list on each call, avoiding full state rewrites.

Sample trace: https://smith.langchain.com/public/19d8beae-abb7-4d47-b8b4-18b284804b84/r


🔄 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/deepagents/pull/1173 **Author:** [@ccurme](https://github.com/ccurme) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/6/2026 **Merged by:** [@ccurme](https://github.com/ccurme) **Base:** `v0.4` ← **Head:** `revert-1172-revert-1138-cc/summarization_refactor` --- ### 📝 Commits (1) - [`1f4c782`](https://github.com/langchain-ai/deepagents/commit/1f4c7821350f7793205f829467ced25d2b2111c7) Revert "revert(deepagents): refactor summarization middleware (#1172)" ### 📊 Changes **10 files changed** (+691 additions, -270 deletions) <details> <summary>View changed files</summary> 📝 `libs/cli/tests/unit_tests/test_end_to_end.py` (+45 -2) 📝 `libs/cli/uv.lock` (+16 -16) 📝 `libs/deepagents/deepagents/graph.py` (+4 -4) 📝 `libs/deepagents/deepagents/middleware/summarization.py` (+206 -82) 📝 `libs/deepagents/pyproject.toml` (+3 -3) 📝 `libs/deepagents/tests/integration_tests/test_summarization.py` (+8 -6) 📝 `libs/deepagents/tests/unit_tests/middleware/test_summarization_middleware.py` (+367 -115) 📝 `libs/deepagents/uv.lock` (+16 -16) 📝 `libs/harbor/uv.lock` (+16 -16) 📝 `libs/partners/daytona/uv.lock` (+10 -10) </details> ### 📄 Description Migrate `SummarizationMiddleware` from the inherited `before_model`/`abefore_model` pattern to the `wrap_model_call` protocol. Instead of mutating LangGraph state with `RemoveMessage(REMOVE_ALL_MESSAGES)` on each summarization, the middleware now tracks a `SummarizationEvent` in private state and reconstructs the effective message list on each call, avoiding full state rewrites. Sample trace: https://smith.langchain.com/public/19d8beae-abb7-4d47-b8b4-18b284804b84/r --- <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 09:18:22 -05:00
yindo closed this issue 2026-02-16 09:18:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#1185