praisonaiagents 0.0.32__tar.gz → 0.0.34__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/PKG-INFO +1 -1
  2. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/agent/agent.py +2 -1
  3. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/agents/agents.py +37 -9
  4. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/process/process.py +0 -2
  5. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents.egg-info/PKG-INFO +1 -1
  6. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/pyproject.toml +1 -1
  7. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/__init__.py +0 -0
  8. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/agent/__init__.py +0 -0
  9. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/agents/__init__.py +0 -0
  10. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/agents/autoagents.py +0 -0
  11. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/main.py +0 -0
  12. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/memory/memory.py +0 -0
  13. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/process/__init__.py +0 -0
  14. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/task/__init__.py +0 -0
  15. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/task/task.py +0 -0
  16. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/__init__.py +0 -0
  17. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/arxiv_tools.py +0 -0
  18. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/calculator_tools.py +0 -0
  19. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/csv_tools.py +0 -0
  20. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/duckdb_tools.py +0 -0
  21. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/duckduckgo_tools.py +0 -0
  22. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/excel_tools.py +0 -0
  23. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/file_tools.py +0 -0
  24. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/json_tools.py +0 -0
  25. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/newspaper_tools.py +0 -0
  26. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/pandas_tools.py +0 -0
  27. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/python_tools.py +0 -0
  28. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/shell_tools.py +0 -0
  29. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/spider_tools.py +0 -0
  30. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/test.py +0 -0
  31. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/tools.py +0 -0
  32. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/wikipedia_tools.py +0 -0
  33. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/xml_tools.py +0 -0
  34. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/yaml_tools.py +0 -0
  35. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents/tools/yfinance_tools.py +0 -0
  36. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents.egg-info/SOURCES.txt +0 -0
  37. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents.egg-info/dependency_links.txt +0 -0
  38. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents.egg-info/requires.txt +0 -0
  39. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/praisonaiagents.egg-info/top_level.txt +0 -0
  40. {praisonaiagents-0.0.32 → praisonaiagents-0.0.34}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: praisonaiagents
3
- Version: 0.0.32
3
+ Version: 0.0.34
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -16,7 +16,8 @@ from ..main import (
16
16
  display_self_reflection,
17
17
  ReflectionOutput,
18
18
  client,
19
- error_logs
19
+ error_logs,
20
+ adisplay_instruction
20
21
  )
21
22
  import inspect
22
23
 
@@ -211,6 +211,11 @@ class PraisonAIAgents:
211
211
 
212
212
  executor_agent = task.agent
213
213
 
214
+ # Ensure tools are available from both task and agent
215
+ tools = task.tools or []
216
+ if executor_agent and executor_agent.tools:
217
+ tools.extend(executor_agent.tools)
218
+
214
219
  task_prompt = f"""
215
220
  You need to do the following task: {task.description}.
216
221
  Expected Output: {task.expected_output}.
@@ -267,14 +272,14 @@ Here are the results of previous tasks that might be useful:\n
267
272
 
268
273
  agent_output = await executor_agent.achat(
269
274
  _get_multimodal_message(task_prompt, task.images),
270
- tools=task.tools,
275
+ tools=tools,
271
276
  output_json=task.output_json,
272
277
  output_pydantic=task.output_pydantic
273
278
  )
274
279
  else:
275
280
  agent_output = await executor_agent.achat(
276
281
  task_prompt,
277
- tools=task.tools,
282
+ tools=tools,
278
283
  output_json=task.output_json,
279
284
  output_pydantic=task.output_pydantic
280
285
  )
@@ -380,11 +385,25 @@ Here are the results of previous tasks that might be useful:\n
380
385
  )
381
386
 
382
387
  if self.process == "workflow":
388
+ # Collect all tasks that should run in parallel
389
+ parallel_tasks = []
383
390
  async for task_id in process.aworkflow():
384
- if self.tasks[task_id].async_execution:
385
- await self.arun_task(task_id)
386
- else:
387
- self.run_task(task_id)
391
+ if self.tasks[task_id].async_execution and self.tasks[task_id].is_start:
392
+ parallel_tasks.append(task_id)
393
+ elif parallel_tasks:
394
+ # Execute collected parallel tasks
395
+ await asyncio.gather(*[self.arun_task(t) for t in parallel_tasks])
396
+ parallel_tasks = []
397
+ # Run the current non-parallel task
398
+ if self.tasks[task_id].async_execution:
399
+ await self.arun_task(task_id)
400
+ else:
401
+ self.run_task(task_id)
402
+
403
+ # Execute any remaining parallel tasks
404
+ if parallel_tasks:
405
+ await asyncio.gather(*[self.arun_task(t) for t in parallel_tasks])
406
+
388
407
  elif self.process == "sequential":
389
408
  async for task_id in process.asequential():
390
409
  if self.tasks[task_id].async_execution:
@@ -596,8 +615,12 @@ Here are the results of previous tasks that might be useful:\n
596
615
  task.status = "completed"
597
616
  # Run execute_callback for memory operations
598
617
  try:
599
- loop = asyncio.get_event_loop()
600
- loop.run_until_complete(task.execute_callback(task_output))
618
+ if asyncio.get_event_loop().is_running():
619
+ asyncio.create_task(task.execute_callback(task_output))
620
+ else:
621
+ loop = asyncio.new_event_loop()
622
+ asyncio.set_event_loop(loop)
623
+ loop.run_until_complete(task.execute_callback(task_output))
601
624
  except Exception as e:
602
625
  logger.error(f"Error executing memory callback for task {task_id}: {e}")
603
626
  logger.exception(e)
@@ -606,7 +629,12 @@ Here are the results of previous tasks that might be useful:\n
606
629
  if task.callback:
607
630
  try:
608
631
  if asyncio.iscoroutinefunction(task.callback):
609
- loop.run_until_complete(task.callback(task_output))
632
+ if asyncio.get_event_loop().is_running():
633
+ asyncio.create_task(task.callback(task_output))
634
+ else:
635
+ loop = asyncio.new_event_loop()
636
+ asyncio.set_event_loop(loop)
637
+ loop.run_until_complete(task.callback(task_output))
610
638
  else:
611
639
  task.callback(task_output)
612
640
  except Exception as e:
@@ -150,7 +150,6 @@ Return a JSON object with an 'items' array containing the items to process.
150
150
  break
151
151
 
152
152
  if not next_task and current_task and current_task.next_tasks:
153
- print(current_task.next_tasks)
154
153
  next_task_name = current_task.next_tasks[0]
155
154
  next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
156
155
 
@@ -418,7 +417,6 @@ Return a JSON object with an 'items' array containing the items to process.
418
417
  break
419
418
 
420
419
  if not next_task and current_task and current_task.next_tasks:
421
- print(current_task.next_tasks)
422
420
  next_task_name = current_task.next_tasks[0]
423
421
  next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
424
422
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: praisonaiagents
3
- Version: 0.0.32
3
+ Version: 0.0.34
4
4
  Summary: Praison AI agents for completing complex tasks with Self Reflection Agents
5
5
  Author: Mervin Praison
6
6
  Requires-Dist: pydantic
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "praisonaiagents"
7
- version = "0.0.32"
7
+ version = "0.0.34"
8
8
  description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
9
9
  authors = [
10
10
  { name="Mervin Praison" }