The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs(langchain): document summarization prompt contract (#38256)
Mason Daughertya979105085bc
diff --git a/libs/langchain_v1/langchain/agents/middleware/summarization.py b/libs/langchain_v1/langchain/agents/middleware/summarization.pyindex 81c47f4862..9d2e4ffac2 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 informatiMessages to summarize:{messages}</messages>""" # noqa: E501+"""Default prompt used to summarize conversation history.++The `<messages>` 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 `<messages>` 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