PraisonAI 2.0.15__cp312-cp312-manylinux_2_39_x86_64.whl → 2.0.17__cp312-cp312-manylinux_2_39_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of PraisonAI might be problematic. Click here for more details.

@@ -202,54 +202,42 @@ class AgentsGenerator:
202
202
 
203
203
  def load_tools_from_tools_py(self):
204
204
  """
205
- Automatically loads all tools (functions and tool definitions) from tools.py file.
205
+ Imports and returns all contents from tools.py file.
206
+ Also adds the tools to the global namespace.
206
207
 
207
208
  Returns:
208
- dict: A dictionary containing:
209
- - Function names as keys and function objects as values
210
- - Tool definition names as keys and tool definition dictionaries as values
211
-
212
- Note:
213
- This function looks for:
214
- 1. Regular functions
215
- 2. Tool definition dictionaries (containing 'type' and 'function' keys)
216
- 3. Variables named as tools or ending with '_tool'
209
+ list: A list of callable functions with proper formatting
217
210
  """
218
- tools_dict = {}
211
+ tools_list = []
219
212
  try:
220
213
  # Try to import tools.py from current directory
221
214
  spec = importlib.util.spec_from_file_location("tools", "tools.py")
215
+ self.logger.info(f"Spec: {spec}")
222
216
  if spec is None:
223
- self.logger.warning("tools.py not found in current directory")
224
- return tools_dict
217
+ self.logger.info("tools.py not found in current directory")
218
+ return tools_list
225
219
 
226
220
  module = importlib.util.module_from_spec(spec)
227
221
  spec.loader.exec_module(module)
228
222
 
229
- # Get all module attributes
223
+ # Get all module attributes except private ones and classes
230
224
  for name, obj in inspect.getmembers(module):
231
- # Skip private attributes
232
- if name.startswith('_'):
233
- continue
234
-
235
- # Case 1: Regular functions
236
- if inspect.isfunction(obj) and obj.__module__ == "tools":
237
- tools_dict[name] = obj
238
-
239
- # Case 2: Tool definition dictionaries
240
- elif isinstance(obj, dict) and obj.get('type') == 'function' and 'function' in obj:
241
- tools_dict[name] = obj
242
-
243
- # Case 3: Variables named as tools
244
- elif (name.endswith('_tool') or name == 'tools') and not inspect.ismodule(obj):
245
- tools_dict[name] = obj
246
-
247
- self.logger.debug(f"Loaded {len(tools_dict)} tools from tools.py")
225
+ if (not name.startswith('_') and
226
+ callable(obj) and
227
+ not inspect.isclass(obj)):
228
+ # Add the function to global namespace
229
+ globals()[name] = obj
230
+ # Add to tools list
231
+ tools_list.append(obj)
232
+ self.logger.info(f"Loaded and globalized tool function: {name}")
233
+
234
+ self.logger.info(f"Loaded {len(tools_list)} tool functions from tools.py")
235
+ self.logger.info(f"Tools list: {tools_list}")
248
236
 
249
237
  except Exception as e:
250
238
  self.logger.warning(f"Error loading tools from tools.py: {e}")
251
239
 
252
- return tools_dict
240
+ return tools_list
253
241
 
254
242
  def generate_crew_and_kickoff(self):
