智能体分权

This commit is contained in:
吉鑫升 committed 2026-05-13 11:36:17 +08:00
1 parent e7a455f22e
commit cf2e4bdd9c
31 files changed
+1237 -436

No files matched your search

@@ -6,7 +6,7 @@ from langchain_core.tools import tool
from langgraph.prebuilt import ToolRuntime
from langgraph.types import Command
from deerflow.config.agents_config import validate_agent_name
from deerflow.config.agents_config import validate_agent_id
from deerflow.config.paths import get_paths
logger = logging.getLogger(__name__)
@@ -27,12 +27,12 @@ def setup_agent(
skills: Optional list of skill names this agent should use. None or empty means no skills.
"""
agent_name: str | None = runtime.context.get("agent_name") if runtime.context else None
agent_name: str | None = (runtime.context.get("agent_id") or runtime.context.get("agent_name")) if runtime.context else None
agent_dir = None
is_new_dir = False
try:
agent_name = validate_agent_name(agent_name)
agent_name = validate_agent_id(agent_name)
paths = get_paths()
agent_dir = paths.agent_dir(agent_name) if agent_name else paths.base_dir
is_new_dir = not agent_dir.exists()
@@ -40,7 +40,7 @@ def setup_agent(
if agent_name:
# If agent_name is provided, we are creating a custom agent in the agents/ directory
config_data: dict = {"name": agent_name}
config_data: dict = {"id": agent_name, "name": agent_name}
if description:
config_data["description"] = description
if skills is not None: