praisonaiagents 0.0.32__py3-none-any.whl → 0.0.34__py3-none-any.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.
- praisonaiagents/agent/agent.py +2 -1
- praisonaiagents/agents/agents.py +37 -9
- praisonaiagents/process/process.py +0 -2
- {praisonaiagents-0.0.32.dist-info → praisonaiagents-0.0.34.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.32.dist-info → praisonaiagents-0.0.34.dist-info}/RECORD +7 -7
- {praisonaiagents-0.0.32.dist-info → praisonaiagents-0.0.34.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.32.dist-info → praisonaiagents-0.0.34.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
praisonaiagents/agents/agents.py
CHANGED
@@ -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=
|
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=
|
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
|
-
|
386
|
-
|
387
|
-
|
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
|
-
|
600
|
-
|
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
|
-
|
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,13 +1,13 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=Pm_HNlIsenf5zIstcVNk6nteJmOEnI4nB-zB-YL0Jgo,1160
|
2
2
|
praisonaiagents/main.py,sha256=uMBdwxjnJKHLPUzr_5vXlkuhCUO6EW5O8XC0M-h47sE,13915
|
3
3
|
praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
|
4
|
-
praisonaiagents/agent/agent.py,sha256=
|
4
|
+
praisonaiagents/agent/agent.py,sha256=vY3RnrRoXQv_0-_Yo-qw-M_P4SKS4tzEbchD7Qi6rzc,34607
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
|
6
|
-
praisonaiagents/agents/agents.py,sha256=
|
6
|
+
praisonaiagents/agents/agents.py,sha256=Os_k25-temlpzzncyElqbQI-e29nlcxqfJYy_ZUIprY,31004
|
7
7
|
praisonaiagents/agents/autoagents.py,sha256=bjC2O5oZmoJItJXIMPTWc2lsp_AJC9tMiTQOal2hwPA,13532
|
8
8
|
praisonaiagents/memory/memory.py,sha256=ZxqSpOUxk9jeTKGW0ZiTifC0uZtym-EZILP3kuOOKkU,35626
|
9
9
|
praisonaiagents/process/__init__.py,sha256=lkYbL7Hn5a0ldvJtkdH23vfIIZLIcanK-65C0MwaorY,52
|
10
|
-
praisonaiagents/process/process.py,sha256=
|
10
|
+
praisonaiagents/process/process.py,sha256=_tNdptYceCqh8tVIW7faCnxZ4fWtdT20hFfWucVhEEg,25209
|
11
11
|
praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
|
12
12
|
praisonaiagents/task/task.py,sha256=mwmk98nesfz102qTnHSE5VuuPIgHiPDxjeEX7b7g2BA,10023
|
13
13
|
praisonaiagents/tools/__init__.py,sha256=-0lV5n5cG54vYW6REjXIfuJnCLKnfQIDlXsySCaPB9s,7347
|
@@ -30,7 +30,7 @@ praisonaiagents/tools/wikipedia_tools.py,sha256=pGko-f33wqXgxJTv8db7TbizY5XnzBQR
|
|
30
30
|
praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxNMMs1A,17122
|
31
31
|
praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
|
32
32
|
praisonaiagents/tools/yfinance_tools.py,sha256=nmzjS7G_5GqMQD4r867mt17dHg5xvtsYDDfOPh68SgE,8105
|
33
|
-
praisonaiagents-0.0.
|
34
|
-
praisonaiagents-0.0.
|
35
|
-
praisonaiagents-0.0.
|
36
|
-
praisonaiagents-0.0.
|
33
|
+
praisonaiagents-0.0.34.dist-info/METADATA,sha256=BwKur9B8KcI2MTCDnwhHUf8C3HIzXcjKNlaUeWCjZKo,306
|
34
|
+
praisonaiagents-0.0.34.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
35
|
+
praisonaiagents-0.0.34.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
36
|
+
praisonaiagents-0.0.34.dist-info/RECORD,,
|
File without changes
|
File without changes
|