mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-24 00:45:57 +00:00
feat/per agent skill filter (#1650)
* feat(agent): 为AgentConfig添加skills字段并更新lead_agent系统提示 在AgentConfig中添加skills字段以支持配置agent可用技能 更新lead_agent的系统提示模板以包含可用技能信息 * fix: resolve agent skill configuration edge cases and add tests * Update backend/packages/harness/deerflow/agents/lead_agent/prompt.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor(agent): address PR review comments for skills configuration - Add detailed docstring to `skills` field in `AgentConfig` to clarify the semantics of `None` vs `[]`. - Add unit tests in `test_custom_agent.py` to verify `load_agent_config()` correctly parses omitted skills and explicit empty lists. - Fix `test_make_lead_agent_empty_skills_passed_correctly` to include `agent_name` in the runtime config, ensuring it exercises the real code path. * docs: 添加关于按代理过滤技能的配置说明 在配置示例文件和文档中添加说明,解释如何通过代理的config.yaml文件限制加载的技能 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -164,6 +164,28 @@ class TestLoadAgentConfig:
|
||||
|
||||
assert cfg.tool_groups == ["file:read", "file:write"]
|
||||
|
||||
def test_load_config_with_skills_empty_list(self, tmp_path):
|
||||
config_dict = {"name": "no-skills-agent", "skills": []}
|
||||
_write_agent(tmp_path, "no-skills-agent", config_dict)
|
||||
|
||||
with patch("deerflow.config.agents_config.get_paths", return_value=_make_paths(tmp_path)):
|
||||
from deerflow.config.agents_config import load_agent_config
|
||||
|
||||
cfg = load_agent_config("no-skills-agent")
|
||||
|
||||
assert cfg.skills == []
|
||||
|
||||
def test_load_config_with_skills_omitted(self, tmp_path):
|
||||
config_dict = {"name": "default-skills-agent"}
|
||||
_write_agent(tmp_path, "default-skills-agent", config_dict)
|
||||
|
||||
with patch("deerflow.config.agents_config.get_paths", return_value=_make_paths(tmp_path)):
|
||||
from deerflow.config.agents_config import load_agent_config
|
||||
|
||||
cfg = load_agent_config("default-skills-agent")
|
||||
|
||||
assert cfg.skills is None
|
||||
|
||||
def test_legacy_prompt_file_field_ignored(self, tmp_path):
|
||||
"""Unknown fields like the old prompt_file should be silently ignored."""
|
||||
agent_dir = tmp_path / "agents" / "legacy-agent"
|
||||
|
||||
Reference in New Issue
Block a user