Spaces:
Paused
Paused
Modularised the agents 9
Browse files- __pycache__/crew.cpython-310.pyc +0 -0
- crew.py +21 -10
__pycache__/crew.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/crew.cpython-310.pyc and b/__pycache__/crew.cpython-310.pyc differ
|
|
|
crew.py
CHANGED
|
@@ -102,26 +102,37 @@ class GAIACrew():
|
|
| 102 |
|
| 103 |
@property
|
| 104 |
def agents(self) -> List[Agent]:
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
allow_delegation=("manager" in name),
|
| 109 |
llm=MANAGER_MODEL if "manager" in name else AGENT_MODEL,
|
| 110 |
max_iter=5 if "manager" in name else 2,
|
| 111 |
tools=get_tools_for(name),
|
| 112 |
verbose=True
|
| 113 |
-
)
|
| 114 |
-
|
| 115 |
-
|
| 116 |
|
| 117 |
@task
|
| 118 |
def manager_task(self) -> Task:
|
| 119 |
-
|
| 120 |
-
config
|
| 121 |
-
|
| 122 |
-
task
|
|
|
|
| 123 |
return task
|
| 124 |
|
|
|
|
| 125 |
def get_crew(self) -> Crew:
|
| 126 |
return Crew(
|
| 127 |
agents=self.agents,
|
|
|
|
| 102 |
|
| 103 |
@property
|
| 104 |
def agents(self) -> List[Agent]:
|
| 105 |
+
agents = []
|
| 106 |
+
for name in self.agents_config:
|
| 107 |
+
config = self.agents_config[name]
|
| 108 |
+
if config is None:
|
| 109 |
+
print(f"❌ Agent config for '{name}' is None!")
|
| 110 |
+
continue
|
| 111 |
+
|
| 112 |
+
full_config = {**config, "name": name}
|
| 113 |
+
print(f"✅ Creating agent: {name}")
|
| 114 |
+
|
| 115 |
+
agents.append(Agent(
|
| 116 |
+
config=full_config,
|
| 117 |
allow_delegation=("manager" in name),
|
| 118 |
llm=MANAGER_MODEL if "manager" in name else AGENT_MODEL,
|
| 119 |
max_iter=5 if "manager" in name else 2,
|
| 120 |
tools=get_tools_for(name),
|
| 121 |
verbose=True
|
| 122 |
+
))
|
| 123 |
+
return agents
|
| 124 |
+
|
| 125 |
|
| 126 |
@task
|
| 127 |
def manager_task(self) -> Task:
|
| 128 |
+
for agent in self.agents:
|
| 129 |
+
print("👀 Agent config:", agent.config)
|
| 130 |
+
|
| 131 |
+
task = Task(config=self.tasks_config["manager_task"])
|
| 132 |
+
task.agent = next(agent for agent in self.agents if agent.config and agent.config.get("name") == "manager_agent")
|
| 133 |
return task
|
| 134 |
|
| 135 |
+
|
| 136 |
def get_crew(self) -> Crew:
|
| 137 |
return Crew(
|
| 138 |
agents=self.agents,
|