Title: Found different `gen_ai.conversation.id` value in invoke_agent LangGraph span · Issue #157 · SAP/cloud-sdk-python · GitHub
Open Graph Title: Found different `gen_ai.conversation.id` value in invoke_agent LangGraph span · Issue #157 · SAP/cloud-sdk-python
X Title: Found different `gen_ai.conversation.id` value in invoke_agent LangGraph span · Issue #157 · SAP/cloud-sdk-python
Description: Describe the Bug EDIT on 15 June: I am using auto_instrument() from sap-cloud-sdk, so the span is auto generated by the tracer instead of using the custom invoke_agent_span() function mentioned in this user guide. Based on this All-in on...
Open Graph Description: Describe the Bug EDIT on 15 June: I am using auto_instrument() from sap-cloud-sdk, so the span is auto generated by the tracer instead of using the custom invoke_agent_span() function mentioned in ...
X Description: Describe the Bug EDIT on 15 June: I am using auto_instrument() from sap-cloud-sdk, so the span is auto generated by the tracer instead of using the custom invoke_agent_span() function mentioned in ...
Opengraph URL: https://github.com/SAP/cloud-sdk-python/issues/157
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Found different `gen_ai.conversation.id` value in invoke_agent LangGraph span","articleBody":"### Describe the Bug\n\nEDIT on 15 June: I am using `auto_instrument()` from `sap-cloud-sdk`, so the span is auto generated by the tracer instead of using the custom `invoke_agent_span()` function mentioned in this [user guide](https://github.com/SAP/cloud-sdk-python/blob/main/src/sap_cloud_sdk/core/telemetry/user-guide.md).\n\nBased on this [All-in on AI decision](https://github.tools.sap/CPA/landing-page-content/blob/main/40_Results/all-in-on-ai-decisions/conversation-id-baggage-for-online-agent-evaluation.md), the calling system (that calls an agent) must generate a conversation identifier and set it in the W3C baggage header on every request within a conversation. However, when I use `sap-cloud-sdk` to instrument a LangGraph agent, there is a different value of `gen_ai.conversation.id` in the invoke_agent LangGraph span set by `traceloop`, which derives the conversation ID from the context id of the A2A server of a LangGraph agent. When `gen_ai.conversation.id` is set in the W3C baggage header, all spans have the same `gen_ai.conversation.id` value **EXCEPT** the invoke_agent LangGraph span, which is an inconsistency.\n\n### Steps to Reproduce\n\n1. Run a LangGraph agent in https://github.tools.sap/Montana-AI-Singapore/a2a-server-samples/tree/main/appfnd-langgraph-basic and use `auto_instrument()` from `sap-cloud-sdk`\n2. Copy `.env.example` and fill up the variables accordingly. I used a local MLflow server and sent the traces via http/protobuf\n3. Run the agent `uv run app` and send a message to the agent and inject `gen_ai.conversation.id` in the W3C baggage header\n\nThis is how the trace spans look:\nRoot span: `gen_ai.conversation.id == 48e35936-82ab-4f1a-beaf-b2fa4273ac5e`, generated by the calling system\n\u003cimg width=\"1529\" height=\"766\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/61dbce11-3a95-4fb1-ba4f-578f79f25aa3\" /\u003e\n\ninvoke_agent LangGraph span: `gen_ai.conversation.id == b01915bf-48a2-4f8b-9681-19bc166553c5`\n\u003cimg width=\"1529\" height=\"777\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/31164be9-35f5-4438-ac9f-3adc2fbd1195\" /\u003e\n\n### Expected Behavior\n\nI expect to see consistent values of `gen_ai.conversation.id` in all the spans in my trace, following the decision on All-in on AI. This could mean:\n- blocking traceloop from setting `gen_ai.conversation.id` from `traceloop.association.properties.thread_id`, or\n- overriding the value in invoke_agent LangGraph span such that the value is consistent.\n\n### Screenshots\n\n_No response_\n\n### Used Versions\n\n- Python version via `python --version`: 3.12.12\n- SAP Cloud SDK for Python version: 0.19.3, but tested on 0.25.1 in a colleague's env\n- Framework version (if applicable, e.g., Flask, FastAPI): ...\n\n\u003cdetails\u003e\u003csummary\u003eInstalled packages via \u003ccode\u003epip list\u003c/code\u003e or \u003ccode\u003euv pip list\u003c/code\u003e\u003c/summary\u003e\n\n```\nPackage list here\n```\n\u003c/details\u003e\n\n\n### Code Examples\n\n```python\n# Your code here\n```\n\n\n### Stack Trace\n\n_No response_\n\n### Log File\n\n\u003cdetails\u003e\u003csummary\u003eLog file\u003c/summary\u003e\n...\n\u003c/details\u003e\n\n\n### Affected Development Phase\n\nDevelopment\n\n### Impact\n\nImpaired\n\n### Timeline\n\n_No response_","author":{"url":"https://github.com/pasainatan","@type":"Person","name":"pasainatan"},"datePublished":"2026-06-12T02:30:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/157/cloud-sdk-python/issues/157"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2a9008c7-8fa5-6cf9-1e6e-d55a296dbf44 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C38:162299:10EAB5:16B100:6A515D32 |
| html-safe-nonce | 02a50df8ce18026d38412081b6bd5bbe03b4a9fb9fba700a62f1f47dd600449e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzM4OjE2MjI5OToxMEVBQjU6MTZCMTAwOjZBNTE1RDMyIiwidmlzaXRvcl9pZCI6IjE3NDgwMDEwMTQ5MzY1OTE2NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5e9bd08529d31e33b6a9f53eac02205c94290f300f35189b76196e2f5e25b132 |
| hovercard-subject-tag | issue:4645719923 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/SAP/cloud-sdk-python/157/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc658cb825b0fed1dc28e7979ee2dfbfcae07ae66300fe40e324730010ff7c88/SAP/cloud-sdk-python/issues/157 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc658cb825b0fed1dc28e7979ee2dfbfcae07ae66300fe40e324730010ff7c88/SAP/cloud-sdk-python/issues/157 |
| og:image:alt | Describe the Bug EDIT on 15 June: I am using auto_instrument() from sap-cloud-sdk, so the span is auto generated by the tracer instead of using the custom invoke_agent_span() function mentioned in ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pasainatan |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/SAP/cloud-sdk-python git https://github.com/SAP/cloud-sdk-python.git |
| octolytics-dimension-user_id | 2531208 |
| octolytics-dimension-user_login | SAP |
| octolytics-dimension-repository_id | 1187276298 |
| octolytics-dimension-repository_nwo | SAP/cloud-sdk-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1187276298 |
| octolytics-dimension-repository_network_root_nwo | SAP/cloud-sdk-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2eeb434949a926fad21064b4d395a54759f7a0b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width