LiteLlm wrapper does not surface reasoning_content from OpenAI model as ReasoningMessage events when reasoning_effort is set
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
- Set MODEL = LiteLlm(model="gpt-5.1", reasoning_effort="medium")
- Ask the agent a question that triggers reasoning + tool use
- Observe: no THINKING events in the AG-UI event stream
- The model's plan/reasoning appears as plain text content instead
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
/adk-issue-analyze
Hi @deepakbatham572 , thanks for bringing up this issue. I believe your suspected root cause is right, that OpenAI does not return raw reasoning tokens.
In OpenAI's docs, it's mentioned that raw reasoning tokens are not exposed by the model, but you have the option to view a reasoning summary. I believe that with the summary disabled, OpenAI might not return a model response with reasoning content, which leads to liteLLM and ADK being unable to surface it.
Under the liteLLM docs, there's more information about how to set up reasoning summaries. The main points are:
- In order to access reasoning summaries, your OpenAI organization or account needs to have verification status
- For reasoning outputs, it's recommended to route completion requests to OpenAI's Responses API. This can be done by using a
openai/responses/prefix. For example, useopenai/responses/gpt-5.1rather thangpt-5.1. - To get reasoning summaries, you can pass in
reasoning_effortas dictionary with asummaryparameter. For examplereasoning_effort={"effort": "medium", "summary": "auto"}.
Altogether, the docs give a complete example of getting a reasoning summary with liteLLM:
response = litellm.completion(
model="openai/responses/gpt-5-mini",
messages=[{"role": "user", "content": "What is the capital of France?"}],
reasoning_effort={"effort": "high", "summary": "auto"} # "auto", "detailed", or "concise" (not all supported by all models)
)
In ADK I believe you could try creating the model in the following way.
model = LiteLlm(
model="openai/responses/gpt-5.1",
reasoning_effort={"effort": "medium", "summary": "auto"}
)
Please let me know if this works, or if you still have difficulty accessing the reasoning content.
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
This has been automatically closed because it has been marked as stale for over 7 days.