diff --git a/.changeset/trace-langgraph-background-runs.md b/.changeset/trace-langgraph-background-runs.md new file mode 100644 index 000000000..ecd355045 --- /dev/null +++ b/.changeset/trace-langgraph-background-runs.md @@ -0,0 +1,9 @@ +--- +"braintrust": minor +--- + +feat(langgraph): Trace background runs and joins + +Trace background submissions, batch acknowledgements, joins, and joined +streams in the LangGraph Platform SDK. Match the run and thread IDs to +correlate observations across clients and processes. diff --git a/e2e/config/pr-comment-scenarios.json b/e2e/config/pr-comment-scenarios.json index 93c0df03a..2eb446597 100644 --- a/e2e/config/pr-comment-scenarios.json +++ b/e2e/config/pr-comment-scenarios.json @@ -1079,7 +1079,7 @@ }, { "scenarioDirName": "langgraph-sdk-instrumentation", - "label": "LangGraph Platform SDK Instrumentation", + "label": "LangGraph Platform Run and Background Run Tracing", "metadataScenario": "langgraph-sdk-instrumentation", "variants": [ { diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.json index 8d70349af..31deb5bf2 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.txt index 8d926320a..1a85cb64a 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (cjs, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.json index 344e91949..6818b2b61 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.txt index ce784fccf..9bb522ae4 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (cjs, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.json index 8f50a563c..03bbceba9 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.txt index a8086d9a1..882905f38 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-cjs-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (cjs, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.json index e786295a9..a3b3a75e1 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.txt index c6e3a9063..2f35043ae 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (esm, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.json index 4d173aff5..6812ea730 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.txt index 474ca9f9a..804bc321b 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (esm, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.json index 2ec508c15..ac5ecef51 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.txt index 5f1a6ee98..d52179e84 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-esm-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.9.25 (esm, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.json index 94982f860..8c6c12433 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.txt index cee26683f..b1268ecbf 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (cjs, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.json index 7b821cd93..95fff4af4 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.txt index e68339e55..62afe5580 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (cjs, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.json index 5cc87c4c9..2a9fa47c6 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.txt index 0d4f0f250..ae714d0dd 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-cjs-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (cjs, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.json index b3f479e97..10c6a6c19 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.txt index f41f94002..d58bb4c16 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (esm, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.json index a9d2ced30..6e5c28523 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.txt index d1462c54a..069598dab 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (esm, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.json index 436891068..ff8d84a99 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.txt index 3668ef594..f6333b509 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v1-latest-esm-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 1.12.9 (esm, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.json index 1856bb6f5..b7437e406 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.txt index 89b177efe..6346b82f9 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.json index fa727d100..f385e79ff 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.txt index 089e7ef40..fdfa84d34 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.json index 129e3ffe1..6c98dd892 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.txt index d1fd80f19..4020a5958 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-cjs-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.json index 957c0a426..310be6238 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.txt index eb76f3edd..04b43efb0 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.json index 50a6017d8..25a15cc47 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.txt index 4c971aade..227307d03 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.json index fa7e68e63..af5263376 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.txt index fb04b0524..2fe8ee5be 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-esm-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.json index 1856bb6f5..b7437e406 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.txt index 89b177efe..6346b82f9 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.json index fa727d100..f385e79ff 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.txt index 089e7ef40..fdfa84d34 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.json index 129e3ffe1..6c98dd892 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.txt index d1fd80f19..4020a5958 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-cjs-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (cjs, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "cjs", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.json index 957c0a426..310be6238 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.txt index eb76f3edd..04b43efb0 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-auto.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, auto) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "auto", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.json index 50a6017d8..25a15cc47 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.txt index 4c971aade..227307d03 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-both.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, both) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "both", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.json b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.json index fa7e68e63..af5263376 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.json +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.json @@ -5,8 +5,156 @@ "type": "task", "children": [ { - "name": "Uninstrumented background APIs", - "children": [], + "name": "Background run APIs", + "children": [ + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "messages": [ + { + "content": "Reply with exactly: hello from langgraph", + "role": "user" + } + ] + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "agent", + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "joined stream" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.create", + "type": "task", + "children": [], + "input": { + "value": "cancel" + }, + "output": { + "run_id": "", + "thread_id": "" + }, + "metadata": { + "langgraph.assistant_id": "background", + "langgraph.run_id": "", + "langgraph.thread_id": "", + "streamMode": [ + "values" + ] + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "output": { + "content": "hello from langgraph", + "role": "assistant" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.join", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + }, + "error": "This operation was aborted" + }, + { + "name": "langgraph.runs.createBatch", + "type": "task", + "children": [], + "input": [ + { + "assistant_id": "background", + "input": { + "value": "batch one" + } + }, + { + "assistant_id": "background", + "input": { + "value": "batch two" + } + } + ], + "output": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ], + "metadata": { + "langgraph.runs": [ + { + "run_id": "", + "thread_id": "" + }, + { + "run_id": "", + "thread_id": "" + } + ] + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "output": { + "value": "joined stream" + }, + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + }, + { + "name": "langgraph.runs.joinStream", + "type": "task", + "children": [], + "metadata": { + "langgraph.run_id": "", + "langgraph.thread_id": "" + } + } + ], "metadata": { "operation": "background-apis", "testRunId": "" @@ -494,7 +642,7 @@ } ], "input": { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -505,11 +653,11 @@ } }, "output": { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" }, "metadata": { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.txt b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.txt index fb04b0524..2fe8ee5be 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.txt +++ b/e2e/scenarios/langgraph-sdk-instrumentation/__snapshots__/langgraph-sdk-v2-latest-esm-wrapped.span-tree.txt @@ -1,7 +1,7 @@ span_tree: └── LangGraph SDK 2.0.0 (esm, wrapped) [task] input: { - "description": "Verify synchronous LangGraph run APIs", + "description": "Verify LangGraph run APIs", "prompt": { "messages": [ { @@ -12,11 +12,11 @@ span_tree: } } output: { - "expected_error_cases": 4, + "expected_error_cases": 5, "status": "passed" } metadata: { - "expected_error_cases": 4, + "expected_error_cases": 5, "instrumentation_mode": "wrapped", "module": "esm", "scenario": "langgraph-sdk-instrumentation", @@ -28,7 +28,7 @@ span_tree: "caller_functionname": "runTracedScenario", "caller_lineno": 0 } - ├── Uninstrumented background APIs + ├── Background run APIs │ metadata: { │ "operation": "background-apis", │ "testRunId": "" @@ -38,6 +38,121 @@ span_tree: │ "caller_functionname": "runOperation", │ "caller_lineno": 0 │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "messages": [ + │ │ { + │ │ "content": "Reply with exactly: hello from langgraph", + │ │ "role": "user" + │ │ } + │ │ ] + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "agent", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "joined stream" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.create [task] + │ │ input: { + │ │ "value": "cancel" + │ │ } + │ │ output: { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ metadata: { + │ │ "langgraph.assistant_id": "background", + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "", + │ │ "streamMode": [ + │ │ "values" + │ │ ] + │ │ } + │ ├── langgraph.runs.join [task] + │ │ output: { + │ │ "content": "hello from langgraph", + │ │ "role": "assistant" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ ├── langgraph.runs.join [task] + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ │ error: "This operation was aborted" + │ ├── langgraph.runs.createBatch [task] + │ │ input: [ + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch one" + │ │ } + │ │ }, + │ │ { + │ │ "assistant_id": "background", + │ │ "input": { + │ │ "value": "batch two" + │ │ } + │ │ } + │ │ ] + │ │ output: [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ metadata: { + │ │ "langgraph.runs": [ + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ }, + │ │ { + │ │ "run_id": "", + │ │ "thread_id": "" + │ │ } + │ │ ] + │ │ } + │ ├── langgraph.runs.joinStream [task] + │ │ output: { + │ │ "value": "joined stream" + │ │ } + │ │ metadata: { + │ │ "langgraph.run_id": "", + │ │ "langgraph.thread_id": "" + │ │ } + │ └── langgraph.runs.joinStream [task] + │ metadata: { + │ "langgraph.run_id": "", + │ "langgraph.thread_id": "" + │ } ├── Wait for final result │ metadata: { │ "operation": "wait", diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/graph.mjs b/e2e/scenarios/langgraph-sdk-instrumentation/graph.mjs index c44270d0e..dd948c116 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/graph.mjs +++ b/e2e/scenarios/langgraph-sdk-instrumentation/graph.mjs @@ -4,6 +4,7 @@ import { START, StateGraph, MessagesAnnotation, + Annotation, interrupt, } from "@langchain/langgraph"; @@ -45,3 +46,13 @@ export const failing = new StateGraph(MessagesAnnotation) .addEdge(START, "fail") .addEdge("fail", END) .compile(); + +// Exercise background execution without making additional model requests. +const backgroundState = Annotation.Root({ + value: Annotation(), +}); +export const background = new StateGraph(backgroundState) + .addNode("echo", (state) => ({ value: state.value })) + .addEdge(START, "echo") + .addEdge("echo", END) + .compile(); diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/scenario.mjs b/e2e/scenarios/langgraph-sdk-instrumentation/scenario.mjs index 016339a6e..3cfaa4b72 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/scenario.mjs +++ b/e2e/scenarios/langgraph-sdk-instrumentation/scenario.mjs @@ -50,6 +50,14 @@ runMain(async () => { const client = wrapped ? braintrust.wrapLangGraphSDK(raw) : raw; if (wrapped) assert.equal(braintrust.wrapLangGraphSDK(client), client); assert.equal(client.threads, raw.threads); + const observerClient = new Client({ + apiUrl, + apiKey: null, + callerOptions: { maxRetries: 0 }, + }); + const observer = wrapped + ? braintrust.wrapLangGraphSDK(observerClient) + : observerClient; const options = { input, metadata: { secret: "DO_NOT_CAPTURE" }, @@ -65,18 +73,18 @@ runMain(async () => { sdk_version: process.env.LANGGRAPH_SDK_VERSION, module: process.env.LANGGRAPH_SDK_MODULE, instrumentation_mode: process.env.LANGGRAPH_SDK_MODE, - expected_error_cases: 4, + expected_error_cases: 5, }, callback: async () => { const root = braintrust.currentSpan(); root.log({ input: { - description: "Verify synchronous LangGraph run APIs", + description: "Verify LangGraph run APIs", prompt: input, }, }); await runOperation( - "Uninstrumented background APIs", + "Background run APIs", "background-apis", async () => { const background = await client.threads.create(); @@ -85,11 +93,57 @@ runMain(async () => { "agent", options, ); - await client.runs.join(background.thread_id, run.run_id); + await observer.runs.join(background.thread_id, run.run_id); assert.equal( (await client.runs.get(background.thread_id, run.run_id)).status, "success", ); + const submitted = await client.runs.createBatch([ + { assistantId: "background", input: { value: "batch one" } }, + { assistantId: "background", input: { value: "batch two" } }, + ]); + assert.equal(submitted.length, 2); + for (const { thread_id, run_id } of submitted) { + assert.ok(thread_id); + assert.ok(run_id); + } + + for (const cancel of [false, true]) { + const thread = await client.threads.create(); + const streamRun = await client.runs.create( + thread.thread_id, + "background", + { + input: { value: cancel ? "cancel" : "joined stream" }, + streamMode: ["values"], + }, + ); + const stream = observer.runs.joinStream( + thread.thread_id, + streamRun.run_id, + ); + assert.equal(stream[Symbol.asyncIterator](), stream); + if (cancel) { + const first = await stream.next(); + assert.equal(first.value.event, "metadata"); + assert.equal((await stream.return()).done, true); + } else { + const events = []; + for await (const event of stream) events.push(event); + assert.ok( + events.some( + ({ event, data }) => + event === "values" && data.value === "joined stream", + ), + ); + } + } + await assert.rejects( + observer.runs.join(background.thread_id, run.run_id, { + signal: AbortSignal.abort(), + }), + /abort|cancel/i, + ); }, ); @@ -230,7 +284,7 @@ runMain(async () => { }), ); }); - root.log({ output: { status: "passed", expected_error_cases: 4 } }); + root.log({ output: { status: "passed", expected_error_cases: 5 } }); }, }); // Compare logged metrics with the untouched real SDK responses, outside diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/scenario.test.ts b/e2e/scenarios/langgraph-sdk-instrumentation/scenario.test.ts index 8104c5f8d..3e25811db 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/scenario.test.ts +++ b/e2e/scenarios/langgraph-sdk-instrumentation/scenario.test.ts @@ -85,19 +85,15 @@ describe.concurrent("variants", () => { sdk_version: version, module, instrumentation_mode: mode, - expected_error_cases: 4, + expected_error_cases: 5, }); expect(root.output).toEqual({ status: "passed", - expected_error_cases: 4, + expected_error_cases: 5, }); expect(events.every((event) => event.span.ended)).toBe(true); const operationSpecs = [ - [ - "background", - "Uninstrumented background APIs", - "background-apis", - ], + ["background", "Background run APIs", "background-apis"], ["wait", "Wait for final result", "wait"], [ "interruptResume", @@ -129,23 +125,66 @@ describe.concurrent("variants", () => { (typeof operationSpecs)[number][0], (typeof events)[number] >; - expect( - events.filter((event) => - event.span.parentIds.includes( - operations.background.span.id!, - ), - ), - ).toEqual([]); if (mode === "disabled") { expect(instrumented).toHaveLength(0); expect(events).toHaveLength(13); return; } - expect(events).toHaveLength(26); - expect(instrumented).toHaveLength(13); + expect(events).toHaveLength(34); + expect(instrumented).toHaveLength(21); expect( instrumented.filter((event) => event.row.error), - ).toHaveLength(4); + ).toHaveLength(5); + const backgroundSpans = (name: string) => + findChildSpans( + rawEvents, + `langgraph.runs.${name}`, + operations.background.span.id, + ); + const submissions = backgroundSpans("create"); + const joins = backgroundSpans("join"); + const streams = backgroundSpans("joinStream"); + const batches = backgroundSpans("createBatch"); + expect(submissions).toHaveLength(3); + expect(joins).toHaveLength(2); + expect(streams).toHaveLength(2); + expect(batches).toHaveLength(1); + for (const [submitted, consumed] of [ + [submissions[0], joins[0]], + [submissions[1], streams[0]], + [submissions[2], streams[1]], + ]) { + const ids = { + "langgraph.thread_id": expect.any(String), + "langgraph.run_id": expect.any(String), + }; + expect(submitted.metadata).toMatchObject(ids); + expect(consumed.metadata).toMatchObject(ids); + expect(consumed.metadata?.["langgraph.thread_id"]).toEqual( + submitted.metadata?.["langgraph.thread_id"], + ); + expect(consumed.metadata?.["langgraph.run_id"]).toEqual( + submitted.metadata?.["langgraph.run_id"], + ); + expect(submitted.output).toEqual({ + thread_id: submitted.metadata?.["langgraph.thread_id"], + run_id: submitted.metadata?.["langgraph.run_id"], + }); + expect(submitted.metrics).not.toHaveProperty("tokens"); + } + expect(joins[0].output).toEqual({ + role: "assistant", + content: "hello from langgraph", + }); + expect(joins[1].row.error).toMatch(/abort|cancel/i); + expect(streams[0].output).toEqual({ value: "joined stream" }); + expect(streams[1].output).toBeUndefined(); + expect(batches[0].output).toEqual( + Array.from({ length: 2 }, () => ({ + thread_id: expect.any(String), + run_id: expect.any(String), + })), + ); for (const event of instrumented) { expect(event.span.type).toBe("task"); expect(event.context?.span_origin).toMatchObject({ diff --git a/e2e/scenarios/langgraph-sdk-instrumentation/server.mjs b/e2e/scenarios/langgraph-sdk-instrumentation/server.mjs index 5adf33c06..6f01d01d4 100644 --- a/e2e/scenarios/langgraph-sdk-instrumentation/server.mjs +++ b/e2e/scenarios/langgraph-sdk-instrumentation/server.mjs @@ -27,6 +27,7 @@ try { graphs: { agent: `${graphPath}:agent`, approval: `${graphPath}:approval`, + background: `${graphPath}:background`, failing: `${graphPath}:failing`, }, }); diff --git a/js/src/auto-instrumentations/configs/langgraph-sdk.ts b/js/src/auto-instrumentations/configs/langgraph-sdk.ts index 001a701a5..9c006c8f6 100644 --- a/js/src/auto-instrumentations/configs/langgraph-sdk.ts +++ b/js/src/auto-instrumentations/configs/langgraph-sdk.ts @@ -7,7 +7,9 @@ export const langGraphSDKConfigs: InstrumentationConfig[] = [ { versionRange: ">=2.0.0 <3.0.0", filePath: "dist/client" }, ].flatMap(({ versionRange, filePath }) => ["js", "cjs"].flatMap((extension) => - (["wait", "stream"] as const).map((methodName) => ({ + ( + ["wait", "stream", "create", "createBatch", "join", "joinStream"] as const + ).map((methodName) => ({ channelName: langGraphSDKChannels[methodName].channelName, module: { name: "@langchain/langgraph-sdk", diff --git a/js/src/instrumentation/README.md b/js/src/instrumentation/README.md index 10f2e9e28..51694b81f 100644 --- a/js/src/instrumentation/README.md +++ b/js/src/instrumentation/README.md @@ -245,3 +245,23 @@ Test at the narrowest useful layers: After instrumentation changes, run e2e tests in cassette replay mode. When an e2e scenario itself changes, run it three times to catch flakes. + +## LangGraph Platform background runs + +When you preload `braintrust/hook.mjs` or pass a LangGraph Platform client to +`wrapLangGraphSDK(client)`, Braintrust traces `runs.create`, +`runs.createBatch`, `runs.join`, and `runs.joinStream` alongside +`runs.wait` and `runs.stream`. + +- `langgraph.runs.create` and `langgraph.runs.createBatch` measure the time + until the Platform acknowledges submission. Their output contains the + returned run and thread IDs. +- `langgraph.runs.join` measures the request waiting for an existing run and + records its returned state. `langgraph.runs.joinStream` observes the + stream until it finishes, fails, or the caller closes it. +- Match `langgraph.run_id` and `langgraph.thread_id` across submissions and + later joins, even when separate processes make the calls. For batches, + `langgraph.runs` lists the run and thread ID pairs. Each operation keeps + its caller's active span as its parent. +- Observing an existing run does not count its tokens again. To see + execution-side spans, instrument the graph's server separately. diff --git a/js/src/instrumentation/providers/langgraph-sdk-instrumentation.test.ts b/js/src/instrumentation/providers/langgraph-sdk-instrumentation.test.ts index bd180cf2f..01f1f5e44 100644 --- a/js/src/instrumentation/providers/langgraph-sdk-instrumentation.test.ts +++ b/js/src/instrumentation/providers/langgraph-sdk-instrumentation.test.ts @@ -52,6 +52,123 @@ describe("LangGraph SDK instrumentation", () => { ]); }); + it("correlates an acknowledged background run with a separate join", async () => { + const acknowledgement = Object.assign( + Promise.resolve({ + run_id: "run-1", + thread_id: "thread-1", + status: "pending", + metadata: { secret: "private" }, + }), + { helper: () => "unchanged" }, + ); + const created = langGraphSDKChannels.create.invoke( + () => acknowledgement, + undefined, + [null, "agent", { input: "question" }], + {}, + ); + expect(created).toBe(acknowledgement); + expect(created.helper()).toBe("unchanged"); + await created; + await langGraphSDKChannels.join.invoke( + async () => ({ answer: "yes" }), + {}, + ["thread-1", "run-1"], + {}, + ); + const spans = await backgroundLogger.drain(); + expect(spans).toMatchObject([ + { + input: "question", + output: { run_id: "run-1", thread_id: "thread-1" }, + metadata: { + "langgraph.run_id": "run-1", + "langgraph.thread_id": "thread-1", + }, + }, + { + output: { answer: "yes" }, + metadata: { + "langgraph.run_id": "run-1", + "langgraph.thread_id": "thread-1", + }, + }, + ]); + expect(JSON.stringify(spans)).not.toContain("private"); + expect(spans[0]).toHaveProperty("output", { + run_id: "run-1", + thread_id: "thread-1", + }); + }); + + it("records commands and normalized input for batch submissions", async () => { + const options = { metadata: { secret: "private" } }; + const payloads = [ + { assistantId: "agent", command: { resume: "yes" }, ...options }, + { + assistantId: "agent", + input: { messages: [{ type: "human", content: "question" }] }, + ...options, + }, + ]; + const acknowledgement = Promise.resolve([ + { thread_id: "thread-1", run_id: "run-1" }, + { thread_id: "thread-2", run_id: "run-2" }, + ]); + const result = langGraphSDKChannels.createBatch.invoke( + (batch) => { + expect(batch).toBe(payloads); + return acknowledgement; + }, + undefined, + [payloads], + {}, + ); + expect(result).toBe(acknowledgement); + const output = await result; + const spans = await backgroundLogger.drain(); + expect(spans).toHaveLength(1); + expect(spans[0]).toHaveProperty("input", [ + { assistant_id: "agent", command: { resume: "yes" } }, + { + assistant_id: "agent", + input: { messages: [{ role: "user", content: "question" }] }, + }, + ]); + expect(spans[0]).toHaveProperty("output", output); + expect(spans[0]).toHaveProperty("metadata", { "langgraph.runs": output }); + }); + + it("retains joined-stream identity and finalizes on cancellation", async () => { + const controller = new AbortController(); + const original = (async function* () { + yield { event: "metadata", data: { run_id: "run-1" } }; + yield { event: "values", data: { answer: "unconsumed" } }; + })(); + const result = langGraphSDKChannels.joinStream.invoke( + (_threadId, _runId, options) => { + expect(options).toBe(controller.signal); + return original; + }, + undefined, + ["thread-1", "run-1", controller.signal], + {}, + ); + expect(result).toBe(original); + await result.next(); + await result.return(undefined); + expect(await backgroundLogger.drain()).toMatchObject([ + { + metadata: { + "langgraph.run_id": "run-1", + "langgraph.thread_id": "thread-1", + }, + metrics: { end: expect.any(Number) }, + }, + ]); + }); + it("preserves synchronous exceptions and rejected error identity", async () => { const error = new Error("original failure"); expect(() => diff --git a/js/src/instrumentation/providers/langgraph-sdk-instrumentation.ts b/js/src/instrumentation/providers/langgraph-sdk-instrumentation.ts index 30577e70f..cf6819a2d 100644 --- a/js/src/instrumentation/providers/langgraph-sdk-instrumentation.ts +++ b/js/src/instrumentation/providers/langgraph-sdk-instrumentation.ts @@ -7,6 +7,9 @@ import { } from "../../span-origin"; import { getCurrentUnixTimestamp } from "../../util"; import type { + LangGraphBatchArgs, + LangGraphJoinArgs, + LangGraphJoinStreamArgs, LangGraphRunArgs, LangGraphStreamEvent, } from "../../vendor-sdk-types/langgraph-sdk"; @@ -19,10 +22,34 @@ import { langGraphSDKChannels } from "./langgraph-sdk-interceptors"; export function registerLangGraphSDKInstrumentation(): void { langGraphSDKChannels.wait.intercept((target, self, args) => - instrumentRun("wait", args, () => Reflect.apply(target, self, args)), + instrumentRun({ operation: "wait", args }, () => + Reflect.apply(target, self, args), + ), ); langGraphSDKChannels.stream.intercept((target, self, args) => - instrumentRun("stream", args, () => Reflect.apply(target, self, args)), + instrumentRun({ operation: "stream", args }, () => + Reflect.apply(target, self, args), + ), + ); + langGraphSDKChannels.create.intercept((target, self, args) => + instrumentRun({ operation: "create", args }, () => + Reflect.apply(target, self, args), + ), + ); + langGraphSDKChannels.createBatch.intercept((target, self, args) => + instrumentRun({ operation: "createBatch", args }, () => + Reflect.apply(target, self, args), + ), + ); + langGraphSDKChannels.join.intercept((target, self, args) => + instrumentRun({ operation: "join", args }, () => + Reflect.apply(target, self, args), + ), + ); + langGraphSDKChannels.joinStream.intercept((target, self, args) => + instrumentRun({ operation: "joinStream", args }, () => + Reflect.apply(target, self, args), + ), ); } @@ -210,30 +237,71 @@ function normalizeRunOutput(value: unknown, input: unknown): unknown { : result; } -function instrumentRun( - operation: "wait" | "stream", - [threadId, assistantId, options]: LangGraphRunArgs, - invoke: () => T, -): T { +type RunInvocation = + | { operation: "wait" | "stream" | "create"; args: LangGraphRunArgs } + | { operation: "createBatch"; args: LangGraphBatchArgs } + | { operation: "join"; args: LangGraphJoinArgs } + | { operation: "joinStream"; args: LangGraphJoinStreamArgs }; + +function submissionResult(value: unknown) { + if (!isObject(value)) return {}; + return { + ...(typeof value.run_id === "string" ? { run_id: value.run_id } : {}), + ...(typeof value.thread_id === "string" + ? { thread_id: value.thread_id } + : {}), + }; +} + +function instrumentRun(invocation: RunInvocation, invoke: () => T): T { if (isAutoInstrumentationSuppressed()) return invoke(); + const { operation } = invocation; const start = getCurrentUnixTimestamp(); let span: Span; + let runInput: unknown; try { - // The remote server owns the agent loop. These client task spans do not - // invent LLM/tool children or token counts that the server has not exposed. - const metadata: Record = { - "langgraph.thread_id": threadId, - "langgraph.assistant_id": assistantId, - }; - for (const key of [ - "streamMode", - "streamSubgraphs", - "interruptBefore", - "interruptAfter", - "multitaskStrategy", - "durability", - ] as const) { - if (options?.[key] !== undefined) metadata[key] = options[key]; + // The remote agent runs asynchronously; submission timings measure only the acknowledgement. + const metadata: Record = {}; + let input: unknown; + if (invocation.operation === "createBatch") { + input = invocation.args[0].map(({ assistantId, input, command }) => ({ + assistant_id: assistantId, + input: normalizeState(input), + ...(command === undefined ? {} : { command }), + })); + } else if ( + invocation.operation === "join" || + invocation.operation === "joinStream" + ) { + const [threadId, runId, options] = invocation.args; + metadata["langgraph.thread_id"] = threadId; + metadata["langgraph.run_id"] = runId; + if ( + options && + "cancelOnDisconnect" in options && + typeof options.cancelOnDisconnect === "boolean" + ) { + metadata.cancelOnDisconnect = options.cancelOnDisconnect; + } + } else { + const [threadId, assistantId, options] = invocation.args; + metadata["langgraph.thread_id"] = threadId; + metadata["langgraph.assistant_id"] = assistantId; + for (const key of [ + "streamMode", + "streamSubgraphs", + "interruptBefore", + "interruptAfter", + "multitaskStrategy", + "durability", + ] as const) { + if (options?.[key] !== undefined) metadata[key] = options[key]; + } + runInput = options?.input; + input = + options?.command === undefined + ? normalizeState(runInput) + : { input: normalizeState(runInput), command: options.command }; } span = startSpan( withSpanInstrumentationName( @@ -241,13 +309,7 @@ function instrumentRun( name: `langgraph.runs.${operation}`, spanAttributes: { type: SpanTypeAttribute.TASK }, event: { - input: - options?.command === undefined - ? normalizeState(options?.input) - : { - input: normalizeState(options.input), - command: options.command, - }, + input, metadata, }, }, @@ -266,7 +328,9 @@ function instrumentRun( const updates: unknown[] = []; const usageByMessage = new Map>(); const captureUsage = (id: string, usage: unknown) => { - if (!isObject(usage)) return; + // A joined run may be read repeatedly or contain earlier turns. + if (operation === "join" || operation === "joinStream" || !isObject(usage)) + return; const metrics: Record = {}; for (const [source, destination] of [ ["input_tokens", "prompt_tokens"], @@ -291,6 +355,26 @@ function instrumentRun( if (ended) return; ended = true; try { + if (error === undefined && operation === "create") { + const result = submissionResult(output); + span.log({ + output: result, + metadata: { + ...(result.run_id === undefined + ? {} + : { "langgraph.run_id": result.run_id }), + ...(result.thread_id === undefined + ? {} + : { "langgraph.thread_id": result.thread_id }), + }, + }); + return; + } + if (error === undefined && operation === "createBatch") { + const runs = Array.isArray(output) ? output.map(submissionResult) : []; + span.log({ output: runs, metadata: { "langgraph.runs": runs } }); + return; + } const metrics: Record = {}; for (const usage of usageByMessage.values()) { for (const [key, value] of Object.entries(usage)) @@ -301,7 +385,7 @@ function instrumentRun( const finalMessages = [ ...new Map([...messages, ...messageSnapshots]).values(), ]; - let loggedOutput = normalizeRunOutput(output, options?.input); + let loggedOutput = normalizeRunOutput(output, runInput); if (loggedOutput === undefined && finalMessages.length) loggedOutput = normalizeRunOutput( { messages: finalMessages }, @@ -309,7 +393,7 @@ function instrumentRun( ); if (output === undefined && !finalMessages.length && updates.length) { const results = updates - .map((update) => normalizeRunOutput(update, options?.input)) + .map((update) => normalizeRunOutput(update, runInput)) .filter((update) => update !== undefined); if (results.length) loggedOutput = { updates: results }; } @@ -328,18 +412,19 @@ function instrumentRun( }); } catch (error) { debugLogger.error("Error logging LangGraph SDK span:", error); - } - try { - span.end(); - } catch (error) { - debugLogger.error("Error ending LangGraph SDK span:", error); + } finally { + try { + span.end(); + } catch (error) { + debugLogger.error("Error ending LangGraph SDK span:", error); + } } }; const observeMessages = (value: unknown, streaming: boolean) => { if (!isObject(value) || !Array.isArray(value.messages)) return; const inputMessages = - isObject(options?.input) && Array.isArray(options.input.messages) - ? options.input.messages + isObject(runInput) && Array.isArray(runInput.messages) + ? runInput.messages : []; for (const message of value.messages) { if ( @@ -377,8 +462,14 @@ function instrumentRun( const onChunk = ({ event, data }: LangGraphStreamEvent) => { if (ended) return; if (event === "metadata" && isObject(data)) { - if (typeof data.run_id === "string") - span.log({ metadata: { "langgraph.run_id": data.run_id } }); + const { run_id, thread_id } = submissionResult(data); + const metadata = { + ...(run_id === undefined ? {} : { "langgraph.run_id": run_id }), + ...(operation !== "joinStream" || thread_id === undefined + ? {} + : { "langgraph.thread_id": thread_id }), + }; + if (Object.keys(metadata).length > 0) span.log({ metadata }); } else if (event === "error") { streamError = normalizeRunError(data); } else if (event === "values") { @@ -448,7 +539,7 @@ function instrumentRun( finish(error); throw error; } - if (operation === "stream") { + if (operation === "stream" || operation === "joinStream") { try { patchStreamIfNeeded(result, { shouldCollect: (chunk) => { @@ -478,9 +569,11 @@ function instrumentRun( (value) => { try { output = value; - observeMessages(value, false); - if (isObject(value) && isObject(value.__error__)) - streamError = normalizeRunError(value.__error__); + if (operation !== "create" && operation !== "createBatch") { + observeMessages(value, false); + if (isObject(value) && isObject(value.__error__)) + streamError = normalizeRunError(value.__error__); + } finish(); } catch (error) { finish(error); diff --git a/js/src/instrumentation/providers/langgraph-sdk-interceptors.ts b/js/src/instrumentation/providers/langgraph-sdk-interceptors.ts index 31382155a..5a537cd5b 100644 --- a/js/src/instrumentation/providers/langgraph-sdk-interceptors.ts +++ b/js/src/instrumentation/providers/langgraph-sdk-interceptors.ts @@ -1,4 +1,7 @@ import type { + LangGraphBatchArgs, + LangGraphJoinArgs, + LangGraphJoinStreamArgs, LangGraphRunArgs, LangGraphStreamEvent, } from "../../vendor-sdk-types/langgraph-sdk"; @@ -7,6 +10,21 @@ import { channel, defineInterceptor } from "../core/interceptor-definitions"; export const langGraphSDKChannels = defineInterceptor( "@langchain/langgraph-sdk", { + create: channel>({ + channelName: "runs.create", + }), + createBatch: channel>({ + channelName: "runs.createBatch", + }), + join: channel>({ + channelName: "runs.join", + }), + joinStream: channel< + LangGraphJoinStreamArgs, + AsyncGenerator + >({ + channelName: "runs.joinStream", + }), wait: channel>({ channelName: "runs.wait", }), diff --git a/js/src/vendor-sdk-types/langgraph-sdk.ts b/js/src/vendor-sdk-types/langgraph-sdk.ts index a9f7ae9dc..49a65f75d 100644 --- a/js/src/vendor-sdk-types/langgraph-sdk.ts +++ b/js/src/vendor-sdk-types/langgraph-sdk.ts @@ -1,4 +1,4 @@ -/** Minimal public surfaces of @langchain/langgraph-sdk >=1.9.25 <2. */ +/** Minimal public surfaces of @langchain/langgraph-sdk >=1.9.25 <3. */ export interface LangGraphRunOptions { input?: unknown; command?: unknown; @@ -16,6 +16,28 @@ export type LangGraphRunArgs = [ options?: LangGraphRunOptions, ]; +export type LangGraphBatchArgs = [ + payloads: (LangGraphRunOptions & { assistantId: string })[], + options?: { signal?: AbortSignal }, +]; + +export type LangGraphJoinArgs = [ + threadId: string, + runId: string, + options?: { cancelOnDisconnect?: boolean; signal?: AbortSignal }, +]; + +export type LangGraphJoinStreamArgs = [ + threadId: string | null | undefined, + runId: string, + options?: + | AbortSignal + | { + cancelOnDisconnect?: boolean; + signal?: AbortSignal; + }, +]; + export interface LangGraphStreamEvent { event: string; data: unknown; @@ -23,6 +45,12 @@ export interface LangGraphStreamEvent { export interface LangGraphSDKClient { runs: { + create?(...args: LangGraphRunArgs): PromiseLike; + createBatch?(...args: LangGraphBatchArgs): PromiseLike; + join?(...args: LangGraphJoinArgs): PromiseLike; + joinStream?( + ...args: LangGraphJoinStreamArgs + ): AsyncGenerator; wait(...args: LangGraphRunArgs): PromiseLike; stream(...args: LangGraphRunArgs): AsyncGenerator; }; diff --git a/js/src/wrappers/langgraph-sdk.ts b/js/src/wrappers/langgraph-sdk.ts index b099efc73..d61543ebc 100644 --- a/js/src/wrappers/langgraph-sdk.ts +++ b/js/src/wrappers/langgraph-sdk.ts @@ -6,7 +6,7 @@ import type { LangGraphSDKClient } from "../vendor-sdk-types/langgraph-sdk"; const clients = new WeakMap(); -/** Trace LangGraph Platform runs that the caller waits for or streams. */ +/** Trace LangGraph Platform run submission and result consumption. */ export function wrapLangGraphSDK(client: T): T { registerInstrumentation(); const runsClient = isObject(client) ? client.runs : undefined; @@ -24,6 +24,34 @@ export function wrapLangGraphSDK(client: T): T { const runs = new Proxy(sdk.runs, { get(target, key) { switch (key) { + case "create": { + const method = target.create; + if (typeof method === "function") + return (...args: Parameters) => + langGraphSDKChannels.create.invoke(method, target, args, {}); + return method; + } + case "createBatch": { + const method = target.createBatch; + if (typeof method === "function") + return (...args: Parameters) => + langGraphSDKChannels.createBatch.invoke(method, target, args, {}); + return method; + } + case "join": { + const method = target.join; + if (typeof method === "function") + return (...args: Parameters) => + langGraphSDKChannels.join.invoke(method, target, args, {}); + return method; + } + case "joinStream": { + const method = target.joinStream; + if (typeof method === "function") + return (...args: Parameters) => + langGraphSDKChannels.joinStream.invoke(method, target, args, {}); + return method; + } case "wait": return (...args: Parameters) => langGraphSDKChannels.wait.invoke(target.wait, target, args, {});