Skip to content

Conversation

@sinboun
Copy link

@sinboun sinboun commented Nov 20, 2025

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

@eyurtsev eyurtsev self-assigned this Nov 22, 2025
@sinboun sinboun requested a review from eyurtsev November 24, 2025 05:10
Copy link
Author

@sinboun sinboun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@sinboun
Copy link
Author

sinboun commented Nov 24, 2025

This is ready to merge! @eyurtsev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydantic Serialization Warning When Using Context Parameter with SubAgent Invocation

2 participants