Skip to content

simplify

0d43616
Select commit
Loading
Failed to load commit list.
Open

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

simplify
0d43616
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 31, 2026 in 5m 11s

1 issue

find-bugs: Found 1 issue (1 medium)

Medium

GEN_AI_AGENT_NAME not set in _wrap_agent_executor_stream - `sentry_sdk/integrations/langchain.py:1023-1025`

The refactoring removed the code that sets GEN_AI_AGENT_NAME attribute in _wrap_agent_executor_stream, while the equivalent code was preserved in _wrap_agent_executor_invoke. The old code had if agent_name: span.set_data(SPANDATA.GEN_AI_AGENT_NAME, agent_name) which was not replaced when switching from agent_name to run_name. This causes inconsistent telemetry data between invoke and stream operations - stream operations will be missing the agent name attribute.


Duration: 5m 7s · Tokens: 1.7M in / 14.3k out · Cost: $2.35 (+extraction: $0.00, +fix_gate: $0.00)

Annotations

Check warning on line 1025 in sentry_sdk/integrations/langchain.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

GEN_AI_AGENT_NAME not set in _wrap_agent_executor_stream

The refactoring removed the code that sets `GEN_AI_AGENT_NAME` attribute in `_wrap_agent_executor_stream`, while the equivalent code was preserved in `_wrap_agent_executor_invoke`. The old code had `if agent_name: span.set_data(SPANDATA.GEN_AI_AGENT_NAME, agent_name)` which was not replaced when switching from `agent_name` to `run_name`. This causes inconsistent telemetry data between invoke and stream operations - stream operations will be missing the agent name attribute.