(self, tasks, survived_agent_names,statistics)
| 640 | class StepRandomFairEnv(CacheEnv): |
| 641 | |
| 642 | def _task_assign(self, tasks, survived_agent_names,statistics): |
| 643 | env_record, env_table = self.get_records(survived_agent_names) |
| 644 | num_of_tasks = env_table['Number of tasks'] |
| 645 | team = env_table['Name'] |
| 646 | |
| 647 | # find minimial-used agents |
| 648 | non_used_agents = np.where(np.array(num_of_tasks) == np.min(num_of_tasks))[0].tolist() |
| 649 | idx = non_used_agents[random.randint(0,100000) % len(non_used_agents)] |
| 650 | # time.sleep(5) |
| 651 | if int(os.environ.get('SLEEP', 0)) > 0: |
| 652 | time.sleep(int(os.environ['SLEEP'])) |
| 653 | idx = self.name2idx[team[idx]] |
| 654 | return Response( |
| 655 | role='assistant', |
| 656 | raw=self.agents[idx].name, |
| 657 | content=self.agents[idx].name, |
| 658 | end=True, |
| 659 | usage=0, |
| 660 | cost=0, |
| 661 | ) |
| 662 | |
| 663 | |
| 664 | @dataclass |
nothing calls this directly
no test coverage detected