Agent Zero AI framework
Update call_subordinate.py
frdeld5fc0a32e798
diff --git a/python/tools/call_subordinate.py b/python/tools/call_subordinate.pyindex e56f91141..3b316fc51 100644--- a/python/tools/call_subordinate.py+++ b/python/tools/call_subordinate.py@@ -1,6 +1,6 @@from agent import Agent, UserMessagefrom python.helpers.tool import Tool, Response-import copy+from initialize import initialize_agentclass Delegation(Tool):@@ -11,22 +11,25 @@ class Delegation(Tool):self.agent.get_data(Agent.DATA_NAME_SUBORDINATE) is Noneor str(reset).lower().strip() == "true"):+ # initialize default config+ config = initialize_agent()++ # set subordinate prompt profile if provided, if not, keep original+ agent_profile = kwargs.get("profile")+ if agent_profile:+ config.profile = agent_profile+# crate agent- sub = Agent(self.agent.number + 1, copy.deepcopy(self.agent.config), self.agent.context)+ sub = Agent(self.agent.number + 1, config, self.agent.context)# register superior/subordinatesub.set_data(Agent.DATA_NAME_SUPERIOR, self.agent)self.agent.set_data(Agent.DATA_NAME_SUBORDINATE, sub)- # set default prompt profile to new agents- sub.config.profile = ""# add user message to subordinate agent- subordinate: Agent = self.agent.get_data(Agent.DATA_NAME_SUBORDINATE)+ subordinate: Agent = self.agent.get_data(Agent.DATA_NAME_SUBORDINATE) # type: ignoresubordinate.hist_add_user_message(UserMessage(message=message, attachments=[]))- # set subordinate prompt profile if provided, if not, keep original- agent_profile = kwargs.get("profile")- if agent_profile:- subordinate.config.profile = agent_profile+# run subordinate monologueresult = await subordinate.monologue()