# Agent Chat UI stream reasoning and tool calls?

**URL:** <https://forum.langchain.com/t/agent-chat-ui-stream-reasoning-and-tool-calls/2522>\
**Category:** LangChain\
**Tags:** python-help\
**Created:** [December 15, 2025, 5:44pm UTC](https://forum.langchain.com/t/agent-chat-ui-stream-reasoning-and-tool-calls/2522 "2025-12-15T17:44:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradyneal](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/bradyneal/32/1936_2.png) [@bradyneal](https://forum.langchain.com/u/bradyneal)\
**Post date:** [December 15, 2025, 5:44pm UTC](https://forum.langchain.com/t/agent-chat-ui-stream-reasoning-and-tool-calls/2522/1 "2025-12-15T17:44:46Z")

</div>

Can the [Agent Chat UI](https://docs.langchain.com/oss/python/langchain/ui) stream reasoning summaries and tool calls (e.g. from OpenAI built-in web search tool and custom tools)? I don’t see it streaming the reasoning summaries or OpenAI built-in web search tool calls; I only see it returning the the custom tool calls and regular output text messages. Minimal example code for concreteness of an example agent that would do reasoning, built-in tool calls, and custom tools calls:

```auto
import hashlib

from langchain.agents import create_agent

from langchain.tools import tool

from langchain_openai import ChatOpenAI

@tool

def sha256(text: str) -> str:

"""Return the SHA-256 hex digest of `text` (exact, deterministic)."""

return hashlib.sha256(text.encode("utf-8")).hexdigest()

# OpenAI built-in / server-side tool:

openai_web_search = {"type": "web_search_preview"}

llm = ChatOpenAI(

model="gpt-5.2",

use_responses_api=True, # optional, but makes intent explicit

temperature=0,

)

agent = create_agent(

    llm,

tools=[openai_web_search, sha256],

system_prompt=(

"Use web search for up-to-date facts. "

"Use the sha256 tool for any hashing."

    ),

)

prompt = """

Do these steps in order:

1) Use web_search_preview to find the latest stable Python release version number from python.org.

2) Call sha256 on EXACTLY that version string (e.g. '3.13.1' — just the version number).

Return a JSON object with keys: version, sha256.

"""

```

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [March 7, 2026, 7:36pm UTC](https://forum.langchain.com/t/agent-chat-ui-stream-reasoning-and-tool-calls/2522/2 "2026-03-07T19:36:33Z")

</div>

Hello, @bradyneal

**TL;DR: Yes, reasoning summaries and built-in tool calls do show up when streaming, but they behave differently from regular text. You need stream\_mode=“messages” and output\_version=“responses/v1”.**

The reason you’re only seeing custom tool calls and final text is likely because you’re using stream\_mode=“updates” (the default). In that mode, LangGraph gives you the full model output after the entire call finishes — so everything arrives at once at the end, not streamed.

What you want is stream\_mode=“messages”, that gives you chunks as they come in.

The other piece is output\_version=“responses/v1” on ChatOpenAI. Without that, reasoning summaries and built-in tool call data get buried in additional\_kwargs instead of showing up as structured content blocks.

**Important caveat about built-in tools:** OpenAI’s built-in server-side tools like web\_search\_preview do NOT stream incrementally. They execute on OpenAI’s servers and arrive as a single complete block once the search is done — that’s an OpenAI API limitation, not a LangChain one.

Here’s how each event type actually behaves during streaming:

- **Text output** — streams token-by-token via deltas

- **Reasoning summaries** — stream incrementally via text deltas

- **Custom function calls** (like your sha256) — stream name first, then argument deltas

- **web\_search\_call** — arrives as one complete block when the search finishes (no deltas)

Here’s roughly what you’d want:

```python
import asyncio
import hashlib

from langchain.agents import create_agent
from langchain.tools import tool
from langchain_openai import ChatOpenAI

@tool
def sha256(text: str) → str:
“”“Return the SHA-256 hex digest of text (exact, deterministic).”“”
return hashlib.sha256(text.encode(“utf-8”)).hexdigest()

llm = ChatOpenAI(
model=“gpt-5.2”,
use_responses_api=True,
output_version=“responses/v1”,
reasoning={“effort”: “medium”, “summary”: “auto”},
temperature=0,
)

agent = create_agent(
llm,
tools=[
{“type”: “web_search_preview”},
sha256,
],
system_prompt=(
"Use web search for up-to-date facts. "
“Use the sha256 tool for any hashing.”
),
)

async def main():
async for msg_tuple in agent.astream(
{
“messages”: [
{
“role”: “user”,
“content”: “Do a web search for the latest news on the stock market.”,
}
]
},
stream_mode=“messages”,
):
msg_chunk, metadata = msg_tuple

    for block in msg_chunk.content:
        if isinstance(block, dict):
            if block["type"] == "reasoning":
                print("REASONING:", block.get("summary", ""))

            elif block["type"] == "web_search_call":
                print("WEB SEARCH:", block)

            elif block["type"] == "text":
                print(block.get("text", ""), end="")

if name == “main”:
     asyncio.run(main())

```

Quick recap of the settings:

- **output\_version=“responses/v1”** — puts reasoning, web\_search\_call, etc. into structured content blocks

- **stream\_mode=“messages”** — streams individual chunks as they arrive from the model

- **reasoning={“summary”: “auto”}** — tells OpenAI to include reasoning summaries; without this you won’t get them at all

* * *

### **Reference docs**

**LangChain / LangGraph:**

- ChatOpenAI + Responses API (output\_version, built-in tools, reasoning): [ChatOpenAI integration - Docs by LangChain](https://docs.langchain.com/oss/python/integrations/chat/openai#responses-api)

- LangGraph streaming how-tos (includes stream\_mode=“messages”): [Redirecting...](https://langchain-ai.github.io/langgraph/how-tos/streaming/)

**OpenAI:**

- Built-in tools overview (web search, file search, etc.): [https://platform.openai.com/docs/guides/tools?api-mode=responses](https://platform.openai.com/docs/guides/tools?api-mode=responses)

- Web search tool specifically: [https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses](https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses)

- Reasoning models & summary config: [https://platform.openai.com/docs/guides/reasoning](https://platform.openai.com/docs/guides/reasoning)

- Responses API streaming events (explains why built-in tools don’t have deltas): [https://platform.openai.com/docs/api-reference/responses-streaming](https://platform.openai.com/docs/api-reference/responses-streaming)

Hope that helps!