255
243
  """
@@ -549,7 +537,9 @@ class AgentsGenerator:
549
537
  tasks = []
550
538
  tasks_dict = {}
551
539
 
552
- tools_dict = self.load_tools_from_tools_py()
540
+ # Load tools once at the beginning
541
+ tools_list = self.load_tools_from_tools_py()
542
+ self.logger.info(f"Loaded tools: {tools_list}")
553
543
 
554
544
  # Create agents from config
555
545
  for role, details in config['roles'].items():
@@ -557,34 +547,16 @@ class AgentsGenerator:
557
547
  goal_filled = details['goal'].format(topic=topic)
558
548
  backstory_filled = details['backstory'].format(topic=topic)
559
549
 
560
- # Get agent tools
561
- agent_tools = [tools_dict[tool] for tool in details.get('tools', [])
562
- if tool in tools_dict]
563
-
564
- # Configure LLM
565
- llm_model = details.get('llm')
566
- if llm_model:
567
- llm = llm_model.get("model", os.environ.get("MODEL_NAME", "gpt-4o"))
568
- else:
569
- llm = os.environ.get("MODEL_NAME", "gpt-4o")
570
-
571
- # Configure function calling LLM
572
- function_calling_llm_model = details.get('function_calling_llm')
573
- if function_calling_llm_model:
574
- function_calling_llm = function_calling_llm_model.get("model", os.environ.get("MODEL_NAME", "openai/gpt-4o"))
575
- else:
576
- function_calling_llm = os.environ.get("MODEL_NAME", "gpt-4o")
577
-
578
- # Create PraisonAI agent
550
+ # Pass all loaded tools to the agent
579
551
  agent = PraisonAgent(
580
552
  name=role_filled,
581
553
  role=role_filled,
582
554
  goal=goal_filled,
583
555
  backstory=backstory_filled,
584
- tools=agent_tools,
556
+ tools=tools_list, # Pass the entire tools list to the agent
585
557
  allow_delegation=details.get('allow_delegation', False),
586
- llm=llm,
587
- function_calling_llm=function_calling_llm,
558
+ llm=details.get('llm', {}).get("model", os.environ.get("MODEL_NAME", "gpt-4o")),
559
+ function_calling_llm=details.get('function_calling_llm', {}).get("model", os.environ.get("MODEL_NAME", "gpt-4o")),
588
560
  max_iter=details.get('max_iter', 15),
589
561
  max_rpm=details.get('max_rpm'),
590
562
  max_execution_time=details.get('max_execution_time'),
@@ -593,25 +565,27 @@ class AgentsGenerator:
593
565
  system_template=details.get('system_template'),
594
566
  prompt_template=details.get('prompt_template'),
595
567
  response_template=details.get('response_template'),
568
+ reflect_llm=details.get('reflect_llm', {}).get("model", os.environ.get("MODEL_NAME", "gpt-4o")),
569
+ min_reflect=details.get('min_reflect', 1),
570
+ max_reflect=details.get('max_reflect', 3),
596
571
  )
597
572
 
598
- # Set agent callback if provided
599
573
  if self.agent_callback:
600
574
  agent.step_callback = self.agent_callback
601
575
 
602
576
  agents[role] = agent
577
+ self.logger.info(f"Created agent {role_filled} with tools: {agent.tools}")
603
578
 
604
579
  # Create tasks for the agent
605
580
  for task_name, task_details in details.get('tasks', {}).items():
606
581
  description_filled = task_details['description'].format(topic=topic)
607
582
  expected_output_filled = task_details['expected_output'].format(topic=topic)
608
583
 
609
- # Create task using PraisonAI Task class
610
584
  task = PraisonTask(
611
585
  description=description_filled,
612
586
  expected_output=expected_output_filled,
613
587
  agent=agent,
614
- tools=task_details.get('tools', []),
588
+ tools=tools_list, # Pass the same tools list to the task
615
589
  async_execution=task_details.get('async_execution', False),
616
590
  context=[],
617
591
  config=task_details.get('config', {}),
@@ -621,8 +595,9 @@ class AgentsGenerator:
621
595
  callback=task_details.get('callback'),
622
596
  create_directory=task_details.get('create_directory', False)
623
597
  )
598
+
599
+ self.logger.info(f"Created task {task_name} with tools: {task.tools}")
624
600
 
625
- # Set task callback if provided
626
601
  if self.task_callback:
627
602
  task.callback = self.task_callback
628
603
 
@@ -634,7 +609,7 @@ class AgentsGenerator:
634
609
  for task_name, task_details in details.get('tasks', {}).items():
635
610
  task = tasks_dict[task_name]
636
611
  context_tasks = [tasks_dict[ctx] for ctx in task_details.get('context', [])
637
- if ctx in tasks_dict]
612
+ if ctx in tasks_dict]
638
613
  task.context = context_tasks
639
614
 
640
615
  # Create and run the PraisonAI agents
@@ -652,13 +627,12 @@ class AgentsGenerator:
652
627
  tasks=tasks,
653
628
  verbose=2
654
629
  )
655
-
630
+
656
631
  self.logger.debug("Final Configuration:")
657
632
  self.logger.debug(f"Agents: {agents.agents}")
658
633
  self.logger.debug(f"Tasks: {agents.tasks}")
659
634
 
660
635
  response = agents.start()
661
- # result = f"### Task Output ###\n{response}"
662
636
  self.logger.debug(f"Result: {response}")
663
637
  result = ""
664
638
 
praisonai/deploy.py CHANGED
@@ -56,7 +56,7 @@ class CloudDeployer:
56
56
  file.write("FROM python:3.11-slim\n")
57
57
  file.write("WORKDIR /app\n")
58
58
  file.write("COPY . .\n")
59
- file.write("RUN pip install flask praisonai==2.0.15 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==2.0.17 gunicorn markdown\n")
60
60
  file.write("EXPOSE 8080\n")
61
61
  file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
62
62
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PraisonAI
3
- Version: 2.0.15
4
- Summary: PraisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
3
+ Version: 2.0.17
4
+ Summary: PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient humanagent collaboration.
5
5
  Author: Mervin Praison
6
6
  Requires-Python: >=3.10,<3.13
7
7
  Classifier: Programming Language :: Python :: 3
@@ -46,7 +46,7 @@ Requires-Dist: openai (>=1.54.0) ; extra == "call"
46
46
  Requires-Dist: playwright (>=1.47.0) ; extra == "chat" or extra == "code"
47
47
  Requires-Dist: plotly (>=5.24.0) ; extra == "realtime"
48
48
  Requires-Dist: praisonai-tools (>=0.0.7) ; extra == "crewai" or extra == "autogen"
49
- Requires-Dist: praisonaiagents (>=0.0.7)
49
+ Requires-Dist: praisonaiagents (>=0.0.13)
50
50
  Requires-Dist: pyautogen (>=0.2.19) ; extra == "autogen"
51
51
  Requires-Dist: pydantic (<=2.10.1) ; extra == "chat" or extra == "code"
52
52
  Requires-Dist: pyngrok (>=1.4.0) ; extra == "call"
@@ -529,33 +529,7 @@ if __name__ == "__main__":
529
529
 
530
530
  ## Commands to Install Dependencies:
531
531
 
532
- 1. **Install all dependencies, including dev dependencies:**
533
-
534
- ```sh
535
- poetry install
536
- ```
537
-
538
- 2. **Install only documentation dependencies:**
539
-
540
- ```sh
541
- poetry install --with docs
542
- ```
543
-
544
- 3. **Install only test dependencies:**
545
-
546
- ```sh
547
- poetry install --with test
548
- ```
549
-
550
- 4. **Install only dev dependencies:**
551
-
552
- ```sh
553
- poetry install --with dev
554
- ```
555
-
556
- This configuration ensures that your development dependencies are correctly categorized and installed as needed.
557
-
558
- ### Using uv (Fast Python Package Installer)
532
+ ### Using uv
559
533
  ```bash
560
534
  # Install uv if you haven't already
561
535
  pip install uv
@@ -1,11 +1,11 @@
1
1
  praisonai/__init__.py,sha256=JrgyPlzZfLlozoW7SHZ1nVJ63rLPR3ki2k5ZPywYrnI,175
2
2
  praisonai/__main__.py,sha256=MVgsjMThjBexHt4nhd760JCqvP4x0IQcwo8kULOK4FQ,144
3
- praisonai/agents_generator.py,sha256=D9UOVyx0dzRw02rQ_qI1nU3sxqayY5PDy3t4OMW-ty8,29027
3
+ praisonai/agents_generator.py,sha256=nA8duf4FxksuRf-luwSN6n1IKhPVqTiVHi32WCO79dA,28177
4
4
  praisonai/api/call.py,sha256=iHdAlgIH_oTsEbjaGGu1Jjo6DTfMR-SfFdtSxnOLCeY,11032
5
5
  praisonai/auto.py,sha256=uLDm8CU3L_3amZsd55yzf9RdBF1uW-BGSx7nl9ctNZ4,8680
6
6
  praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
7
7
  praisonai/cli.py,sha256=O7abKND2MP_yDdD_OclPoiZG1JRoGc4u9KowbRzuQuQ,21209
8
- praisonai/deploy.py,sha256=zMk5X8hU_HqP0k8rsZr9qVe0bLbNMpEIihuJE1Py_ho,6028
8
+ praisonai/deploy.py,sha256=Oex-u4Q6thJ55VdNXUntp2_2C1RZ0GUrWHl29Z6JX5g,6028
9
9
  praisonai/inbuilt_tools/__init__.py,sha256=fai4ZJIKz7-iOnGZv5jJX0wmT77PKa4x2jqyaJddKFA,569
10
10
  praisonai/inbuilt_tools/autogen_tools.py,sha256=kJdEv61BTYvdHOaURNEpBcWq8Rs-oC03loNFTIjT-ak,4687
11
11
  praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
@@ -75,8 +75,8 @@ praisonai/ui/realtimeclient/realtimedocs.txt,sha256=hmgd8Uwy2SkjSndyyF_-ZOaNxiyH
75
75
  praisonai/ui/realtimeclient/tools.py,sha256=IJOYwVOBW5Ocn5_iV9pFkmSKR3WU3YpX3kwF0I3jikQ,7855
76
76
  praisonai/ui/sql_alchemy.py,sha256=cfyL9uFfuizKFvW0aZfUBlJWPQYI-YBi1v4vxlkb1BQ,29615
77
77
  praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
78
- praisonai-2.0.15.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
79
- praisonai-2.0.15.dist-info/METADATA,sha256=X9ZH6sl93lxKN81Mt6C9fuleTtGGUU5WnZjBIkqLrTo,19757
80
- praisonai-2.0.15.dist-info/WHEEL,sha256=x1HiyTP_r-PIOu3STHzjukjf5kVLXzgVftSXf5bl8AU,110
81
- praisonai-2.0.15.dist-info/entry_points.txt,sha256=I_xc6a6MNTTfLxYmAxe0rgey0G-_hbY07oFW-ZDnkw4,135
82
- praisonai-2.0.15.dist-info/RECORD,,
78
+ praisonai-2.0.17.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
79
+ praisonai-2.0.17.dist-info/METADATA,sha256=SLmJ2xljw91aNYSGdH_Bdx3-P-0600zbFg-ZQM6NsjE,19304
80
+ praisonai-2.0.17.dist-info/WHEEL,sha256=x1HiyTP_r-PIOu3STHzjukjf5kVLXzgVftSXf5bl8AU,110
81
+ praisonai-2.0.17.dist-info/entry_points.txt,sha256=I_xc6a6MNTTfLxYmAxe0rgey0G-_hbY07oFW-ZDnkw4,135
82
+ praisonai-2.0.17.dist-info/RECORD,,