Spaces:
Paused
Paused
File size: 786 Bytes
e5902c3 deab47c e5902c3 5266ca3 201c475 bab921d 201c475 bab921d ba0986b 201c475 bab921d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from agent import Agent
from python.helpers.tool import Tool, Response
from python.helpers import files
from python.helpers.print_style import PrintStyle
class Delegation(Tool):
def execute(self, message="", reset="", **kwargs):
# create subordinate agent using the data object on this agent and set superior agent to his data object
if self.agent.get_data("subordinate") is None or str(reset).lower().strip() == "true":
subordinate = Agent(self.agent.number+1, self.agent.config)
subordinate.set_data("superior", self.agent)
self.agent.set_data("subordinate", subordinate)
# run subordinate agent message loop
return Response( message=self.agent.get_data("subordinate").message_loop(message), break_loop=False) |