Skip to content

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

fix(trace-ui): handle null attributes in AI SDK and Langgraph adapters (#10393)

marliessophie8ceba1dd86f7
diff --git a/web/src/utils/chatml/adapters/aisdk.ts b/web/src/utils/chatml/adapters/aisdk.ts
index d1328c27f5..5dae7825e3 100644
--- a/web/src/utils/chatml/adapters/aisdk.ts
+++ b/web/src/utils/chatml/adapters/aisdk.ts
@@ -401,8 +401,9 @@ export const aisdkAdapter: ProviderAdapter = {
}
if ("attributes" in meta && typeof meta.attributes === "object") {
- const attrs = meta.attributes as Record<string, unknown>;
+ const attrs = meta.attributes as Record<string, unknown> | null;
if (
+ attrs &&
typeof attrs["operation.name"] === "string" &&
attrs["operation.name"].startsWith("ai.")
) {
diff --git a/web/src/utils/chatml/adapters/langgraph.ts b/web/src/utils/chatml/adapters/langgraph.ts
index 2862a34b6e..d138f2edd2 100644
--- a/web/src/utils/chatml/adapters/langgraph.ts
+++ b/web/src/utils/chatml/adapters/langgraph.ts
@@ -294,8 +294,9 @@ export const langgraphAdapter: ProviderAdapter = {
// Check attributes["operation.name"] for AI SDK pattern
if ("attributes" in meta && typeof meta.attributes === "object") {
- const attrs = meta.attributes as Record<string, unknown>;
+ const attrs = meta.attributes as Record<string, unknown> | null;
if (
+ attrs &&
typeof attrs["operation.name"] === "string" &&
attrs["operation.name"].startsWith("ai.")
) {