diff --git a/libs/langchain_v1/langchain/agents/middleware/summarization.py b/libs/langchain_v1/langchain/agents/middleware/summarization.py index 81c47f48622..9d2e4ffac28 100644 --- a/libs/langchain_v1/langchain/agents/middleware/summarization.py +++ b/libs/langchain_v1/langchain/agents/middleware/summarization.py @@ -76,6 +76,17 @@ Respond ONLY with the extracted context. Do not include any additional informati Messages to summarize: {messages} """ # noqa: E501 +"""Default prompt used to summarize conversation history. + +The `` marker (on its own line) and the `{messages}` placeholder are +part of this constant's public contract, not just cosmetic formatting. +Downstream consumers depend on them: for example, deep agents' +`SummarizationMiddleware` splices an extra instruction block in immediately +before the `` marker via `str.replace`. Removing, renaming, or +reformatting the marker (or the `{messages}` placeholder) is a breaking change +for those consumers even though it does not alter any function signature, so +treat edits to it accordingly. +""" _DEFAULT_MESSAGES_TO_KEEP = 20 _DEFAULT_TRIM_TOKEN_LIMIT = 4000