agent-Specialization/modules/multi_agent/__init__.py

53 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""多智能体模式核心实现。
由 conversations metadata.multi_agent_mode = true 触发启用,
不另起隔离链路,直接复用现有 MainTerminal、SubAgentManager、SubAgentTask
但通过对话级开关注入多智能体版工具集、prompt、消息路由。
关键组件:
- RoleConfig角色 Markdown Frontmatter 解析与归档
- MultiAgentState一个多智能体会话的运行态状态机
- 消息格式构造format_multi_agent_message
- 工具定义master 侧、sub_agent 侧扩展
- prompt 构造build_multi_agent_master_prompt / build_multi_agent_sub_agent_prompt
"""
from __future__ import annotations
from .state import MultiAgentState, format_multi_agent_message
from .role_store import (
RoleConfig,
load_preset_role,
list_roles,
save_custom_role,
build_role_system_prompt,
)
from .prompts import (
build_multi_agent_master_prompt,
build_multi_agent_sub_agent_prompt,
MULTI_AGENT_MASTER_PROMPT_BODY,
MULTI_AGENT_SUB_AGENT_PROMPT_BODY,
)
from .tools import (
MULTI_AGENT_MASTER_TOOLS,
MULTI_AGENT_SUB_AGENT_TOOLS,
build_master_tools_for_conversation,
build_sub_agent_tools_for_role,
)
__all__ = [
"MultiAgentState",
"format_multi_agent_message",
"RoleConfig",
"load_preset_role",
"list_roles",
"save_custom_role",
"build_role_system_prompt",
"build_multi_agent_master_prompt",
"build_multi_agent_sub_agent_prompt",
"MULTI_AGENT_MASTER_PROMPT_BODY",
"MULTI_AGENT_SUB_AGENT_PROMPT_BODY",
"MULTI_AGENT_MASTER_TOOLS",
"MULTI_AGENT_SUB_AGENT_TOOLS",
"build_master_tools_for_conversation",
"build_sub_agent_tools_for_role",
]