Skip to content

LiteLlm wrapper does not surface reasoning_content from OpenAI model as ReasoningMessage events when reasoning_effort is set #4984

@deepakbatham572

Description

@deepakbatham572

Environment

  • google-adk: 1.27.3
  • litellm: 1.82.6
  • ag-ui-adk: 0.5.1
  • model: gpt-5.1 via openai provider
  • Config: LiteLlm(model="gpt-5.1", reasoning_effort="medium")

Expected behavior

When reasoning_effort is set and the model performs internal reasoning,
the reasoning tokens should be extracted via _extract_reasoning_value()
from the LiteLLM delta (checking delta.reasoning_content), converted
to Part(thought=True) parts, and emitted as THINKING events → ReasoningMessage
in the AG-UI stream.

Actual behavior

No reasoning events are emitted. The _extract_reasoning_value() function
in lite_llm.py calls message.get("reasoning_content") on the LiteLLM
delta, but for gpt-5.1 with reasoning_effort, this field is None/absent
in the streaming delta objects, even though the model does perform reasoning.

Root cause (suspected)

LiteLLM populates reasoning_content on the non-streaming Message object
for some providers, but for OpenAI's gpt-5.1 with reasoning_effort,
the streaming Delta objects do not include a reasoning_content field —
the reasoning tokens are consumed internally by OpenAI and never returned
in the API response chunks. This means _extract_reasoning_value() always
returns None, so no ReasoningChunk is yielded, and the ag_ui_adk
EventTranslator never emits THINKING events.

Steps to reproduce

  1. Set MODEL = LiteLlm(model="gpt-5.1", reasoning_effort="medium")
  2. Ask the agent a question that triggers reasoning + tool use
  3. Observe: no THINKING events in the AG-UI event stream
  4. The model's plan/reasoning appears as plain text content instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    models[Component] Issues related to model support

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions