Skip to content

fix(langchain): Set agent name as gen_ai.agent.name for chat and tool spans#5877

Open
alexander-alderman-webb wants to merge 9 commits intomasterfrom
webb/langchain/agent-name
Open

fix(langchain): Set agent name as gen_ai.agent.name for chat and tool spans#5877
alexander-alderman-webb wants to merge 9 commits intomasterfrom
webb/langchain/agent-name

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Mar 26, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

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 ✨

  • (integrations) Instrument pyreqwest tracing by servusdei2018 in #5682

Bug Fixes 🐛

  • (langchain) Set agent name as gen_ai.agent.name for chat and tool spans by alexander-alderman-webb in #5877

Internal Changes 🔧

  • (opentelemetry) Ignore mypy error by alexander-alderman-webb in #5927

🤖 This preview updates automatically when you update the PR.

@alexander-alderman-webb 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 Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 6.75s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14742 uncovered lines.

Files with missing lines (1)
File Patch % Lines
langchain.py 3.24% ⚠️ 568 Missing

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 31, 2026 13:18
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner March 31, 2026 13:18
Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft March 31, 2026 13:27
@alexander-alderman-webb 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 for chat and tool spans Apr 1, 2026
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review April 1, 2026 07:07
)


def _push_agent(agent_name: "Optional[str]") -> None:
Copy link
Copy Markdown
Member

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 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants