Update agents/crew.py
Browse files- agents/crew.py +20 -60
agents/crew.py
CHANGED
|
@@ -68,6 +68,14 @@ tracer_provider = register(
|
|
| 68 |
logging.getLogger("openinference").setLevel(logging.CRITICAL)
|
| 69 |
logging.getLogger("opentelemetry").setLevel(logging.CRITICAL)
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
@CrewBase
|
| 72 |
class GAIACrew():
|
| 73 |
agents: List[BaseAgent]
|
|
@@ -75,11 +83,7 @@ class GAIACrew():
|
|
| 75 |
|
| 76 |
@agent
|
| 77 |
def web_search_agent(self) -> Agent:
|
| 78 |
-
|
| 79 |
-
print(f"π€ Web search agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 80 |
-
print(f"π€ Web search agent max iterations: {MAX_ITER_AGENT}")
|
| 81 |
-
print(f"π€ Web search agent verbose: {VERBOSE_AGENT}")
|
| 82 |
-
print(f"π€ Web search agent LLM: {LLM_AGENT}")
|
| 83 |
|
| 84 |
return Agent(
|
| 85 |
config=self.agents_config["web_search_agent"],
|
|
@@ -94,11 +98,7 @@ class GAIACrew():
|
|
| 94 |
|
| 95 |
@agent
|
| 96 |
def web_browser_agent(self) -> Agent:
|
| 97 |
-
|
| 98 |
-
print(f"π€ Web browser agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 99 |
-
print(f"π€ Web browser agent max iterations: {MAX_ITER_AGENT}")
|
| 100 |
-
print(f"π€ Web browser agent verbose: {VERBOSE_AGENT}")
|
| 101 |
-
print(f"π€ Web browser agent LLM: {LLM_AGENT}")
|
| 102 |
|
| 103 |
return Agent(
|
| 104 |
config=self.agents_config["web_browser_agent"],
|
|
@@ -113,11 +113,7 @@ class GAIACrew():
|
|
| 113 |
|
| 114 |
@agent
|
| 115 |
def chess_analysis_agent(self) -> Agent:
|
| 116 |
-
|
| 117 |
-
print(f"π€ Chess analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 118 |
-
print(f"π€ Chess analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 119 |
-
print(f"π€ Chess analysis agent verbose: {VERBOSE_AGENT}")
|
| 120 |
-
print(f"π€ Chess analysis agent LLM: {LLM_AGENT}")
|
| 121 |
|
| 122 |
return Agent(
|
| 123 |
config=self.agents_config["chess_analysis_agent"],
|
|
@@ -132,11 +128,7 @@ class GAIACrew():
|
|
| 132 |
|
| 133 |
@agent
|
| 134 |
def image_analysis_agent(self) -> Agent:
|
| 135 |
-
|
| 136 |
-
print(f"π€ Image analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 137 |
-
print(f"π€ Image analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 138 |
-
print(f"π€ Image analysis agent verbose: {VERBOSE_AGENT}")
|
| 139 |
-
print(f"π€ Image analysis agent LLM: {LLM_AGENT}")
|
| 140 |
|
| 141 |
return Agent(
|
| 142 |
config=self.agents_config["image_analysis_agent"],
|
|
@@ -151,11 +143,7 @@ class GAIACrew():
|
|
| 151 |
|
| 152 |
@agent
|
| 153 |
def audio_analysis_agent(self) -> Agent:
|
| 154 |
-
|
| 155 |
-
print(f"π€ Audio analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 156 |
-
print(f"π€ Audio analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 157 |
-
print(f"π€ Audio analysis agent verbose: {VERBOSE_AGENT}")
|
| 158 |
-
print(f"π€ Audio analysis agent LLM: {LLM_AGENT}")
|
| 159 |
|
| 160 |
return Agent(
|
| 161 |
config=self.agents_config["audio_analysis_agent"],
|
|
@@ -170,11 +158,7 @@ class GAIACrew():
|
|
| 170 |
|
| 171 |
@agent
|
| 172 |
def video_analysis_agent(self) -> Agent:
|
| 173 |
-
|
| 174 |
-
print(f"π€ Video analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 175 |
-
print(f"π€ Video analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 176 |
-
print(f"π€ Video analysis agent verbose: {VERBOSE_AGENT}")
|
| 177 |
-
print(f"π€ Video analysis agent LLM: {LLM_AGENT}")
|
| 178 |
|
| 179 |
return Agent(
|
| 180 |
config=self.agents_config["video_analysis_agent"],
|
|
@@ -189,11 +173,7 @@ class GAIACrew():
|
|
| 189 |
|
| 190 |
@agent
|
| 191 |
def youtube_analysis_agent(self) -> Agent:
|
| 192 |
-
|
| 193 |
-
print(f"π€ Youtube analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 194 |
-
print(f"π€ Youtube analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 195 |
-
print(f"π€ Youtube analysis agent verbose: {VERBOSE_AGENT}")
|
| 196 |
-
print(f"π€ Youtube analysis agent LLM: {LLM_AGENT}")
|
| 197 |
|
| 198 |
return Agent(
|
| 199 |
config=self.agents_config["youtube_analysis_agent"],
|
|
@@ -208,11 +188,7 @@ class GAIACrew():
|
|
| 208 |
|
| 209 |
@agent
|
| 210 |
def document_analysis_agent(self) -> Agent:
|
| 211 |
-
|
| 212 |
-
print(f"π€ Document analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 213 |
-
print(f"π€ Document analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 214 |
-
print(f"π€ Document analysis agent verbose: {VERBOSE_AGENT}")
|
| 215 |
-
print(f"π€ Document analysis agent LLM: {LLM_AGENT}")
|
| 216 |
|
| 217 |
return Agent(
|
| 218 |
config=self.agents_config["document_analysis_agent"],
|
|
@@ -227,11 +203,7 @@ class GAIACrew():
|
|
| 227 |
|
| 228 |
@agent
|
| 229 |
def arithmetic_agent(self) -> Agent:
|
| 230 |
-
|
| 231 |
-
print(f"π€ Arithmetic agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 232 |
-
print(f"π€ Arithmetic agent max iterations: {MAX_ITER_AGENT}")
|
| 233 |
-
print(f"π€ Arithmetic agent verbose: {VERBOSE_AGENT}")
|
| 234 |
-
print(f"π€ Arithmetic agent LLM: {LLM_AGENT}")
|
| 235 |
|
| 236 |
return Agent(
|
| 237 |
config=self.agents_config["document_analysis_agent"],
|
|
@@ -250,11 +222,7 @@ class GAIACrew():
|
|
| 250 |
|
| 251 |
@agent
|
| 252 |
def code_generation_and_execution_agent(self) -> Agent:
|
| 253 |
-
|
| 254 |
-
print(f"π€ Code generation and execution agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 255 |
-
print(f"π€ Code generation and execution agent max iterations: {MAX_ITER_AGENT}")
|
| 256 |
-
print(f"π€ Code generation and execution agent verbose: {VERBOSE_AGENT}")
|
| 257 |
-
print(f"π€ Code generation and execution agent LLM: {LLM_AGENT}")
|
| 258 |
|
| 259 |
return Agent(
|
| 260 |
config=self.agents_config["code_generation_and_execution_agent"],
|
|
@@ -269,11 +237,7 @@ class GAIACrew():
|
|
| 269 |
|
| 270 |
@agent
|
| 271 |
def code_execution_agent(self) -> Agent:
|
| 272 |
-
|
| 273 |
-
print(f"π€ Code execution agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 274 |
-
print(f"π€ Code execution agent max iterations: {MAX_ITER_AGENT}")
|
| 275 |
-
print(f"π€ Code execution agent verbose: {VERBOSE_AGENT}")
|
| 276 |
-
print(f"π€ Code execution agent LLM: {LLM_AGENT}")
|
| 277 |
|
| 278 |
return Agent(
|
| 279 |
config=self.agents_config["code_execution_agent"],
|
|
@@ -288,11 +252,7 @@ class GAIACrew():
|
|
| 288 |
|
| 289 |
@agent
|
| 290 |
def manager_agent(self) -> Agent:
|
| 291 |
-
|
| 292 |
-
print(f"π€ Manager reasoning max attempts: {MAX_REASONING_ATTEMPTS_MANAGER}")
|
| 293 |
-
print(f"π€ Manager max iterations: {MAX_ITER_MANAGER}")
|
| 294 |
-
print(f"π€ Manager verbose: {VERBOSE_MANAGER}")
|
| 295 |
-
print(f"π€ Manager LLM: {LLM_MANAGER}")
|
| 296 |
|
| 297 |
return Agent(
|
| 298 |
config=self.agents_config["manager_agent"],
|
|
|
|
| 68 |
logging.getLogger("openinference").setLevel(logging.CRITICAL)
|
| 69 |
logging.getLogger("opentelemetry").setLevel(logging.CRITICAL)
|
| 70 |
|
| 71 |
+
def _print_agent_config(agent_name: str, reasoning: bool, max_reasoning_attempts: int, max_iter: int, verbose: bool, llm):
|
| 72 |
+
"""Print agent configuration details."""
|
| 73 |
+
print(f"π€ {agent_name} reasoning: {reasoning}")
|
| 74 |
+
print(f"π€ {agent_name} reasoning max attempts: {max_reasoning_attempts}")
|
| 75 |
+
print(f"π€ {agent_name} max iterations: {max_iter}")
|
| 76 |
+
print(f"π€ {agent_name} verbose: {verbose}")
|
| 77 |
+
print(f"π€ {agent_name} LLM: {llm}")
|
| 78 |
+
|
| 79 |
@CrewBase
|
| 80 |
class GAIACrew():
|
| 81 |
agents: List[BaseAgent]
|
|
|
|
| 83 |
|
| 84 |
@agent
|
| 85 |
def web_search_agent(self) -> Agent:
|
| 86 |
+
_print_agent_config("Web search agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
return Agent(
|
| 89 |
config=self.agents_config["web_search_agent"],
|
|
|
|
| 98 |
|
| 99 |
@agent
|
| 100 |
def web_browser_agent(self) -> Agent:
|
| 101 |
+
_print_agent_config("Web browser agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
return Agent(
|
| 104 |
config=self.agents_config["web_browser_agent"],
|
|
|
|
| 113 |
|
| 114 |
@agent
|
| 115 |
def chess_analysis_agent(self) -> Agent:
|
| 116 |
+
_print_agent_config("Chess analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
return Agent(
|
| 119 |
config=self.agents_config["chess_analysis_agent"],
|
|
|
|
| 128 |
|
| 129 |
@agent
|
| 130 |
def image_analysis_agent(self) -> Agent:
|
| 131 |
+
_print_agent_config("Image analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
return Agent(
|
| 134 |
config=self.agents_config["image_analysis_agent"],
|
|
|
|
| 143 |
|
| 144 |
@agent
|
| 145 |
def audio_analysis_agent(self) -> Agent:
|
| 146 |
+
_print_agent_config("Audio analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
return Agent(
|
| 149 |
config=self.agents_config["audio_analysis_agent"],
|
|
|
|
| 158 |
|
| 159 |
@agent
|
| 160 |
def video_analysis_agent(self) -> Agent:
|
| 161 |
+
_print_agent_config("Video analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
return Agent(
|
| 164 |
config=self.agents_config["video_analysis_agent"],
|
|
|
|
| 173 |
|
| 174 |
@agent
|
| 175 |
def youtube_analysis_agent(self) -> Agent:
|
| 176 |
+
_print_agent_config("Youtube analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
return Agent(
|
| 179 |
config=self.agents_config["youtube_analysis_agent"],
|
|
|
|
| 188 |
|
| 189 |
@agent
|
| 190 |
def document_analysis_agent(self) -> Agent:
|
| 191 |
+
_print_agent_config("Document analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
return Agent(
|
| 194 |
config=self.agents_config["document_analysis_agent"],
|
|
|
|
| 203 |
|
| 204 |
@agent
|
| 205 |
def arithmetic_agent(self) -> Agent:
|
| 206 |
+
_print_agent_config("Arithmetic agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
return Agent(
|
| 209 |
config=self.agents_config["document_analysis_agent"],
|
|
|
|
| 222 |
|
| 223 |
@agent
|
| 224 |
def code_generation_and_execution_agent(self) -> Agent:
|
| 225 |
+
_print_agent_config("Code generation and execution agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
return Agent(
|
| 228 |
config=self.agents_config["code_generation_and_execution_agent"],
|
|
|
|
| 237 |
|
| 238 |
@agent
|
| 239 |
def code_execution_agent(self) -> Agent:
|
| 240 |
+
_print_agent_config("Code execution agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
return Agent(
|
| 243 |
config=self.agents_config["code_execution_agent"],
|
|
|
|
| 252 |
|
| 253 |
@agent
|
| 254 |
def manager_agent(self) -> Agent:
|
| 255 |
+
_print_agent_config("Manager", REASONING_MANAGER, MAX_REASONING_ATTEMPTS_MANAGER, MAX_ITER_MANAGER, VERBOSE_MANAGER, LLM_MANAGER)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
|
| 257 |
return Agent(
|
| 258 |
config=self.agents_config["manager_agent"],
|