Skip to content

no agent name in stream

36ca817
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

no agent name in stream
36ca817
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Mar 31, 2026 in 15m 45s

1 issue

find-bugs: Found 1 issue (1 medium)

Medium

Agent name (gen_ai.agent.name) not set on span in _wrap_agent_executor_stream - `sentry_sdk/integrations/langchain.py:1029-1033`

In the stream function _wrap_agent_executor_stream, the run_name is obtained via _get_run_name() (line 1020) and used in the span name (line 1024), but unlike _wrap_agent_executor_invoke (which sets SPANDATA.GEN_AI_AGENT_NAME on lines 967-968), the stream function never sets this span data. This creates inconsistent telemetry behavior between invoke and stream operations - streaming agents will not have the gen_ai.agent.name attribute set on their spans. This directly contradicts the PR title which claims to 'Set agent name as gen_ai.agent.name'.


Duration: 15m 43s · Tokens: 2.0M in / 18.4k out · Cost: $2.87 (+extraction: $0.01, +fix_gate: $0.00)

Annotations

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

See this annotation in the file changed.

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

Agent name (gen_ai.agent.name) not set on span in _wrap_agent_executor_stream

In the stream function `_wrap_agent_executor_stream`, the `run_name` is obtained via `_get_run_name()` (line 1020) and used in the span name (line 1024), but unlike `_wrap_agent_executor_invoke` (which sets `SPANDATA.GEN_AI_AGENT_NAME` on lines 967-968), the stream function never sets this span data. This creates inconsistent telemetry behavior between invoke and stream operations - streaming agents will not have the `gen_ai.agent.name` attribute set on their spans. This directly contradicts the PR title which claims to 'Set agent name as gen_ai.agent.name'.