fix(langchain): Set agent name as `gen_ai.agent.name` for chat and tool spans by alexander-alderman-webb · Pull Request #5877 · getsentry/sentry-python
Description
Set lc_agent_name as the gen_ai.agent.name attribute in on_chat_model_start() and in on_tool_start().
Remove manual accounting of the run_name attribute.
Issues
Reminders
- Please add tests to validate your changes, and lint your code using
tox -e linters. - Add GH Issue ID & Linear ID (if applicable)
- PR title should use conventional commit style (
feat:,fix:,ref:,meta:) - For external contributors: CONTRIBUTING.md, Sentry SDK development docs, Discord community
Semver Impact of This PR
🟢 Patch (bug fixes)
📋 Changelog Preview
This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).
New Features ✨
- (ci) Cancel in-progress PR workflows on new commit push by joshuarli in
#5994
Bug Fixes 🐛
- (langchain) Set agent name as
gen_ai.agent.namefor chat and tool spans by alexander-alderman-webb in#5877
🤖 This preview updates automatically when you update the PR.
alexander-alderman-webb
changed the title
fix(langchain): Set agent name as gen_ai.agent.name
fix(langchain): Set agent name as gen_ai.agent.name
Codecov Results 📊
✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 6.82s
All tests are passing successfully.
❌ Patch coverage is 0.00%. Project has 14939 uncovered lines.
Files with missing lines (1)
| File | Patch % | Lines |
|---|---|---|
langchain.py |
3.24% |
Generated by Codecov Action
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
alexander-alderman-webb
changed the title
fix(langchain): Set agent name as
fix(langchain): Set agent name as gen_ai.agent.namegen_ai.agent.name for chat and tool spans
| ) | ||
|
|
||
|
|
||
| def _push_agent(agent_name: "Optional[str]") -> None: |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to be getting rid of this code 🔥
