fix(openai-agents): align AgentSpanData stubs and span processor with real SDK#4229
Open
nagkumar91 wants to merge 4 commits intoopen-telemetry:mainfrom
Open
fix(openai-agents): align AgentSpanData stubs and span processor with real SDK#4229nagkumar91 wants to merge 4 commits intoopen-telemetry:mainfrom
nagkumar91 wants to merge 4 commits intoopen-telemetry:mainfrom
Conversation
Remove operation, description, agent_id, and model fields from the test stub AgentSpanData that never existed in the real OpenAI Agents SDK (openai/openai-agents-python). The real SDK AgentSpanData only has: name, handoffs, tools, and output_type. Changes: - Remove fake fields from stub AgentSpanData, add handoffs to match SDK - Update agent_span() stub to match real SDK signature (positional name) - Simplify _get_operation_name(): agent spans always map to invoke_agent - Remove getattr reads of non-existent agent_id/description/model from span_data in _get_attributes_from_agent_span_data(); keep user- configured overrides and model fallback from child span aggregation - Fix all tests that used non-existent AgentSpanData fields Reported-by: @adammw Ref: open-telemetry@fa5f44e#r177563121 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nagkumar91
referenced
this pull request
Feb 20, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes test stubs and span processor code that referenced
AgentSpanDatafields (operation,description,agent_id,model) which never existed in the real OpenAI Agents SDK. The real SDKAgentSpanDataonly has:name,handoffs,tools,output_type.Reported by @adammw in fa5f44e#r177563121
Changes
Test stubs (
tests/stubs/agents/tracing/__init__.py)operation,description,agent_id,modelfrom stubAgentSpanDatahandoffsfield to match real SDKagent_span()helper to match real SDK signature (positionalnamearg)Span processor (
span_processor.py)_get_operation_name(): agent spans always returninvoke_agent(real SDK has nooperationfield to distinguish create vs invoke)getattr(span_data, "agent_id"),getattr(span_data, "description"),getattr(span_data, "model")from_get_attributes_from_agent_span_data()self.agent_id,self.agent_description) and model fallback from child span aggregationTests
test_agent_create_span_records_attributeswithtest_agent_invoke_span_records_attributesoperation=,description=,agent_id=,model=kwargs fromAgentSpanData()andagent_span()callsAll 103 tests pass.