Former-commit-id: 97fb1e6980
group-chat
Kye 1 year ago
parent aca1ae5968
commit e7629241a2

@ -4,22 +4,25 @@ from time import sleep
from swarms.workers.worker import Worker from swarms.workers.worker import Worker
from swarms.utils.decorators import error_decorator, log_decorator, timing_decorator from swarms.utils.decorators import error_decorator, log_decorator, timing_decorator
from shapeless import shapeless
# TODO Handle task assignment and task delegation # TODO Handle task assignment and task delegation
# TODO: User task => decomposed into very small sub tasks => sub tasks assigned to workers => workers complete and update the swarm, can ask for help from other agents. # TODO: User task => decomposed into very small sub tasks => sub tasks assigned to workers => workers complete and update the swarm, can ask for help from other agents.
# TODO: Missing, Task Assignment, Task delegation, Task completion, Swarm level communication with vector db # TODO: Missing, Task Assignment, Task delegation, Task completion, Swarm level communication with vector db
@shapeless
class AutoScaler: class AutoScaler:
@log_decorator @log_decorator
@error_decorator @error_decorator
@timing_decorator @timing_decorator
def __init__(self, def __init__(
initial_agents=10, self,
scale_up_factor=1, initial_agents=10,
idle_threshold=0.2, scale_up_factor=1,
busy_threshold=0.7, idle_threshold=0.2,
agent=None, busy_threshold=0.7,
): agent=None,
):
self.agent = agent or Worker self.agent = agent or Worker
self.agents_pool = [self.agent() for _ in range(initial_agents)] self.agents_pool = [self.agent() for _ in range(initial_agents)]
self.task_queue = queue.Queue() self.task_queue = queue.Queue()

Loading…
Cancel
Save