-
Notifications
You must be signed in to change notification settings - Fork 618
Add call_llm span around model invocation for consistency with python ADK #702
Description
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
🔴 Required Information
Is your feature request related to a specific problem?
Go ADK does not emit a call_llm span while the Python ADK does in its base llm flow: https://github.com/google/adk-python/blob/main/src/google/adk/flows/llm_flows/base_llm_flow.py#L1120
For a single agent invocation I expected a trace shape roughly like invoke_agent <agent> -> call_llm -> generate_content <model> where call_llm wraps generate_content. However for Go there are only invoke_agent <agent> and generate_content <model> spans.
Proposed Solution
In internal/llminternal/base_flow.go, callLLM(...) should start a span similar to how generateContent() does.
Additionally, it would be nice if the llm_request / llm_response attributes can be attached on this span. I noticed in Go these contents are emitted as Otel log events, but to stay consistent to Python these data should also be attached as span attributes.
Impact on your work
This makes Go traces less complete than Python traces and removes a natural parent span for model-call-level metadata and parity with the Python ADK tracing model. Also some tracing backends rely on span attributes rather than correlated Otel logs for inspecting model input outputs.
🟡 Recommended Information
Alternatives Considered
A clear and concise description of any alternative solutions or workarounds
you've considered.
Willingness to contribute
Are you interested in implementing this feature yourself or submitting a PR?
Proposed API / Implementation
If you have ideas on how this should look in code, please share a
pseudo-code example.
Additional Context
Add any other context or screenshots about the feature request.