# Streaming the final output ONLY

**URL:** <https://community.deeplearning.ai/t/streaming-the-final-output-only/659799>\
**Category:** AI Agents in LangGraph\
**Created:** [July 8, 2024, 9:04am UTC](https://community.deeplearning.ai/t/streaming-the-final-output-only/659799 "2024-07-08T09:04:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ihsan](https://avatars.discourse-cdn.com/v4/letter/i/4491bb/32.png) [@Ihsan](https://community.deeplearning.ai/u/Ihsan)\
**Post date:** [July 8, 2024, 9:04am UTC](https://community.deeplearning.ai/t/streaming-the-final-output-only/659799/1 "2024-07-08T09:04:30Z")

</div>

My question is related to → Persistence and Streaming → Streaming tokens.

**How can I stream only the _final response_** to a user’s question? The current code, also given below, streams the ‘tool calling’ and ‘Back to Model’, as well.

```auto
messages = [HumanMessage(content="What is the weather in SF?")]
thread = {"configurable": {"thread_id": "4"}}
async for event in abot.graph.astream_events({"messages": messages}, thread, version="v1"):
    kind = event["event"]
    if kind == "on_chat_model_stream":
        content = event["data"]["chunk"].content
        if content:
            # Empty content in the context of OpenAI means
            # that the model is asking for a tool to be invoked.
            # So we only print non-empty content
            print(content, end="")

```

**Output:**

```auto
Calling: {'name': 'tavily_search_results_json', 'args': {'query': 'current weather in San Francisco'}, 'id': 'call_d1uenpZrgwcruC5UZpiWEyYx'}
Back to the model!
The current weather in San Francisco involves considerable cloudiness with occasional rain showers. The humidity is around 66%, and the wind is coming from the SSW at 10 mph. The high temperature is expected to be in the upper 60s.

```
