Kackle commited on
Commit
8117b77
·
verified ·
1 Parent(s): 0d14730

more agents added

Browse files
Files changed (1) hide show
  1. app.py +53 -20
app.py CHANGED
@@ -112,25 +112,55 @@ class SlpMultiAgent:
112
  max_tokens=1000 # Keep higher tokens for complex reasoning
113
  )
114
 
115
- # Create specialized agents
116
  research_agent = CodeAgent(
117
- tools=[ReliableSearchTool(), KnowledgeBaseTool()],
118
  model=model,
119
- additional_authorized_imports=["pandas", "time", "json", "requests", "urllib", "re", "datetime"],
120
  max_steps=4,
121
  name="ResearchAgent",
122
  verbosity_level=0,
123
- description="Specialized agent for research and fact-finding with knowledge base access."
 
 
 
 
 
 
 
 
 
 
124
  )
125
 
126
- analysis_agent = CodeAgent(
127
  tools=[],
128
  model=model,
129
- additional_authorized_imports=["pandas", "time", "json", "requests", "math", "statistics"],
 
 
 
 
 
 
 
 
 
 
130
  max_steps=3,
131
- name="AnalysisAgent",
 
 
 
 
 
 
 
 
 
 
132
  verbosity_level=0,
133
- description="Specialized agent for data analysis, calculations, and logical reasoning."
134
  )
135
 
136
  manager_agent = CodeAgent(
@@ -140,7 +170,7 @@ class SlpMultiAgent:
140
  max_tokens=1200
141
  ),
142
  tools=[KnowledgeBaseTool()],
143
- managed_agents=[research_agent, analysis_agent],
144
  name="ManagerAgent",
145
  description="A manager agent that coordinates research and analysis agents to solve complex questions.",
146
  additional_authorized_imports=[
@@ -153,7 +183,7 @@ class SlpMultiAgent:
153
  ],
154
  planning_interval=2,
155
  verbosity_level=1,
156
- max_steps=8,
157
  final_answer_checks=[check_reasoning]
158
  )
159
 
@@ -169,19 +199,22 @@ class SlpMultiAgent:
169
  lambda: manager_agent.run(f"""
170
  Question: {short_question}
171
 
172
- You have access to ResearchAgent and AnalysisAgent. Use them strategically:
173
- - ResearchAgent: For finding facts, searching, and knowledge lookup
174
- - AnalysisAgent: For calculations, data processing, and logical reasoning
 
 
 
175
 
176
- Process:
177
- 1. Analyze what type of question this is
178
- 2. Use knowledge_base() to check for relevant context
179
- 3. Delegate to appropriate agents if needed
180
- 4. Synthesize information and provide final answer
181
 
182
- CRITICAL: End with <code>final_answer("exact answer only")</code>
183
 
184
- The final_answer must contain ONLY the specific answer requested - no explanations.
185
  """)
186
  )
187
  break # Success, exit retry loop
 
112
  max_tokens=1000 # Keep higher tokens for complex reasoning
113
  )
114
 
115
+ # Create specialized agents for complex problem-solving
116
  research_agent = CodeAgent(
117
+ tools=[KnowledgeBaseTool()],
118
  model=model,
119
+ additional_authorized_imports=["pandas", "time", "json", "requests", "re", "datetime"],
120
  max_steps=4,
121
  name="ResearchAgent",
122
  verbosity_level=0,
123
+ description="Specializes in factual research, historical data, and knowledge retrieval."
124
+ )
125
+
126
+ math_agent = CodeAgent(
127
+ tools=[],
128
+ model=model,
129
+ additional_authorized_imports=["math", "statistics", "numpy", "pandas", "fractions", "decimal"],
130
+ max_steps=4,
131
+ name="MathAgent",
132
+ verbosity_level=0,
133
+ description="Specializes in mathematical calculations, statistics, and numerical analysis."
134
  )
135
 
136
+ logic_agent = CodeAgent(
137
  tools=[],
138
  model=model,
139
+ additional_authorized_imports=["itertools", "collections", "re", "string"],
140
+ max_steps=4,
141
+ name="LogicAgent",
142
+ verbosity_level=0,
143
+ description="Specializes in logical reasoning, pattern recognition, and problem decomposition."
144
+ )
145
+
146
+ language_agent = CodeAgent(
147
+ tools=[],
148
+ model=model,
149
+ additional_authorized_imports=["re", "string", "collections"],
150
  max_steps=3,
151
+ name="LanguageAgent",
152
+ verbosity_level=0,
153
+ description="Specializes in text analysis, word puzzles, linguistics, and language patterns."
154
+ )
155
+
156
+ data_agent = CodeAgent(
157
+ tools=[],
158
+ model=model,
159
+ additional_authorized_imports=["pandas", "json", "csv", "collections", "statistics"],
160
+ max_steps=4,
161
+ name="DataAgent",
162
  verbosity_level=0,
163
+ description="Specializes in data processing, sorting, filtering, and structured analysis."
164
  )
165
 
166
  manager_agent = CodeAgent(
 
170
  max_tokens=1200
171
  ),
172
  tools=[KnowledgeBaseTool()],
173
+ managed_agents=[research_agent, math_agent, logic_agent, language_agent, data_agent],
174
  name="ManagerAgent",
175
  description="A manager agent that coordinates research and analysis agents to solve complex questions.",
176
  additional_authorized_imports=[
 
183
  ],
184
  planning_interval=2,
185
  verbosity_level=1,
186
+ max_steps=10, # More steps for complex coordination
187
  final_answer_checks=[check_reasoning]
188
  )
189
 
 
199
  lambda: manager_agent.run(f"""
200
  Question: {short_question}
201
 
202
+ You have 5 specialized agents available:
203
+ - ResearchAgent: Facts, history, knowledge lookup
204
+ - MathAgent: Calculations, statistics, numerical problems
205
+ - LogicAgent: Logical reasoning, patterns, problem decomposition
206
+ - LanguageAgent: Text analysis, word puzzles, linguistics
207
+ - DataAgent: Data processing, sorting, structured analysis
208
 
209
+ Strategy:
210
+ 1. Analyze question type and complexity
211
+ 2. Use knowledge_base() for context
212
+ 3. Delegate to most appropriate specialist agent(s)
213
+ 4. Synthesize results into final answer
214
 
215
+ CRITICAL: End with <code>final_answer("exact answer")</code>
216
 
217
+ Final answer must be direct and specific - no explanations.
218
  """)
219
  )
220
  break # Success, exit retry loop