From 11a54b1f1a6f9e2349fc3a86470d23a732d0429d Mon Sep 17 00:00:00 2001 From: Divyanshu Gupta <151112485+divyanshudg-git@users.noreply.github.com> Date: Tue, 12 Aug 2025 01:19:42 +0530 Subject: [PATCH] docs: clarify `SystemMessage` usage in LangGraph agent notebook (#32320) (#32346) Closes #32320 This PR updates the `langgraph_agentic_rag.ipynb` notebook to clarify that LangGraph does not automatically prepend a `SystemMessage`. A markdown note and an inline Python comment have been added to guide users to explicitly include a `SystemMessage` when needed. This improves documentation for developers working with LangGraph-based agents and avoids confusion about system-level behavior not being applied. --------- Co-authored-by: Mason Daugherty --- cookbook/langgraph_agentic_rag.ipynb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cookbook/langgraph_agentic_rag.ipynb b/cookbook/langgraph_agentic_rag.ipynb index 948158611dc..cd2bf532a70 100644 --- a/cookbook/langgraph_agentic_rag.ipynb +++ b/cookbook/langgraph_agentic_rag.ipynb @@ -79,6 +79,17 @@ "tool_executor = ToolExecutor(tools)" ] }, + { + "cell_type": "markdown", + "id": "168152fc", + "metadata": {}, + "source": [ + "📘 **Note on `SystemMessage` usage with LangGraph-based agents**\n", + "\n", + "When constructing the `messages` list for an agent, you *must* manually include any `SystemMessage`s.\n", + "Unlike some agent executors in LangChain that set a default, LangGraph requires explicit inclusion." + ] + }, { "cell_type": "markdown", "id": "fe6e8f78-1ef7-42ad-b2bf-835ed5850553",