fix(deepagents): filter invalid content blocks from subagent ToolMessage#240
Conversation
|
|
This PR filters |
When using Anthropic models, AIMessage.content can be an array containing tool_use, thinking, and redacted_thinking blocks. Passing these directly as ToolMessage.content causes downstream errors. Filter out invalid block types before constructing the ToolMessage, falling back to "Task completed" if no valid content remains. Fixes #239, fixes #245
a789f88 to
604b64e
Compare
Anton Nak (@antonnak) thanks for the feedback, added more blocks to the filter list. |
ad69c39
into
main
Summary
tool_use,thinking, andredacted_thinkingblocks from subagent response content inreturnCommandWithStateUpdatebefore constructing theToolMessage. When using Anthropic models,AIMessage.contentcan be an array containing these block types, which are invalid asToolMessagecontent and cause downstream errors."Task completed"when filtering removes all content blocks.tool_usefiltering,thinking/redacted_thinkingfiltering, mixed-invalid-block fallback, and string passthrough.Fixes #239, fixes #245