diff --git a/swarms/swarms/orchestrate.py b/swarms/swarms/orchestrate.py index 6bdd8530..0cc32c54 100644 --- a/swarms/swarms/orchestrate.py +++ b/swarms/swarms/orchestrate.py @@ -245,3 +245,23 @@ class Orchestrator: documents=[message], ids=[f"{sender_id}_to_{receiver_id}"] ) + + def add_agents( + self, + num_agents: int + ): + for _ in range(num_agents): + self.agents.put(self.agent()) + self.executor = ThreadPoolExecutor( + max_workers=self.agents.qsize() + ) + + def remove_agents(self, num_agents): + for _ in range(num_agents): + if not self.agents.empty(): + self.agents.get() + self.executor = ThreadPoolExecutor( + max_workers=self.agents.qsize() + ) + + \ No newline at end of file