Studio Chat renders raw AIMessage metadata instead of final text when using OpenAI web_search

Environment:
managed-deepagents 0.8.3
langchain-openai 1.6.6
langchain-core 1.6.5
langchain 1.4.3
langgraph-api 0.15.1
openai 3.20.0
macOS

agent.py:

from managed_deepagents import define_deep_agent

agent = define_deep_agent(
name=“deep-agent”,
model=“openai:gpt-5.6-terra”,
tools=[{“type”: “web_search”}],
)

Steps to reproduce:

  1. Run mda dev.
  2. Open Studio.
  3. Ask: “What changed in Managed Deep Agents this week?”
  4. The trace shows successful web_search_call events and a valid final text response.
  5. Studio Chat does not render the final answer. It instead displays raw AIMessage fields such as usage_metadata / invalid_tool_calls.
  6. Run the same prompt using mda chat.
  7. mda chat renders the full final response correctly, including citations.

Expected:
Studio Chat should render the final text content of the AIMessage.

Actual:
Studio Chat displays raw message metadata instead of the final text when the message contains OpenAI Responses API web_search blocks.

Additional evidence:

  • OpenAI web search completes successfully.
  • The final answer exists in the LangSmith trace.
  • mda chat renders the same backend response correctly.

Hi @MiguelBaillargeon

Thanks for the detailed repro! I was able to reproduce this on my side. Studio Chat validates each text block before rendering, and the validator doesn’t recognize the url_citation annotations that OpenAI web search attaches to the final text. The block gets dropped, and with no text left Studio falls back to showing the message’s raw fields. The response itself is fine, which is why the trace and MDA chat both show it.

I’ll flag this for our team to investigate further.

Best,
Chad