From c43c803f66f595d16fb8227fea241d887a0f30dc Mon Sep 17 00:00:00 2001 From: He Wang Date: Thu, 23 Apr 2026 09:56:57 +0800 Subject: [PATCH] fix: remove mismatched context param in debug.py to suppress Pydantic warning (#2446) * fix: remove mismatched context param in debug.py to suppress Pydantic warning The ainvoke call passed context={"thread_id": ...} but the agent graph has no context_schema (ContextT defaults to None), causing a PydanticSerializationUnexpectedValue warning on every invocation. Align with the production run_agent path by injecting context via Runtime into configurable["__pregel_runtime"] instead. Closes #2445 Made-with: Cursor * refactor: derive runtime thread_id from config to avoid duplication Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Made-with: Cursor --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- backend/debug.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/debug.py b/backend/debug.py index f558d1d71..2413d6e49 100644 --- a/backend/debug.py +++ b/backend/debug.py @@ -20,6 +20,7 @@ import logging from dotenv import load_dotenv from langchain_core.messages import HumanMessage +from langgraph.runtime import Runtime from deerflow.agents import make_lead_agent @@ -52,6 +53,9 @@ async def main(): } } + runtime = Runtime(context={"thread_id": config["configurable"]["thread_id"]}) + config["configurable"]["__pregel_runtime"] = runtime + agent = make_lead_agent(config) print("=" * 50) @@ -70,7 +74,7 @@ async def main(): # Invoke the agent state = {"messages": [HumanMessage(content=user_input)]} - result = await agent.ainvoke(state, config=config, context={"thread_id": "debug-thread-001"}) + result = await agent.ainvoke(state, config=config) # Print the response if result.get("messages"):