Prevent deepagents summary from rendering in client as human message

I am building an agent using deepagents and the auto-summarization middleware is useful for long threads, but from what I can tell, there is no way to differentiate the human messages created by this summarization middleware from an actual human message.

This makes it impossible to differentiate these in the client (frontend using useStream()) and hide these from the user. Is there some sort of way to identify or filter these out agent-side or client-side?

 [{
                    "content": "now Langchain",
                    "additional_kwargs": {},
                    "response_metadata": {},
                    "type": "human",
                    "name": null,
                    "id": "4bf61c30-bdfd-47f4-ae12-347e3a8f6d36"
                },
                {
                    "content": "Here is a summary of the conversation to date:\n\n# Extracted Context\n\n## User's Request Pattern\nUser is requesting one-paragraph investment briefs for fintech/enterprise software companies, following this format:...<remainder of summary omitted>",
                    "additional_kwargs": {},
                    "response_metadata": {},
                    "type": "human",
                    "name": null,
                    "id": "a45c61dc-a363-4da8-9a9b-2ef49d476bbd"
                }]

Hey we’re working on adding support for tagging generally across Human messages from different sources like Middleware invocations or subagents. In the meantime here’s a patch that adds a tag to the output of Summarization that can be used to filter messages client side. Lmk if any other way we can help or what else you’d like to see form the outputs of MioddleWare!

`from langchain.agents.middleware.summarization import SummarizationMiddleware
from langchain_core.messages.human import HumanMessage

def _build_new_messages_with_tag(self, summary: str) → list[HumanMessage]:
return [
HumanMessage(
content=f"Here is a summary of the conversation to date:\n\n{summary}",
name=“summary”,
additional_kwargs={“is_summary”: True},
)
]

SummarizationMiddleware._build_new_messages = _build_new_messages_with_tag`