[PR #436] [CLOSED] fix: resolve Pydantic serialization warning for context in SubAgent (issue #430) #662

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/436
Author: @sinboun
Created: 11/20/2025
Status: Closed

Base: masterHead: pydantic-context-subagent


📝 Commits (3)

  • be64422 fix: resolve Pydantic serialization warning for context in SubAgent (issue #430)
  • def36be x
  • d7783c8 Merge branch 'langchain-ai:master' into pydantic-context-subagent

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 libs/deepagents/deepagents/middleware/subagents.py (+3 -2)

📄 Description

This PR fixes a PydanticSerializationUnexpectedValue warning observed when running subagents.

Issue: The runtime argument in task and atask functions lacked the generic type annotation [ContextT]. This caused the Pydantic serializer to expect None for the context field, resulting in a warning when a valid Context object was passed.

Changes:

Imported ContextT from langchain.tools.tool_node.

Updated type hints from ToolRuntime to ToolRuntime[ContextT].

Error Log Resolved:

PydanticSerializationUnexpectedValue(Expected none - serialized value may not be as expected [field_name='context', input_value=Context(...)])

Linked Issue

Closes #430


🔄 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/436 **Author:** [@sinboun](https://github.com/sinboun) **Created:** 11/20/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `pydantic-context-subagent` --- ### 📝 Commits (3) - [`be64422`](https://github.com/langchain-ai/deepagents/commit/be6442213cf50685c9d6c1dda1a001040fee5b46) fix: resolve Pydantic serialization warning for context in SubAgent (issue #430) - [`def36be`](https://github.com/langchain-ai/deepagents/commit/def36bed0fddbfad78dade91ab3982d70aaf7869) x - [`d7783c8`](https://github.com/langchain-ai/deepagents/commit/d7783c82482b48f6395e7748b675515c6ad8423b) Merge branch 'langchain-ai:master' into pydantic-context-subagent ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents/deepagents/middleware/subagents.py` (+3 -2) </details> ### 📄 Description This PR fixes a PydanticSerializationUnexpectedValue warning observed when running subagents. Issue: The runtime argument in task and atask functions lacked the generic type annotation [ContextT]. This caused the Pydantic serializer to expect None for the context field, resulting in a warning when a valid Context object was passed. Changes: Imported ContextT from langchain.tools.tool_node. Updated type hints from ToolRuntime to ToolRuntime[ContextT]. Error Log Resolved: PydanticSerializationUnexpectedValue(Expected none - serialized value may not be as expected [field_name='context', input_value=Context(...)]) ## Linked Issue Closes #430 --- <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:16:45 -05:00
yindo closed this issue 2026-02-16 09:16:45 -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#662