Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(trace): render thinking also on only tool calls (#11634)

Nimard9d9bc78a0a9
diff --git a/web/src/components/trace2/components/IOPreview/components/ChatMessage.tsx b/web/src/components/trace2/components/IOPreview/components/ChatMessage.tsx
index 879c57e7c0..ef37953ad0 100644
--- a/web/src/components/trace2/components/IOPreview/components/ChatMessage.tsx
+++ b/web/src/components/trace2/components/IOPreview/components/ChatMessage.tsx
@@ -130,8 +130,13 @@ export function ChatMessage({
);
}
- // Tool-call-only message (no content)
- if (!hasContent && toolCalls.length > 0) {
+ // Tool-call-only message (no content, no thinking)
+ if (
+ !hasContent &&
+ !hasThinkingContent(message) &&
+ !hasRedactedThinkingContent(message) &&
+ toolCalls.length > 0
+ ) {
return (
<div className={cn("transition-colors hover:bg-muted")}>
<MarkdownJsonViewHeader
diff --git a/worker/src/__tests__/chatml/adapters/pydantic-ai.test.ts b/worker/src/__tests__/chatml/adapters/pydantic-ai.test.ts
index 38a4a6a084..12181ecaae 100644
--- a/worker/src/__tests__/chatml/adapters/pydantic-ai.test.ts
+++ b/worker/src/__tests__/chatml/adapters/pydantic-ai.test.ts
@@ -151,5 +151,53 @@ describe("Pydantic AI Adapter", () => {
expect(result.data?.[3].content).toContain("Pun idea");
expect(result.data?.[3].tools).toHaveLength(2); // Available tools attached
});
+
+ it("should extract thinking parts", () => {
+ const output = [
+ {
+ role: "assistant",
+ parts: [
+ {
+ type: "thinking",
+ content:
+ "The user wants weather info.\n- Location: NYC\n- Need to call weather API",
+ },
+ {
+ type: "tool_call",
+ id: "toolu_123",
+ name: "get_weather",
+ arguments: { city: "NYC" },
+ },
+ ],
+ },
+ ];
+
+ const metadata = {
+ attributes: {
+ "gen_ai.operation.name": "chat",
+ "gen_ai.request.model": "claude-sonnet-4-5@20250929",
+ model_request_parameters: {
+ function_tools: [
+ {
+ name: "get_weather",
+ description: "Get weather for a city",
+ parameters_json_schema: {
+ type: "object",
+ properties: { city: { type: "string" } },
+ },
+ },
+ ],
+ },
+ },
+ scope: { name: "pydantic-ai" },
+ };
+
+ const result = normalizeInput(output, { metadata });
+
+ expect(result.success).toBe(true);
+ expect(result.data?.[0].thinking?.[0].content).toContain("NYC");
+ expect(result.data?.[0].tool_calls?.[0].name).toBe("get_weather");
+ expect(result.data?.[0].tools?.[0].name).toBe("get_weather");
+ });
});
});