Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions veadk/agent_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def _build(self, agent_config: dict) -> BaseAgent:
for sub_agent_config in agent_config["sub_agents"]:
agent = self._build(sub_agent_config)
sub_agents.append(agent)
agent_config.pop("sub_agents")

tools = []
if agent_config.get("tools", []):
Expand All @@ -58,10 +57,16 @@ def _build(self, agent_config: dict) -> BaseAgent:
func = getattr(module, func_name)

tools.append(func)
agent_config.pop("tools")

# Filter out special fields that will be passed explicitly
# to avoid modifying the original config and parameter conflicts
config_for_init = {
k: v for k, v in agent_config.items()
if k not in ["sub_agents", "tools"]
}

agent_cls = AGENT_TYPES[agent_config["type"]]
agent = agent_cls(**agent_config, sub_agents=sub_agents, tools=tools)
agent = agent_cls(**config_for_init, sub_agents=sub_agents, tools=tools)

logger.debug("Build agent done.")

Expand Down