Skip to content

Commit e1678d2

Browse files
dgerogclaude
andcommitted
Clarify session ID alignment requirement in LangFuse telemetry docs
Added prominent warning explaining that the session ID returned by the agent's thread_init must match the session ID registered in LangFuse, and how to use a different meta-variable if the field name differs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6c5a51a commit e1678d2

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

docs/docs/integrations/telemetry.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,18 @@ Extracts metadata from each chat response using `extraction_map`. No separate AP
7272
**Setup:**
7373

7474
1. Enable LangFuse tracing in your agent (e.g., `langfuse.langchain.CallbackHandler`)
75-
2. Ensure your agent passes `session_id` to LangFuse via `propagate_attributes(session_id=session_id)`
76-
3. Create a Basic auth token from your LangFuse public + secret keys: `base64(public_key:secret_key)`
75+
2. Create a Basic auth token from your LangFuse public + secret keys: `base64(public_key:secret_key)`
76+
77+
!!! warning "Session ID alignment is critical"
78+
Humanbound uses `$session_id` in the telemetry endpoint URL to fetch traces from LangFuse. This variable is replaced with the value of `session_id` returned by your agent's `thread_init` response.
79+
80+
**Your agent must do two things:**
81+
82+
1. **Return the session ID as `session_id` in the `thread_init` response.** When Humanbound calls your agent's session creation endpoint, the response must include a field called `session_id`. This is what `$session_id` gets replaced with. If your agent returns the session ID under a different name (e.g., `thread_id`, `conversation_id`), use that name instead: `$thread_id`, `$conversation_id`, etc.
83+
84+
2. **Register traces in LangFuse under the same session ID.** Your agent must pass the exact same session ID to LangFuse when logging traces. For LangGraph/LangChain agents, this means using `propagate_attributes(session_id=session_id)` or passing `session_id` to the `CallbackHandler`. If LangFuse traces are registered under a different ID than what your agent returns to Humanbound, the telemetry fetch will return empty data.
85+
86+
In short: the session ID your agent gives Humanbound and the session ID your agent gives LangFuse must be the same value.
7787

7888
**Configuration:**
7989

@@ -90,6 +100,12 @@ Extracts metadata from each chat response using `extraction_map`. No separate AP
90100
}
91101
```
92102

103+
If your agent returns the session under a different field name, adjust the meta-variable accordingly:
104+
105+
```json
106+
"endpoint": "https://cloud.langfuse.com/api/public/sessions/$conversation_id"
107+
```
108+
93109
Generate the Basic auth token:
94110

95111
```bash

0 commit comments

Comments
 (0)