Skip to content

[bug][openai-agents] LLM span GENERATED section shows {"role": "assistant"} with no content #2882

@syedmohsinbukhari

Description

@syedmohsinbukhari

Bug Report

Describe the bug

Two related issues when instrumenting the OpenAI Agents SDK (Responses API path) with OpenAIAgentsInstrumentor:

Issue 1 — LLM span output missing message content

The [LLM] span's output shows only [{"role": "assistant"}] with no message content, despite the model returning a valid text response.
Root cause (from source inspection of _processor.py): _get_attributes_from_message correctly emits llm.output_messages.N.message.contents.I.message_content.text for the response text. However, OUTPUT_VALUE is set via response.model_dump_json() which serialises the full Response object. Downstream consumers (e.g. LangWatch UI) that read from a flat message.content field find nothing, because output messages use the nested multi-part message.contents.* form rather than a flat message.content string — unlike input messages which do emit a flat message.content.

Issue 2 — Reasoning items silently dropped

When agents are configured with ModelSettings(reasoning=Reasoning(...)), the reasoning summary returned by the model never appears in the trace. In _get_attributes_from_response_output, "reasoning" items are explicitly listed in the unhandled branch with a TODO comment and produce zero span attributes:

elif item.type in (
    "file_search_call", "web_search_call", "computer_call",
    "reasoning",  # silently skipped
    ...
):
    ...  # TODO

To Reproduce

  1. Instrument any OpenAI Agents SDK app with OpenAIAgentsInstrumentor
  2. Configure an agent with ModelSettings(reasoning=Reasoning(effort="low", summary="detailed"))
  3. Run a simple text reply (no tools)
  4. Inspect the LLM span output in any OTel-compatible UI (LangWatch, etc.)
  5. The GENERATED / output section shows [{"role": "assistant"}] — role only, no content
  6. No reasoning summary appears anywhere in the trace

Expected behavior

  • The LLM span output should include the response text, e.g. [{"role": "assistant", "content": "Hello! How can I help?"}]
  • Reasoning summaries produced by the model should appear as span attributes
    Actual behavior
  • [{"role": "assistant"}] — role only, no content
  • Reasoning items are silently dropped with no attributes emitted

Desktop

  • OS: MacOS
  • Version: 26.3.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions