Describe the Bug
I tried instrumenting a langgraph agent with invoke_agent_span and propagate=True and I see a span appearing in CLS with the agent ID and name I provided. However, that same agent (in a single invocation) also produced a span with an agent name of LangGraph and a different agent ID. I expected all the children spans of my invoke_agent_span to inherit the same agent ID and name (because propagate=True).
Steps to Reproduce
- Clone https://github.tools.sap/Montana-AI-Singapore/a2a-server-samples
- Check out branch
instrumentation-agent-id
cd appfnd-langgraph-basic
- Copy
.env.example and fill up the credentials with a valid AI Core and CLS instance
uv run app to start the server
- Invoke the agent. Example curl request
curl --request POST \
--url http://localhost:10000/v1/message:stream \
--header 'content-type: application/json' \
--data '{
"message": {
"messageId": "a52d542b-06cb-4e9a-b36e-15ee6cb7eee4",
"role": "ROLE_USER",
"content": [
{
"text": "5 USD to SGD"
}
]
}
}'
- Go to your CLS dashboard -> Dev Tools and use the OpenSearch query (fill up the service name)
GET otel-v1-apm-span-*/_search
{
"size": 1000,
"query": {
"bool": {
"must": [
{
"term": {
"serviceName": "<WHATEVER_YOU_FILLED_APPFND_CONHOS_APP_NAME_WITH>"
}
}
]
}}
,
"sort": [
{ "startTime": { "order": "desc" } }
]
}
- See Expected Behavior
Expected Behavior
In the search result from the repro steps,
- Look for "span.attributes.gen_ai@operation@name": "invoke_agent". There should be 3 spans.
- I expect to see all
invoke_agent spans have span.attributes.gen_ai@agent@id with the agent_id value I provided (f268d3fd-096f-4ebc-b7ed-6fc03dfb3dde if you used the value in .env.example). Instead, I see only 2 instances: one with the value I set and another with a different ID. 1 of the invoke_agent spans is missing its span.attributes.gen_ai@agent@id field.
- I expect to see all
invoke_agent spans have "span.attributes.gen_ai@agent@name" with the agent_name value I provided (currency-agent-local if you used the value in .env.example). Instead, I see 1 instance of currency-agent-local (as expected) and 2 instances of Langgraph.
Screenshots
No response
Used Versions
- Python version via
python --version: 3.12
- SAP Cloud SDK for Python version:
sap-cloud-sdk~=0.6.1
See pyproject.toml in the example for version details
Code Examples
Stack Trace
No response
Log File
Log file
...
Affected Development Phase
Development
Impact
Impaired
Timeline
No response
Describe the Bug
I tried instrumenting a langgraph agent with
invoke_agent_spanandpropagate=Trueand I see a span appearing in CLS with the agent ID and name I provided. However, that same agent (in a single invocation) also produced a span with an agent name ofLangGraphand a different agent ID. I expected all the children spans of myinvoke_agent_spanto inherit the same agent ID and name (becausepropagate=True).Steps to Reproduce
instrumentation-agent-idcd appfnd-langgraph-basic.env.exampleand fill up the credentials with a valid AI Core and CLS instanceuv run appto start the serverExpected Behavior
In the search result from the repro steps,
invoke_agentspans havespan.attributes.gen_ai@agent@idwith theagent_idvalue I provided (f268d3fd-096f-4ebc-b7ed-6fc03dfb3ddeif you used the value in.env.example). Instead, I see only 2 instances: one with the value I set and another with a different ID. 1 of theinvoke_agentspans is missing itsspan.attributes.gen_ai@agent@idfield.invoke_agentspans have "span.attributes.gen_ai@agent@name" with theagent_namevalue I provided (currency-agent-localif you used the value in.env.example). Instead, I see 1 instance ofcurrency-agent-local(as expected) and 2 instances ofLanggraph.Screenshots
No response
Used Versions
python --version: 3.12sap-cloud-sdk~=0.6.1See
pyproject.tomlin the example for version detailsCode Examples
# Your code hereStack Trace
No response
Log File
Log file
...Affected Development Phase
Development
Impact
Impaired
Timeline
No response