[PR #713] [CLOSED] feat: improve create_deep_agent() to support SystemMessage type #842

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/713
Author: @ps06756
Created: 1/11/2026
Status: Closed

Base: masterHead: fix/system-message-support


📝 Commits (1)

  • 1e8933b feat: improve create_deep_agent() to support SystemMessage type

📊 Changes

2 files changed (+90 additions, -4 deletions)

View changed files

📝 libs/deepagents/deepagents/graph.py (+23 -4)
libs/deepagents/tests/unit_tests/test_graph.py (+67 -0)

📄 Description

Summary

  • Add _merge_system_prompt() helper that properly handles SystemMessage inputs
  • Preserve block structure when SystemMessage.content is a list
  • Preserve metadata (name, additional_kwargs, etc.) via model_copy()
  • Add unit tests for all cases

This addresses the concerns raised in #612 about data loss when using .text property:

  • No more flattening of structured content
  • Block boundaries preserved for list content
  • Metadata preserved via model_copy()
  • Backward compatible with string inputs

Closes #597.

Test plan

  • Unit tests added for _merge_system_prompt() function
  • All 212 unit tests pass

🔄 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/713 **Author:** [@ps06756](https://github.com/ps06756) **Created:** 1/11/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/system-message-support` --- ### 📝 Commits (1) - [`1e8933b`](https://github.com/langchain-ai/deepagents/commit/1e8933ba926e7af7ab23052f1be36d18dcf3a115) feat: improve create_deep_agent() to support SystemMessage type ### 📊 Changes **2 files changed** (+90 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/deepagents/graph.py` (+23 -4) ➕ `libs/deepagents/tests/unit_tests/test_graph.py` (+67 -0) </details> ### 📄 Description ## Summary - Add `_merge_system_prompt()` helper that properly handles `SystemMessage` inputs - Preserve block structure when `SystemMessage.content` is a list - Preserve metadata (`name`, `additional_kwargs`, etc.) via `model_copy()` - Add unit tests for all cases This addresses the concerns raised in #612 about data loss when using `.text` property: - No more flattening of structured content - Block boundaries preserved for list content - Metadata preserved via `model_copy()` - Backward compatible with string inputs Closes #597. ## Test plan - [x] Unit tests added for `_merge_system_prompt()` function - [x] All 212 unit tests pass --- <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:17:20 -05:00
yindo closed this issue 2026-02-16 09:17:20 -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#842