Skip to content

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

fix(tracing): avoid LangGraph for Responses tool calls (#14671)

Hassieb Pakzad343a4ecdf5a5
diff --git a/packages/shared/src/utils/chatml/adapters/langgraph.ts b/packages/shared/src/utils/chatml/adapters/langgraph.ts
index 97991dad3c..f4d58c9de4 100644
--- a/packages/shared/src/utils/chatml/adapters/langgraph.ts
+++ b/packages/shared/src/utils/chatml/adapters/langgraph.ts
@@ -33,6 +33,14 @@ const LangGraphMessageSchema = z
)
.refine(
(data) => {
+ const hasLangGraphMessageShape = data.every(
+ (msg) =>
+ typeof msg === "object" &&
+ msg !== null &&
+ ("role" in msg || "additional_kwargs" in msg),
+ );
+ if (!hasLangGraphMessageShape) return false;
+
// Reject if any message has top-level parts (Microsoft Agent/Gemini format)
return !data.some(
(msg) =>
diff --git a/web/src/utils/chatml/jumptoplayground.clienttest.ts b/web/src/utils/chatml/jumptoplayground.clienttest.ts
index 98da6c8844..dd1fd98983 100644
--- a/web/src/utils/chatml/jumptoplayground.clienttest.ts
+++ b/web/src/utils/chatml/jumptoplayground.clienttest.ts
@@ -789,6 +789,57 @@ describe("Playground Jump Full Pipeline", () => {
});
});
+ it("should normalize OpenAI Responses function_call output arrays", () => {
+ const output = [
+ {
+ id: "fc_order_status",
+ type: "function_call",
+ status: "completed",
+ arguments: '{"orderIds":null}',
+ call_id: "call_order_status",
+ name: "getOrderStatus",
+ },
+ {
+ id: "fc_promotions",
+ type: "function_call",
+ status: "completed",
+ arguments: "{}",
+ call_id: "call_promotions",
+ name: "getPromotions",
+ },
+ ];
+
+ const outputResult = normalizeOutput(output, {
+ observationName: "OpenAI.responses",
+ });
+ expect(outputResult.success).toBe(true);
+
+ expect(outputResult.data).toEqual([
+ expect.objectContaining({
+ role: "assistant",
+ tool_calls: [
+ {
+ id: "call_order_status",
+ name: "getOrderStatus",
+ arguments: '{"orderIds":null}',
+ type: "function",
+ },
+ ],
+ }),
+ expect.objectContaining({
+ role: "assistant",
+ tool_calls: [
+ {
+ id: "call_promotions",
+ name: "getPromotions",
+ arguments: "{}",
+ type: "function",
+ },
+ ],
+ }),
+ ]);
+ });
+
it("should handle VAPI camelCase toolCalls and preserve IDs", () => {
// VAPI uses camelCase toolCalls instead of tool_calls
// Critical: Tool call IDs must be preserved for OpenAI API compatibility