open-telemetry / open-telemetry/opentelemetry-python-genai
[langchain] Classify agent chains by name on on_chain_start
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39
- Forks
- 63
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 175
Description
[!NOTE]
This issue was generated with AI assistance and requires investigation and confirmation prior to being worked on.
Part of #543.
In on_chain_start, agent classification currently requires explicit metadata keys (otel_agent_span, agent_name, agent_type). Standard LangChain agent chains (e.g. AgentExecutor) without explicit metadata are either misclassified as workflows or suppressed.
OpenInference classifies any chain whose name contains "agent" as an agent span.
- Classify chains with
"agent"in the chain/runnable name asinvoke_agent(gen_ai.operation.name: "invoke_agent") - Resolve agent name from chain/runnable name
- Set standard agent attributes (
gen_ai.agent.name,gen_ai.conversation.id,gen_ai.input.messages,gen_ai.output.messages)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the on_chain_start entry point and the existing classification logic for otel_agent_span, agent_name, and agent_type. Compare its behavior with standard LangChain chains such as AgentExecutor, then verify that names containing "agent" produce invoke_agent spans with the requested agent name and standard attributes; add or update focused tests if the surrounding code provides them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100