🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(trace-ui): render i/o for langgraph (#9723)
Nimarcbde3b7998cf
diff --git a/packages/shared/scripts/seeder/utils/framework-traces/langgraph-2025-08-22.json b/packages/shared/scripts/seeder/utils/framework-traces/langgraph-2025-08-22.jsonnew file mode 100644index 0000000000..ff08401ddb--- /dev/null+++ b/packages/shared/scripts/seeder/utils/framework-traces/langgraph-2025-08-22.json@@ -0,0 +1,1475 @@+{+ "trace": {+ "id": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "name": "LangGraph",+ "timestamp": "2025-08-22T09:38:56.228Z",+ "environment": "default",+ "tags": [],+ "bookmarked": false,+ "release": null,+ "version": null,+ "userId": null,+ "sessionId": null,+ "public": true,+ "input": "\"{\\\"messages\\\":[{\\\"content\\\":\\\"Search the web for 'example' and summarize.\\\",\\\"additional_kwargs\\\":{},\\\"response_metadata\\\":{},\\\"type\\\":\\\"human\\\",\\\"name\\\":null,\\\"id\\\":null,\\\"example\\\":false}]}\"",+ "output": "\"{\\\"messages\\\":[{\\\"content\\\":\\\"Search the web for 'example' and summarize.\\\",\\\"additional_kwargs\\\":{},\\\"response_metadata\\\":{},\\\"type\\\":\\\"human\\\",\\\"name\\\":null,\\\"id\\\":\\\"4f5904a4-473c-443c-af46-68765777a2f0\\\",\\\"example\\\":false},{\\\"content\\\":\\\"\\\",\\\"additional_kwargs\\\":{\\\"tool_calls\\\":[{\\\"id\\\":\\\"call_1oGK863sxQHlPreFhDdEs3yl\\\",\\\"function\\\":{\\\"arguments\\\":\\\"{\\\\\\\"query\\\\\\\":\\\\\\\"example\\\\\\\"}\\\",\\\"name\\\":\\\"Web-Search\\\"},\\\"type\\\":\\\"function\\\"}],\\\"refusal\\\":null},\\\"response_metadata\\\":{\\\"token_usage\\\":{\\\"completion_tokens\\\":15,\\\"prompt_tokens\\\":60,\\\"total_tokens\\\":75,\\\"completion_tokens_details\\\":{\\\"accepted_prediction_tokens\\\":0,\\\"audio_tokens\\\":0,\\\"reasoning_tokens\\\":0,\\\"rejected_prediction_tokens\\\":0},\\\"prompt_tokens_details\\\":{\\\"audio_tokens\\\":0,\\\"cached_tokens\\\":0}},\\\"model_name\\\":\\\"gpt-4o-2024-08-06\\\",\\\"system_fingerprint\\\":\\\"fp_46bff0e0c8\\\",\\\"id\\\":\\\"chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f\\\",\\\"service_tier\\\":\\\"default\\\",\\\"finish_reason\\\":\\\"tool_calls\\\",\\\"logprobs\\\":null},\\\"type\\\":\\\"ai\\\",\\\"name\\\":null,\\\"id\\\":\\\"run--06f4147e-6dc2-4078-a368-096c05261f12-0\\\",\\\"example\\\":false,\\\"tool_calls\\\":[{\\\"name\\\":\\\"Web-Search\\\",\\\"args\\\":{\\\"query\\\":\\\"example\\\"},\\\"id\\\":\\\"call_1oGK863sxQHlPreFhDdEs3yl\\\",\\\"type\\\":\\\"tool_call\\\"}],\\\"invalid_tool_calls\\\":[],\\\"usage_metadata\\\":{\\\"input_tokens\\\":60,\\\"output_tokens\\\":15,\\\"total_tokens\\\":75,\\\"input_token_details\\\":{\\\"audio\\\":0,\\\"cache_read\\\":0},\\\"output_token_details\\\":{\\\"audio\\\":0,\\\"reasoning\\\":0}}},{\\\"content\\\":\\\"[{\\\\\\\"url\\\\\\\": \\\\\\\"https://example.com\\\\\\\", \\\\\\\"title\\\\\\\": \\\\\\\"Example Result\\\\\\\", \\\\\\\"q\\\\\\\": \\\\\\\"example\\\\\\\"}]\\\",\\\"additional_kwargs\\\":{},\\\"response_metadata\\\":{},\\\"type\\\":\\\"tool\\\",\\\"name\\\":\\\"Web-Search\\\",\\\"id\\\":\\\"85ffdeba-3d69-4851-bd78-993403a10fd6\\\",\\\"tool_call_id\\\":\\\"call_1oGK863sxQHlPreFhDdEs3yl\\\",\\\"artifact\\\":null,\\\"status\\\":\\\"success\\\"},{\\\"content\\\":\\\"The search for \\\\\\\"example\\\\\\\" primarily leads to the website [example.com](https://example.com), which is often used as a placeholder or demonstration site in various contexts. It serves as a generic example for illustrating how a website might look or function.\\\",\\\"additional_kwargs\\\":{\\\"refusal\\\":null},\\\"response_metadata\\\":{\\\"token_usage\\\":{\\\"completion_tokens\\\":51,\\\"prompt_tokens\\\":108,\\\"total_tokens\\\":159,\\\"completion_tokens_details\\\":{\\\"accepted_prediction_tokens\\\":0,\\\"audio_tokens\\\":0,\\\"reasoning_tokens\\\":0,\\\"rejected_prediction_tokens\\\":0},\\\"prompt_tokens_details\\\":{\\\"audio_tokens\\\":0,\\\"cached_tokens\\\":0}},\\\"model_name\\\":\\\"gpt-4o-2024-08-06\\\",\\\"system_fingerprint\\\":\\\"fp_46bff0e0c8\\\",\\\"id\\\":\\\"chatcmpl-C7IWXZL0b6BLNuyEMr369PF4PEpSs\\\",\\\"service_tier\\\":\\\"default\\\",\\\"finish_reason\\\":\\\"stop\\\",\\\"logprobs\\\":null},\\\"type\\\":\\\"ai\\\",\\\"name\\\":null,\\\"id\\\":\\\"run--a6270d77-8cd6-4c1b-a80b-c1da054d9f9a-0\\\",\\\"example\\\":false,\\\"tool_calls\\\":[],\\\"invalid_tool_calls\\\":[],\\\"usage_metadata\\\":{\\\"input_tokens\\\":108,\\\"output_tokens\\\":51,\\\"total_tokens\\\":159,\\\"input_token_details\\\":{\\\"audio\\\":0,\\\"cache_read\\\":0},\\\"output_token_details\\\":{\\\"audio\\\":0,\\\"reasoning\\\":0}}}]}\"",+ "metadata": "{\"resourceAttributes\":{\"telemetry.sdk.language\":\"python\",\"telemetry.sdk.name\":\"opentelemetry\",\"telemetry.sdk.version\":\"1.36.0\",\"service.name\":\"unknown_service\"},\"scope\":{\"name\":\"langfuse-sdk\",\"version\":\"3.3.0\",\"attributes\":{\"public_key\":\"ABCDEFG\"}}}",+ "createdAt": "2025-08-22T09:38:56.228Z",+ "updatedAt": "2025-08-22T09:39:11.980Z",+ "scores": [+ {+ "id": "1c2fb813-8481-4843-bcf8-cfb54b46da44",+ "timestamp": "2025-08-22T09:39:39.219Z",+ "projectId": "cloramnkj0002jz088vzn1ja4",+ "environment": "default",+ "name": "hallucination",+ "source": "EVAL",+ "authorUserId": null,+ "comment": "The generation accurately describes 'example.com' as a placeholder site, aligning with established knowledge and verifiable data.",+ "metadata": "{}",+ "configId": null,+ "createdAt": "2025-08-22T09:39:40.000Z",+ "updatedAt": "2025-08-22T09:39:39.293Z",+ "queueId": null,+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "observationId": null,+ "sessionId": null,+ "datasetRunId": null,+ "value": 0.1,+ "stringValue": null,+ "dataType": "NUMERIC"+ },+ {+ "id": "da70b4e9-bfcd-4086-9704-6cdb017302b9",+ "timestamp": "2025-08-22T09:39:38.838Z",+ "projectId": "cloramnkj0002jz088vzn1ja4",+ "environment": "default",+ "name": "toxicity",+ "source": "EVAL",+ "authorUserId": null,+ "comment": "The generation does not contain any harmful, offensive, or disrespectful language; it simply provides a summary of a web search without negativity or aggression.",+ "metadata": "{}",+ "configId": null,+ "createdAt": "2025-08-22T09:39:39.000Z",+ "updatedAt": "2025-08-22T09:39:38.898Z",+ "queueId": null,+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "observationId": null,+ "sessionId": null,+ "datasetRunId": null,+ "value": 0,+ "stringValue": null,+ "dataType": "NUMERIC"+ }+ ],+ "latency": 2.61+ },+ "observations": [+ {+ "id": "3b239b11cbb2ac0b",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "b024c7ee7680b708",+ "startTime": "2025-08-22T09:38:57.088Z",+ "endTime": "2025-08-22T09:38:58.835Z",+ "name": "agent",+ "metadata": {+ "tags": ["graph:step:3", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 3,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:695fb20e-d55e-ccb4-5384-070711a6cdf8",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:11.673Z",+ "updatedAt": "2025-08-22T09:39:11.950Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 1747,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ },+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ },+ {+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "tool",+ "name": "Web-Search",+ "id": "85ffdeba-3d69-4851-bd78-993403a10fd6",+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "artifact": null,+ "status": "success"+ }+ ]+ },+ "output": {+ "messages": [+ {+ "content": "The search for \"example\" primarily leads to the website [example.com](https://example.com), which is often used as a placeholder or demonstration site in various contexts. It serves as a generic example for illustrating how a website might look or function.",+ "additional_kwargs": {+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 51,+ "prompt_tokens": 108,+ "total_tokens": 159,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWXZL0b6BLNuyEMr369PF4PEpSs",+ "service_tier": "default",+ "finish_reason": "stop",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--a6270d77-8cd6-4c1b-a80b-c1da054d9f9a-0",+ "example": false,+ "tool_calls": [],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 108,+ "output_tokens": 51,+ "total_tokens": 159,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ }+ },+ {+ "id": "4f6535aaebcda355",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "GENERATION",+ "environment": "default",+ "parentObservationId": "98d3e02591797c04",+ "startTime": "2025-08-22T09:38:56.232Z",+ "endTime": "2025-08-22T09:38:57.080Z",+ "name": "ChatOpenAI",+ "metadata": {+ "tags": ["seq:step:1", "demo", "langfuse", "langgraph"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 1,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:d507d231-6dad-b926-076f-0644c0a0134e",+ "checkpoint_ns": "agent:d507d231-6dad-b926-076f-0644c0a0134e",+ "ls_provider": "openai",+ "ls_model_name": "gpt-4o",+ "ls_model_type": "chat",+ "ls_temperature": 0,+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": {+ "temperature": 0+ },+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:11.641Z",+ "updatedAt": "2025-08-22T09:39:11.937Z",+ "usageDetails": {+ "input": 60,+ "output": 15,+ "total": 75,+ "input_audio": 0,+ "input_cache_read": 0,+ "output_audio": 0,+ "output_reasoning": 0+ },+ "costDetails": {+ "input": 0.00006,+ "output": 0.000015,+ "total": 0.000075+ },+ "providedCostDetails": {},+ "model": "gpt-4o-2024-08-06",+ "internalModelId": "b33c06da-9490-4bbd-a2dd-878222948539",+ "promptName": null,+ "promptVersion": null,+ "latency": 848,+ "timeToFirstToken": null,+ "inputCost": 0.00006,+ "outputCost": 0.000015,+ "totalCost": 0.000075,+ "inputUsage": 60,+ "outputUsage": 15,+ "totalUsage": 75,+ "input": [+ {+ "role": "user",+ "content": "Be helpful!"+ },+ {+ "role": "user",+ "content": "Search the web for 'example' and summarize."+ },+ {+ "role": "tool",+ "content": {+ "type": "function",+ "function": {+ "name": "Web-Search",+ "description": "Dummy web search tool.",+ "parameters": {+ "properties": {+ "query": {+ "type": "string"+ }+ },+ "required": ["query"],+ "type": "object"+ }+ }+ }+ }+ ],+ "output": {+ "role": "assistant",+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ }+ }+ },+ {+ "id": "5ba09605e0929d78",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "GENERATION",+ "environment": "default",+ "parentObservationId": "3b239b11cbb2ac0b",+ "startTime": "2025-08-22T09:38:57.089Z",+ "endTime": "2025-08-22T09:38:58.832Z",+ "name": "ChatOpenAI",+ "metadata": {+ "tags": ["seq:step:1", "demo", "langfuse", "langgraph"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 3,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:695fb20e-d55e-ccb4-5384-070711a6cdf8",+ "checkpoint_ns": "agent:695fb20e-d55e-ccb4-5384-070711a6cdf8",+ "ls_provider": "openai",+ "ls_model_name": "gpt-4o",+ "ls_model_type": "chat",+ "ls_temperature": 0,+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": {+ "temperature": 0+ },+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:11.173Z",+ "updatedAt": "2025-08-22T09:39:11.492Z",+ "usageDetails": {+ "input": 108,+ "output": 51,+ "total": 159,+ "input_audio": 0,+ "input_cache_read": 0,+ "output_audio": 0,+ "output_reasoning": 0+ },+ "costDetails": {+ "input": 0.000108,+ "output": 0.000051,+ "total": 0.000159+ },+ "providedCostDetails": {},+ "model": "gpt-4o-2024-08-06",+ "internalModelId": "b33c06da-9490-4bbd-a2dd-878222948539",+ "promptName": null,+ "promptVersion": null,+ "latency": 1743,+ "timeToFirstToken": null,+ "inputCost": 0.000108,+ "outputCost": 0.000051,+ "totalCost": 0.000159,+ "inputUsage": 108,+ "outputUsage": 51,+ "totalUsage": 159,+ "input": [+ {+ "role": "user",+ "content": "Be helpful!"+ },+ {+ "role": "user",+ "content": "Search the web for 'example' and summarize."+ },+ {+ "role": "assistant",+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ }+ },+ {+ "role": "tool",+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl"+ },+ {+ "role": "tool",+ "content": {+ "type": "function",+ "function": {+ "name": "Web-Search",+ "description": "Dummy web search tool.",+ "parameters": {+ "properties": {+ "query": {+ "type": "string"+ }+ },+ "required": ["query"],+ "type": "object"+ }+ }+ }+ }+ ],+ "output": {+ "role": "assistant",+ "content": "The search for \"example\" primarily leads to the website [example.com](https://example.com), which is often used as a placeholder or demonstration site in various contexts. It serves as a generic example for illustrating how a website might look or function.",+ "additional_kwargs": {+ "refusal": null+ }+ }+ },+ {+ "id": "21441266a9f21251",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "c8a18a38a3a115cb",+ "startTime": "2025-08-22T09:38:57.085Z",+ "endTime": "2025-08-22T09:38:57.086Z",+ "name": "Web-Search",+ "metadata": {+ "tags": ["seq:step:1", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 2,+ "langgraph_node": "tools",+ "langgraph_triggers": ["branch:to:tools"],+ "langgraph_path": ["__pregel_pull", "tools"],+ "langgraph_checkpoint_ns": "tools:a8b0eaec-b747-6d2a-2f81-4b6ac7e07fc1",+ "checkpoint_ns": "tools:a8b0eaec-b747-6d2a-2f81-4b6ac7e07fc1",+ "inputs": {+ "query": "example"+ },+ "color": "green",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:11.221Z",+ "updatedAt": "2025-08-22T09:39:11.351Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 1,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": "{'query': 'example'}",+ "output": {+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "tool",+ "name": "Web-Search",+ "id": null,+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "artifact": null,+ "status": "success"+ }+ },+ {+ "id": "c8a18a38a3a115cb",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "b024c7ee7680b708",+ "startTime": "2025-08-22T09:38:57.083Z",+ "endTime": "2025-08-22T09:38:57.086Z",+ "name": "tools",+ "metadata": {+ "tags": ["graph:step:2", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 2,+ "langgraph_node": "tools",+ "langgraph_triggers": ["branch:to:tools"],+ "langgraph_path": ["__pregel_pull", "tools"],+ "langgraph_checkpoint_ns": "tools:a8b0eaec-b747-6d2a-2f81-4b6ac7e07fc1",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:10.453Z",+ "updatedAt": "2025-08-22T09:39:10.625Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 3,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ },+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ },+ "output": {+ "messages": [+ {+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "tool",+ "name": "Web-Search",+ "id": null,+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "artifact": null,+ "status": "success"+ }+ ]+ }+ },+ {+ "id": "e638064431445dce",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "3b239b11cbb2ac0b",+ "startTime": "2025-08-22T09:38:58.834Z",+ "endTime": "2025-08-22T09:38:58.834Z",+ "name": "should_continue",+ "metadata": {+ "tags": ["seq:step:3", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 3,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:695fb20e-d55e-ccb4-5384-070711a6cdf8",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:09.989Z",+ "updatedAt": "2025-08-22T09:39:10.308Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 0,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ },+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ },+ {+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "tool",+ "name": "Web-Search",+ "id": "85ffdeba-3d69-4851-bd78-993403a10fd6",+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "artifact": null,+ "status": "success"+ },+ {+ "content": "The search for \"example\" primarily leads to the website [example.com](https://example.com), which is often used as a placeholder or demonstration site in various contexts. It serves as a generic example for illustrating how a website might look or function.",+ "additional_kwargs": {+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 51,+ "prompt_tokens": 108,+ "total_tokens": 159,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWXZL0b6BLNuyEMr369PF4PEpSs",+ "service_tier": "default",+ "finish_reason": "stop",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--a6270d77-8cd6-4c1b-a80b-c1da054d9f9a-0",+ "example": false,+ "tool_calls": [],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 108,+ "output_tokens": 51,+ "total_tokens": 159,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ },+ "output": "end"+ },+ {+ "id": "98d3e02591797c04",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "b024c7ee7680b708",+ "startTime": "2025-08-22T09:38:56.231Z",+ "endTime": "2025-08-22T09:38:57.082Z",+ "name": "agent",+ "metadata": {+ "tags": ["graph:step:1", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 1,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:d507d231-6dad-b926-076f-0644c0a0134e",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:09.952Z",+ "updatedAt": "2025-08-22T09:39:10.192Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 851,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ }+ ]+ },+ "output": {+ "messages": [+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ }+ },+ {+ "id": "b024c7ee7680b708",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": null,+ "startTime": "2025-08-22T09:38:56.228Z",+ "endTime": "2025-08-22T09:38:58.838Z",+ "name": "LangGraph",+ "metadata": {+ "tags": ["langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:09.403Z",+ "updatedAt": "2025-08-22T09:39:09.818Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 2610,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": null,+ "example": false+ }+ ]+ },+ "output": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ },+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ },+ {+ "content": [+ {+ "url": "https://example.com",+ "title": "Example Result",+ "q": "example"+ }+ ],+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "tool",+ "name": "Web-Search",+ "id": "85ffdeba-3d69-4851-bd78-993403a10fd6",+ "tool_call_id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "artifact": null,+ "status": "success"+ },+ {+ "content": "The search for \"example\" primarily leads to the website [example.com](https://example.com), which is often used as a placeholder or demonstration site in various contexts. It serves as a generic example for illustrating how a website might look or function.",+ "additional_kwargs": {+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 51,+ "prompt_tokens": 108,+ "total_tokens": 159,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWXZL0b6BLNuyEMr369PF4PEpSs",+ "service_tier": "default",+ "finish_reason": "stop",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--a6270d77-8cd6-4c1b-a80b-c1da054d9f9a-0",+ "example": false,+ "tool_calls": [],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 108,+ "output_tokens": 51,+ "total_tokens": 159,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ }+ },+ {+ "id": "c7fbfdc6ab70ca4d",+ "traceId": "e1fde3efec57ce8a69bafd3fb928a7eb",+ "projectId": "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a",+ "type": "SPAN",+ "environment": "default",+ "parentObservationId": "98d3e02591797c04",+ "startTime": "2025-08-22T09:38:57.081Z",+ "endTime": "2025-08-22T09:38:57.081Z",+ "name": "should_continue",+ "metadata": {+ "tags": ["seq:step:3", "langgraph", "demo", "langfuse"],+ "thread_id": "demo-thread-1",+ "langgraph_step": 1,+ "langgraph_node": "agent",+ "langgraph_triggers": ["branch:to:agent"],+ "langgraph_path": ["__pregel_pull", "agent"],+ "langgraph_checkpoint_ns": "agent:d507d231-6dad-b926-076f-0644c0a0134e",+ "resourceAttributes": {+ "telemetry.sdk.language": "python",+ "telemetry.sdk.name": "opentelemetry",+ "telemetry.sdk.version": "1.36.0",+ "service.name": "unknown_service"+ },+ "scope": {+ "name": "langfuse-sdk",+ "version": "3.3.0",+ "attributes": {+ "public_key": "KJGLKJGLJG"+ }+ }+ },+ "level": "DEFAULT",+ "statusMessage": null,+ "version": null,+ "modelParameters": null,+ "completionStartTime": null,+ "promptId": null,+ "createdAt": "2025-08-22T09:39:09.393Z",+ "updatedAt": "2025-08-22T09:39:09.617Z",+ "usageDetails": {},+ "costDetails": {},+ "providedCostDetails": {},+ "model": null,+ "internalModelId": null,+ "promptName": null,+ "promptVersion": null,+ "latency": 0,+ "timeToFirstToken": null,+ "inputCost": null,+ "outputCost": null,+ "totalCost": 0,+ "inputUsage": 0,+ "outputUsage": 0,+ "totalUsage": 0,+ "input": {+ "messages": [+ {+ "content": "Search the web for 'example' and summarize.",+ "additional_kwargs": {},+ "response_metadata": {},+ "type": "human",+ "name": null,+ "id": "4f5904a4-473c-443c-af46-68765777a2f0",+ "example": false+ },+ {+ "content": "",+ "additional_kwargs": {+ "tool_calls": [+ {+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "function": {+ "arguments": {+ "query": "example"+ },+ "name": "Web-Search"+ },+ "type": "function"+ }+ ],+ "refusal": null+ },+ "response_metadata": {+ "token_usage": {+ "completion_tokens": 15,+ "prompt_tokens": 60,+ "total_tokens": 75,+ "completion_tokens_details": {+ "accepted_prediction_tokens": 0,+ "audio_tokens": 0,+ "reasoning_tokens": 0,+ "rejected_prediction_tokens": 0+ },+ "prompt_tokens_details": {+ "audio_tokens": 0,+ "cached_tokens": 0+ }+ },+ "model_name": "gpt-4o-2024-08-06",+ "system_fingerprint": "fp_46bff0e0c8",+ "id": "chatcmpl-C7IWW4ZyFcMMUH5I00yulLd1Cuz2f",+ "service_tier": "default",+ "finish_reason": "tool_calls",+ "logprobs": null+ },+ "type": "ai",+ "name": null,+ "id": "run--06f4147e-6dc2-4078-a368-096c05261f12-0",+ "example": false,+ "tool_calls": [+ {+ "name": "Web-Search",+ "args": {+ "query": "example"+ },+ "id": "call_1oGK863sxQHlPreFhDdEs3yl",+ "type": "tool_call"+ }+ ],+ "invalid_tool_calls": [],+ "usage_metadata": {+ "input_tokens": 60,+ "output_tokens": 15,+ "total_tokens": 75,+ "input_token_details": {+ "audio": 0,+ "cache_read": 0+ },+ "output_token_details": {+ "audio": 0,+ "reasoning": 0+ }+ }+ }+ ]+ },+ "output": "continue"+ }+ ]+}diff --git a/web/src/utils/chatml/adapters/index.ts b/web/src/utils/chatml/adapters/index.tsindex 9e04ac4fb4..4b5730e08f 100644--- a/web/src/utils/chatml/adapters/index.ts+++ b/web/src/utils/chatml/adapters/index.ts@@ -1,9 +1,11 @@import type { NormalizerContext, ProviderAdapter } from "../types";import { mapToChatMl, mapOutputToChatMl } from "../core";+import { langgraphAdapter } from "./langgraph";import { openAIAdapter } from "./openai";import { genericAdapter } from "./generic";const adapters: ProviderAdapter[] = [+ langgraphAdapter, // Must be before openAI (both use langfuse-sdk scope)openAIAdapter,// Add more adapters here as neededgenericAdapter, // Always last (fallback)diff --git a/web/src/utils/chatml/adapters/langgraph.clienttest.ts b/web/src/utils/chatml/adapters/langgraph.clienttest.tsnew file mode 100644index 0000000000..96b2feb8a0--- /dev/null+++ b/web/src/utils/chatml/adapters/langgraph.clienttest.ts@@ -0,0 +1,104 @@+jest.mock("@langfuse/shared", () => ({+ ChatMessageRole: {+ System: "system",+ Developer: "developer",+ User: "user",+ Assistant: "assistant",+ Tool: "tool",+ Model: "model",+ },+}));++import { normalizeInput } from "./index";+import { langgraphAdapter } from "./langgraph";++describe("LangGraph Adapter", () => {+ it("should detect LangGraph via various metadata patterns", () => {+ expect(+ langgraphAdapter.detect({+ metadata: { langgraph_node: "agent", langgraph_step: 3 },+ }),+ ).toBe(true);++ expect(+ langgraphAdapter.detect({ metadata: { framework: "langgraph" } }),+ ).toBe(true);++ expect(langgraphAdapter.detect({ framework: "langgraph" })).toBe(true);++ expect(+ langgraphAdapter.detect({+ metadata: {+ messages: [+ { type: "human", content: "Hello" },+ { type: "ai", content: "Hi" },+ ],+ },+ }),+ ).toBe(true);++ expect(+ langgraphAdapter.detect({+ metadata: { scope: { name: "langfuse-sdk" } },+ }),+ ).toBe(false);+ });++ it("should normalize LangGraph messages with type-to-role conversion and tool_calls", () => {+ const input = {+ messages: [+ {+ content: "Search the web",+ type: "human",+ id: "msg-1",+ name: null,+ },+ {+ content: "",+ additional_kwargs: {+ tool_calls: [+ {+ id: "call_abc",+ type: "function",+ function: {+ name: "Web-Search",+ arguments: { query: "example" },+ },+ },+ ],+ },+ type: "ai",+ id: "run-123",+ },+ {+ content: { temperature: 72, conditions: "sunny" },+ type: "tool",+ name: "Web-Search",+ tool_call_id: "call_abc",+ },+ ],+ };++ const result = normalizeInput(input, { framework: "langgraph" });+ expect(result.success).toBe(true);+ if (!result.data) throw new Error("Expected data to be defined");++ expect(result.data).toHaveLength(3);+ expect(result.data[0].role).toBe("user");+ expect(result.data[0].content).toBe("Search the web");+ expect(result.data[0].json?.json?._originalType).toBe("human");++ expect(result.data[1].role).toBe("assistant");+ expect(result.data[1].json?.json?._originalType).toBe("ai");+ const toolCalls = result.data[1].json?.json?.tool_calls;+ expect(toolCalls).toBeDefined();+ expect(toolCalls?.[0].id).toBe("call_abc");+ expect(toolCalls?.[0].function.arguments).toEqual({ query: "example" });++ expect(result.data[2].role).toBe("tool");+ expect(typeof result.data[2].content).toBe("string");+ expect(result.data[2].content).toBe(+ '{"temperature":72,"conditions":"sunny"}',+ );+ });+});diff --git a/web/src/utils/chatml/adapters/langgraph.ts b/web/src/utils/chatml/adapters/langgraph.tsnew file mode 100644index 0000000000..1110fa0763--- /dev/null+++ b/web/src/utils/chatml/adapters/langgraph.ts@@ -0,0 +1,158 @@+import type { NormalizerContext, ProviderAdapter } from "../types";+import {+ removeNullFields,+ // stringifyToolCallArgs,+ stringifyToolResultContent,+ parseMetadata,+} from "../helpers";++function normalizeMessage(msg: unknown): Record<string, unknown> {+ if (!msg || typeof msg !== "object") return {};++ let normalized = removeNullFields(msg);++ // LangGraph/LangChain: "type" field → "role" field+ if (normalized.type && !normalized.role) {+ const typeToRole: Record<string, string> = {+ human: "user",+ ai: "assistant",+ tool: "tool",+ system: "system",+ };+ const type = String(normalized.type);+ if (typeToRole[type]) {+ normalized.role = typeToRole[type];+ normalized._originalType = type;+ }+ }++ // LangGraph: tool_calls in additional_kwargs → top level+ if (+ normalized.additional_kwargs &&+ typeof normalized.additional_kwargs === "object"+ ) {+ const additionalKwargs = normalized.additional_kwargs as Record<+ string,+ unknown+ >;+ if (additionalKwargs.tool_calls && !normalized.tool_calls) {+ normalized.tool_calls = additionalKwargs.tool_calls;+ }+ }++ // Stringify tool_calls arguments+ // if (normalized.tool_calls && Array.isArray(normalized.tool_calls)) {+ // normalized.tool_calls = (+ // normalized.tool_calls as Record<string, unknown>[]+ // ).map(stringifyToolCallArgs);+ // }++ // Stringify object content for tool messages+ if (+ normalized.role === "tool" &&+ typeof normalized.content === "object" &&+ !Array.isArray(normalized.content)+ ) {+ normalized.content = stringifyToolResultContent(normalized.content);+ }++ return normalized;+}++function preprocessData(data: unknown): unknown {+ if (!data) return data;++ // Array of messages+ if (Array.isArray(data)) {+ return data.map(normalizeMessage);+ }++ // Object with messages key+ if (typeof data === "object" && "messages" in data) {+ const obj = data as Record<string, unknown>;+ return {+ ...obj,+ messages: Array.isArray(obj.messages)+ ? obj.messages.map(normalizeMessage)+ : obj.messages,+ };+ }++ // Single message+ if (typeof data === "object" && ("role" in data || "type" in data)) {+ return normalizeMessage(data);+ }++ return data;+}++export const langgraphAdapter: ProviderAdapter = {+ id: "langgraph",++ detect(ctx: NormalizerContext): boolean {+ const meta = parseMetadata(ctx.metadata);++ if (ctx.framework === "langgraph") return true;++ // Check for LangGraph-specific metadata+ if (meta && typeof meta === "object") {+ if (+ "langgraph_step" in meta ||+ "langgraph_node" in meta ||+ "langgraph_path" in meta ||+ "langgraph_checkpoint_ns" in meta+ ) {+ return true;+ }++ if (meta.framework === "langgraph") return true;++ if (Array.isArray(meta.tags) && meta.tags.includes("langgraph")) {+ return true;+ }+ }++ // Check for LangChain/LangGraph message structure+ if (+ typeof ctx.metadata === "object" &&+ ctx.metadata !== null &&+ "messages" in ctx.metadata+ ) {+ const messages = (ctx.metadata as Record<string, unknown>).messages;+ if (Array.isArray(messages) && messages.length > 0) {+ const hasLangChainStructure = messages.some((msg: unknown) => {+ const message = msg as Record<string, unknown>;+ // LangChain type field without role+ if (+ message.type &&+ typeof message.type === "string" &&+ ["human", "ai", "tool", "system"].includes(message.type) &&+ !("role" in message)+ ) {+ return true;+ }+ // LangChain tool_calls in additional_kwargs+ if (+ message.additional_kwargs &&+ typeof message.additional_kwargs === "object"+ ) {+ const kwargs = message.additional_kwargs as Record<string, unknown>;+ if (kwargs.tool_calls) return true;+ }+ return false;+ });+ if (hasLangChainStructure) return true;+ }+ }++ return false;+ },++ preprocess(+ data: unknown,+ _kind: "input" | "output",+ _ctx: NormalizerContext,+ ): unknown {+ return preprocessData(data);+ },+};diff --git a/web/src/utils/chatml/adapters/openai.clienttest.ts b/web/src/utils/chatml/adapters/openai.clienttest.tsindex 14daa294de..9f866baf58 100644--- a/web/src/utils/chatml/adapters/openai.clienttest.ts+++ b/web/src/utils/chatml/adapters/openai.clienttest.ts@@ -13,18 +13,34 @@ import { normalizeInput } from "./index";import { openAIAdapter } from "./openai";describe("OpenAI Adapter", () => {- it("should detect OpenAI via metadata", () => {- expect(- openAIAdapter.detect({ metadata: { scope: { name: "langfuse-sdk" } } }),- ).toBe(true);-+ it("should detect OpenAI and reject LangGraph", () => {expect(openAIAdapter.detect({ observationName: "OpenAI-generation" })).toBe(true,);+ expect(+ openAIAdapter.detect({+ metadata: { messages: [{ role: "user", content: "test" }] },+ }),+ ).toBe(true);+expect(openAIAdapter.detect({ metadata: { framework: "langgraph" } })).toBe(false,);++ expect(+ openAIAdapter.detect({+ metadata: { langgraph_node: "agent", langgraph_step: 3 },+ }),+ ).toBe(false);++ expect(+ openAIAdapter.detect({+ metadata: {+ messages: [{ type: "human", content: "test" }],+ },+ }),+ ).toBe(false);});it("should normalize tool_calls arguments to JSON strings", () => {diff --git a/web/src/utils/chatml/adapters/openai.ts b/web/src/utils/chatml/adapters/openai.tsindex bf0fa39b6a..40c407d217 100644--- a/web/src/utils/chatml/adapters/openai.ts+++ b/web/src/utils/chatml/adapters/openai.ts@@ -4,7 +4,6 @@ import {stringifyToolCallArgs,stringifyToolResultContent,parseMetadata,- getNestedProperty,} from "../helpers";function normalizeMessage(msg: unknown): Record<string, unknown> {@@ -64,17 +63,50 @@ export const openAIAdapter: ProviderAdapter = {detect(ctx: NormalizerContext): boolean {const meta = parseMetadata(ctx.metadata);+ // Explicit rejection: LangGraph/LangChain traces+ if (meta && typeof meta === "object") {+ if (+ "langgraph_step" in meta ||+ "langgraph_node" in meta ||+ "langgraph_path" in meta ||+ meta.framework === "langgraph" ||+ (Array.isArray(meta.tags) && meta.tags.includes("langgraph"))+ ) {+ return false;+ }+ }++ // Reject if messages have LangChain structure (type without role)+ if (+ typeof ctx.metadata === "object" &&+ ctx.metadata !== null &&+ "messages" in ctx.metadata+ ) {+ const messages = (ctx.metadata as Record<string, unknown>).messages;+ if (Array.isArray(messages)) {+ const hasLangChainType = messages.some((msg: unknown) => {+ const message = msg as Record<string, unknown>;+ return (+ message.type &&+ typeof message.type === "string" &&+ ["human", "ai", "tool", "system"].includes(message.type) &&+ !("role" in message)+ );+ });+ if (hasLangChainType) return false;+ }+ }++ // Explicit framework override+ if (ctx.framework === "openai") return true;+// LangSmith metadataif (meta?.ls_provider === "openai") return true;- // OpenTelemetry langfuse-sdk (OpenAI auto-instrumentation)- if (getNestedProperty(meta, "scope", "name") === "langfuse-sdk")- return true;-// Observation name hintif (ctx.observationName?.toLowerCase().includes("openai")) return true;- // Structural: has OpenAI-style tool_calls+ // Structural: has OpenAI-style messages with roleif (typeof ctx.metadata === "object" &&ctx.metadata !== null &&@@ -82,6 +114,19 @@ export const openAIAdapter: ProviderAdapter = {) {const messages = (ctx.metadata as Record<string, unknown>).messages;if (Array.isArray(messages)) {+ const hasRole = messages.some((msg: unknown) => {+ const message = msg as Record<string, unknown>;+ return (+ message.role &&+ typeof message.role === "string" &&+ ["system", "user", "assistant", "tool", "function"].includes(+ message.role,+ )+ );+ });+ if (hasRole) return true;++ // OpenAI-style tool_calls at top levelconst hasToolCalls = messages.some((msg: unknown) => {const message = msg as Record<string, unknown>;return (@@ -92,22 +137,43 @@ export const openAIAdapter: ProviderAdapter = {return (call.type === "function" &&call.function &&- typeof call.id === "string"+ typeof call.function === "object" &&+ typeof (call.function as Record<string, unknown>).name ===+ "string");}));});if (hasToolCalls) return true;- // Multimodal content+ // OpenAI multimodal content with specific typesconst hasMultimodal = messages.some((msg: unknown) => {const message = msg as Record<string, unknown>;- return Array.isArray(message.content);+ return (+ Array.isArray(message.content) &&+ message.content.some((part: unknown) => {+ if (typeof part !== "object" || !part) return false;+ const p = part as Record<string, unknown>;+ return (+ typeof p.type === "string" &&+ ["text", "image_url", "input_audio"].includes(p.type)+ );+ })+ );});if (hasMultimodal) return true;}}+ // OpenAI output format with choices+ if (+ typeof ctx.metadata === "object" &&+ ctx.metadata !== null &&+ "choices" in ctx.metadata+ ) {+ return true;+ }+return false;},diff --git a/web/src/utils/chatml/core.ts b/web/src/utils/chatml/core.tsindex 1e11cfaeea..361e22d820 100644--- a/web/src/utils/chatml/core.ts+++ b/web/src/utils/chatml/core.ts@@ -37,6 +37,17 @@ export function mapToChatMl(export function mapOutputToChatMl(output: unknown,): ReturnType<typeof ChatMlArraySchema.safeParse> {+ // Check if output has messages key (LangGraph/LangChain format)+ if (+ output &&+ typeof output === "object" &&+ !Array.isArray(output) &&+ "messages" in output+ ) {+ const obj = output as Record<string, unknown>;+ return ChatMlArraySchema.safeParse(obj.messages);+ }+const result = ChatMlArraySchema.safeParse(Array.isArray(output) ? output : [output],);diff --git a/web/src/utils/chatml/integration.clienttest.ts b/web/src/utils/chatml/integration.clienttest.tsindex 4306a898be..52cd7ff845 100644--- a/web/src/utils/chatml/integration.clienttest.ts+++ b/web/src/utils/chatml/integration.clienttest.ts@@ -302,4 +302,62 @@ describe("ChatML Integration", () => {expect(inResult.data[3].role).toBe("user");expect(inResult.data[3].content).not.toContain("[object Object]");});++ it("should handle LangGraph messages with type field", () => {+ const input = {+ messages: [+ {+ content: "Search the web for 'example' and summarize.",+ additional_kwargs: {},+ response_metadata: {},+ type: "human",+ name: null,+ id: "4f5904a4-473c-443c-af46-68765777a2f0",+ example: false,+ },+ {+ content: "",+ additional_kwargs: {+ tool_calls: [+ {+ id: "call_123",+ function: {+ arguments: { query: "example" },+ name: "Web-Search",+ },+ type: "function",+ },+ ],+ },+ type: "ai",+ id: "run-123",+ },+ {+ content: [{ url: "https://example.com", title: "Example Result" }],+ type: "tool",+ name: "Web-Search",+ tool_call_id: "call_123",+ },+ ],+ };++ const ctx = {+ metadata: {+ scope: { name: "langfuse-sdk" },+ framework: "langgraph",+ },+ };++ const inResult = normalizeInput(input, ctx);++ expect(inResult.success).toBe(true);+ if (!inResult.data) throw new Error("Expected data to be defined");+ expect(inResult.data).toHaveLength(3);+ expect(inResult.data[0].role).toBe("user");+ expect(inResult.data[0].content).toBe(+ "Search the web for 'example' and summarize.",+ );+ expect(inResult.data[1].role).toBe("assistant");+ expect(inResult.data[2].role).toBe("tool");+ });});