Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/trace-langgraph-background-runs.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion e2e/config/pr-comment-scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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": [
{
Expand All @@ -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",
Expand All @@ -28,7 +28,7 @@ span_tree:
"caller_functionname": "runTracedScenario",
"caller_lineno": 0
}
├── Uninstrumented background APIs
├── Background run APIs
│ metadata: {
│ "operation": "background-apis",
│ "testRunId": "<run:1>"
Expand All @@ -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": "<uuid:1>",
│ │ "thread_id": "<uuid:2>"
│ │ }
│ │ metadata: {
│ │ "langgraph.assistant_id": "agent",
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>"
│ │ }
│ ├── langgraph.runs.create [task]
│ │ input: {
│ │ "value": "joined stream"
│ │ }
│ │ output: {
│ │ "run_id": "<uuid:1>",
│ │ "thread_id": "<uuid:2>"
│ │ }
│ │ metadata: {
│ │ "langgraph.assistant_id": "background",
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>",
│ │ "streamMode": [
│ │ "values"
│ │ ]
│ │ }
│ ├── langgraph.runs.create [task]
│ │ input: {
│ │ "value": "cancel"
│ │ }
│ │ output: {
│ │ "run_id": "<uuid:1>",
│ │ "thread_id": "<uuid:2>"
│ │ }
│ │ metadata: {
│ │ "langgraph.assistant_id": "background",
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>",
│ │ "streamMode": [
│ │ "values"
│ │ ]
│ │ }
│ ├── langgraph.runs.join [task]
│ │ output: {
│ │ "content": "hello from langgraph",
│ │ "role": "assistant"
│ │ }
│ │ metadata: {
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>"
│ │ }
│ ├── langgraph.runs.join [task]
│ │ metadata: {
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>"
│ │ }
│ │ 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": "<uuid:1>",
│ │ "thread_id": "<uuid:2>"
│ │ },
│ │ {
│ │ "run_id": "<uuid:3>",
│ │ "thread_id": "<uuid:4>"
│ │ }
│ │ ]
│ │ metadata: {
│ │ "langgraph.runs": [
│ │ {
│ │ "run_id": "<uuid:1>",
│ │ "thread_id": "<uuid:2>"
│ │ },
│ │ {
│ │ "run_id": "<uuid:3>",
│ │ "thread_id": "<uuid:4>"
│ │ }
│ │ ]
│ │ }
│ ├── langgraph.runs.joinStream [task]
│ │ output: {
│ │ "value": "joined stream"
│ │ }
│ │ metadata: {
│ │ "langgraph.run_id": "<uuid:2>",
│ │ "langgraph.thread_id": "<uuid:1>"
│ │ }
│ └── langgraph.runs.joinStream [task]
│ metadata: {
│ "langgraph.run_id": "<uuid:2>",
│ "langgraph.thread_id": "<uuid:1>"
│ }
├── Wait for final result
│ metadata: {
│ "operation": "wait",
Expand Down
Loading