This commit is contained in:
许海洋 committed 2026-05-20 17:43:50 +08:00
commit e2d61f4cfb
476 files changed
+103681 -9379

No files matched your search

@@ -5,7 +5,6 @@ from langchain.agents.middleware import AgentMiddleware
from langchain_core.runnables import RunnableConfig
from deerflow.agents.lead_agent.prompt import apply_prompt_template
from deerflow.agents.memory.summarization_hook import memory_flush_hook
from deerflow.agents.middlewares.clarification_middleware import ClarificationMiddleware
from deerflow.agents.middlewares.loop_detection_middleware import LoopDetectionMiddleware
from deerflow.agents.middlewares.memory_middleware import MemoryMiddleware
@@ -92,9 +91,8 @@ def _create_summarization_middleware(*, app_config: AppConfig | None = None) ->
if config.summary_prompt is not None:
kwargs["summary_prompt"] = config.summary_prompt
# Memory V2:不再有后台抽取队列,无需 summarization 前的 flush hook。
hooks: list[BeforeSummarizationHook] = []
if resolved_app_config.memory.enabled:
hooks.append(memory_flush_hook)
# The logic below relies on two assumptions holding true: this factory is
# the sole entry point for DeerFlowSummarizationMiddleware, and the runtime
@@ -396,7 +394,7 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
)
logger.info(
"Create Agent(%s) -> thinking_enabled: %s, reasoning_effort: %s, model_name: %s, is_plan_mode: %s, subagent_enabled: %s, max_concurrent_subagents: %s, writing_mode: %s, subagent_mode: %s",
"Create Agent(%s) -> thinking_enabled: %s, reasoning_effort: %s, model_name: %s, is_plan_mode: %s, subagent_enabled: %s, max_concurrent_subagents: %s, writing_mode: %s",
agent_id or "default",
thinking_enabled,
reasoning_effort,
@@ -405,7 +403,6 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
subagent_enabled,
max_concurrent_subagents,
writing_mode,
subagent_mode,
)
# Inject run metadata for LangSmith trace tagging
@@ -432,7 +429,7 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
"subagent_enabled": subagent_enabled,
"writing_mode": writing_mode,
"writing_artifact_path": writing_artifact_path,
"tool_groups": subagent_tool_groups if subagent_mode else (agent_config.tool_groups if agent_config else None),
"tool_groups": agent_config.tool_groups if agent_config else None,
"available_skills": runtime_available_skills,
}
)
@@ -483,7 +480,6 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
writing_artifact_path=writing_artifact_path,
available_skills=(set(agent_config.skills or []) if agent_config else None),
app_config=resolved_app_config,
soul_override=subagent_soul if subagent_mode else None,
),
state_schema=ThreadState,
)