From 061feb97dbe3c9e328b0c48dc511d63471675051 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 7 Apr 2026 11:29:52 -0400 Subject: [PATCH] fix(claude_agent_sdk): serialize thinking blocks with type Register ThinkingBlock in the serialized content type map so Claude Agent SDK traces emit Anthropic-style thinking blocks with the expected type discriminator. --- py/src/braintrust/integrations/claude_agent_sdk/_constants.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/py/src/braintrust/integrations/claude_agent_sdk/_constants.py b/py/src/braintrust/integrations/claude_agent_sdk/_constants.py index 23b3b299..fa228a34 100644 --- a/py/src/braintrust/integrations/claude_agent_sdk/_constants.py +++ b/py/src/braintrust/integrations/claude_agent_sdk/_constants.py @@ -16,12 +16,14 @@ class MessageClassName(str, Enum): class BlockClassName(str, Enum): TEXT = "TextBlock" + THINKING = "ThinkingBlock" TOOL_USE = "ToolUseBlock" TOOL_RESULT = "ToolResultBlock" class SerializedContentType(str, Enum): TEXT = "text" + THINKING = "thinking" TOOL_USE = "tool_use" TOOL_RESULT = "tool_result" @@ -56,6 +58,7 @@ class MCPToolMetadataValues: SERIALIZED_CONTENT_TYPE_BY_BLOCK_CLASS: Final[Mapping[str, SerializedContentType]] = MappingProxyType( { BlockClassName.TEXT: SerializedContentType.TEXT, + BlockClassName.THINKING: SerializedContentType.THINKING, BlockClassName.TOOL_USE: SerializedContentType.TOOL_USE, BlockClassName.TOOL_RESULT: SerializedContentType.TOOL_RESULT, }