praisonaiagents 0.0.30__py3-none-any.whl → 0.0.32__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 +27 -3
- praisonaiagents/main.py +32 -8
- praisonaiagents/process/process.py +26 -12
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.32.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.32.dist-info}/RECORD +7 -7
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.32.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.30.dist-info → praisonaiagents-0.0.32.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
@@ -381,7 +381,7 @@ Your Goal: {self.goal}
|
|
381
381
|
display_generating("", start_time),
|
382
382
|
console=self.console,
|
383
383
|
refresh_per_second=4,
|
384
|
-
transient=
|
384
|
+
transient=True, # Changed to False to preserve output
|
385
385
|
vertical_overflow="ellipsis",
|
386
386
|
auto_refresh=True
|
387
387
|
) as live:
|
@@ -466,7 +466,15 @@ Your Goal: {self.goal}
|
|
466
466
|
display_text = next((item["text"] for item in prompt if item["type"] == "text"), "")
|
467
467
|
|
468
468
|
if display_text and str(display_text).strip():
|
469
|
-
|
469
|
+
# Pass agent information to display_instruction
|
470
|
+
agent_tools = [t.__name__ if hasattr(t, '__name__') else str(t) for t in self.tools]
|
471
|
+
display_instruction(
|
472
|
+
f"Agent {self.name} is processing prompt: {display_text}",
|
473
|
+
console=self.console,
|
474
|
+
agent_name=self.name,
|
475
|
+
agent_role=self.role,
|
476
|
+
agent_tools=agent_tools
|
477
|
+
)
|
470
478
|
|
471
479
|
response = self._chat_completion(messages, temperature=temperature, tools=tools if tools else None)
|
472
480
|
if not response:
|
@@ -525,7 +533,7 @@ Your Goal: {self.goal}
|
|
525
533
|
self.chat_history.append({"role": "user", "content": original_prompt})
|
526
534
|
self.chat_history.append({"role": "assistant", "content": response_text})
|
527
535
|
if self.verbose:
|
528
|
-
logging.
|
536
|
+
logging.debug(f"Agent {self.name} final response: {response_text}")
|
529
537
|
display_interaction(original_prompt, response_text, markdown=self.markdown, generation_time=time.time() - start_time, console=self.console)
|
530
538
|
return response_text
|
531
539
|
|
@@ -630,6 +638,22 @@ Output MUST be JSON with 'reflection' and 'satisfactory'.
|
|
630
638
|
item["text"] += "\nReturn ONLY a valid JSON object. No other text or explanation."
|
631
639
|
break
|
632
640
|
|
641
|
+
# Display instruction with agent info if verbose
|
642
|
+
if self.verbose:
|
643
|
+
display_text = prompt
|
644
|
+
if isinstance(prompt, list):
|
645
|
+
display_text = next((item["text"] for item in prompt if item["type"] == "text"), "")
|
646
|
+
|
647
|
+
if display_text and str(display_text).strip():
|
648
|
+
agent_tools = [t.__name__ if hasattr(t, '__name__') else str(t) for t in self.tools]
|
649
|
+
await adisplay_instruction(
|
650
|
+
f"Agent {self.name} is processing prompt: {display_text}",
|
651
|
+
console=self.console,
|
652
|
+
agent_name=self.name,
|
653
|
+
agent_role=self.role,
|
654
|
+
agent_tools=agent_tools
|
655
|
+
)
|
656
|
+
|
633
657
|
# Format tools if provided
|
634
658
|
formatted_tools = []
|
635
659
|
if tools:
|
praisonaiagents/main.py
CHANGED
@@ -116,10 +116,10 @@ def display_interaction(message, response, markdown=True, generation_time=None,
|
|
116
116
|
console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
|
117
117
|
|
118
118
|
if markdown:
|
119
|
-
console.print(Panel.fit(Markdown(message), title="
|
119
|
+
console.print(Panel.fit(Markdown(message), title="Task", border_style="cyan"))
|
120
120
|
console.print(Panel.fit(Markdown(response), title="Response", border_style="cyan"))
|
121
121
|
else:
|
122
|
-
console.print(Panel.fit(Text(message, style="bold green"), title="
|
122
|
+
console.print(Panel.fit(Text(message, style="bold green"), title="Task", border_style="cyan"))
|
123
123
|
console.print(Panel.fit(Text(response, style="bold blue"), title="Response", border_style="cyan"))
|
124
124
|
|
125
125
|
def display_self_reflection(message: str, console=None):
|
@@ -135,7 +135,7 @@ def display_self_reflection(message: str, console=None):
|
|
135
135
|
|
136
136
|
console.print(Panel.fit(Text(message, style="bold yellow"), title="Self Reflection", border_style="magenta"))
|
137
137
|
|
138
|
-
def display_instruction(message: str, console=None):
|
138
|
+
def display_instruction(message: str, console=None, agent_name: str = None, agent_role: str = None, agent_tools: List[str] = None):
|
139
139
|
if not message or not message.strip():
|
140
140
|
return
|
141
141
|
if console is None:
|
@@ -146,7 +146,19 @@ def display_instruction(message: str, console=None):
|
|
146
146
|
if 'instruction' in sync_display_callbacks:
|
147
147
|
sync_display_callbacks['instruction'](message=message)
|
148
148
|
|
149
|
-
|
149
|
+
# Display agent info if available
|
150
|
+
if agent_name:
|
151
|
+
agent_info = f"[bold #FF9B9B]👤 Agent:[/] [#FFE5E5]{agent_name}[/]"
|
152
|
+
if agent_role:
|
153
|
+
agent_info += f"\n[bold #B4B4B3]Role:[/] [#FFE5E5]{agent_role}[/]"
|
154
|
+
if agent_tools:
|
155
|
+
tools_str = ", ".join(f"[italic #B4D4FF]{tool}[/]" for tool in agent_tools)
|
156
|
+
agent_info += f"\n[bold #86A789]Tools:[/] {tools_str}"
|
157
|
+
console.print(Panel(agent_info, border_style="#D2E3C8", title="[bold]Agent Info[/]", title_align="left", padding=(1, 2)))
|
158
|
+
|
159
|
+
# Only print if log level is DEBUG
|
160
|
+
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
|
161
|
+
console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
|
150
162
|
|
151
163
|
def display_tool_call(message: str, console=None):
|
152
164
|
if not message or not message.strip():
|
@@ -222,10 +234,10 @@ async def adisplay_interaction(message, response, markdown=True, generation_time
|
|
222
234
|
console.print(Text(f"Response generated in {generation_time:.1f}s", style="dim"))
|
223
235
|
|
224
236
|
if markdown:
|
225
|
-
console.print(Panel.fit(Markdown(message), title="
|
237
|
+
console.print(Panel.fit(Markdown(message), title="Task", border_style="cyan"))
|
226
238
|
console.print(Panel.fit(Markdown(response), title="Response", border_style="cyan"))
|
227
239
|
else:
|
228
|
-
console.print(Panel.fit(Text(message, style="bold green"), title="
|
240
|
+
console.print(Panel.fit(Text(message, style="bold green"), title="Task", border_style="cyan"))
|
229
241
|
console.print(Panel.fit(Text(response, style="bold blue"), title="Response", border_style="cyan"))
|
230
242
|
|
231
243
|
async def adisplay_self_reflection(message: str, console=None):
|
@@ -241,7 +253,7 @@ async def adisplay_self_reflection(message: str, console=None):
|
|
241
253
|
|
242
254
|
console.print(Panel.fit(Text(message, style="bold yellow"), title="Self Reflection", border_style="magenta"))
|
243
255
|
|
244
|
-
async def adisplay_instruction(message: str, console=None):
|
256
|
+
async def adisplay_instruction(message: str, console=None, agent_name: str = None, agent_role: str = None, agent_tools: List[str] = None):
|
245
257
|
"""Async version of display_instruction."""
|
246
258
|
if not message or not message.strip():
|
247
259
|
return
|
@@ -252,7 +264,19 @@ async def adisplay_instruction(message: str, console=None):
|
|
252
264
|
if 'instruction' in async_display_callbacks:
|
253
265
|
await async_display_callbacks['instruction'](message=message)
|
254
266
|
|
255
|
-
|
267
|
+
# Display agent info if available
|
268
|
+
if agent_name:
|
269
|
+
agent_info = f"[bold #FF9B9B]👤 Agent:[/] [#FFE5E5]{agent_name}[/]"
|
270
|
+
if agent_role:
|
271
|
+
agent_info += f"\n[bold #B4B4B3]Role:[/] [#FFE5E5]{agent_role}[/]"
|
272
|
+
if agent_tools:
|
273
|
+
tools_str = ", ".join(f"[italic #B4D4FF]{tool}[/]" for tool in agent_tools)
|
274
|
+
agent_info += f"\n[bold #86A789]Tools:[/] {tools_str}"
|
275
|
+
console.print(Panel(agent_info, border_style="#D2E3C8", title="[bold]Agent Info[/]", title_align="left", padding=(1, 2)))
|
276
|
+
|
277
|
+
# Only print if log level is DEBUG
|
278
|
+
if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
|
279
|
+
console.print(Panel.fit(Text(message, style="bold blue"), title="Instruction", border_style="cyan"))
|
256
280
|
|
257
281
|
async def adisplay_tool_call(message: str, console=None):
|
258
282
|
"""Async version of display_tool_call."""
|
@@ -130,22 +130,29 @@ Return a JSON object with an 'items' array containing the items to process.
|
|
130
130
|
|
131
131
|
# Determine next task based on result
|
132
132
|
next_task = None
|
133
|
-
if current_task.result:
|
133
|
+
if current_task and current_task.result:
|
134
134
|
if current_task.task_type in ["decision", "loop"]:
|
135
135
|
result = current_task.result.raw.lower()
|
136
136
|
# Check conditions
|
137
137
|
for condition, tasks in current_task.condition.items():
|
138
|
-
if condition.lower() in result
|
139
|
-
|
138
|
+
if condition.lower() in result:
|
139
|
+
# Handle both list and direct string values
|
140
|
+
task_value = tasks[0] if isinstance(tasks, list) else tasks
|
141
|
+
if not task_value or task_value == "exit": # If empty or explicit exit
|
142
|
+
logging.info("Workflow exit condition met, ending workflow")
|
143
|
+
current_task = None
|
144
|
+
break
|
145
|
+
next_task_name = task_value
|
140
146
|
next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
|
141
147
|
# For loops, allow revisiting the same task
|
142
148
|
if next_task and next_task.id == current_task.id:
|
143
149
|
visited_tasks.discard(current_task.id)
|
144
150
|
break
|
145
151
|
|
146
|
-
|
147
|
-
|
148
|
-
|
152
|
+
if not next_task and current_task and current_task.next_tasks:
|
153
|
+
print(current_task.next_tasks)
|
154
|
+
next_task_name = current_task.next_tasks[0]
|
155
|
+
next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
|
149
156
|
|
150
157
|
current_task = next_task
|
151
158
|
if not current_task:
|
@@ -391,22 +398,29 @@ Return a JSON object with an 'items' array containing the items to process.
|
|
391
398
|
|
392
399
|
# Determine next task based on result
|
393
400
|
next_task = None
|
394
|
-
if current_task.result:
|
401
|
+
if current_task and current_task.result:
|
395
402
|
if current_task.task_type in ["decision", "loop"]:
|
396
403
|
result = current_task.result.raw.lower()
|
397
404
|
# Check conditions
|
398
405
|
for condition, tasks in current_task.condition.items():
|
399
|
-
if condition.lower() in result
|
400
|
-
|
406
|
+
if condition.lower() in result:
|
407
|
+
# Handle both list and direct string values
|
408
|
+
task_value = tasks[0] if isinstance(tasks, list) else tasks
|
409
|
+
if not task_value or task_value == "exit": # If empty or explicit exit
|
410
|
+
logging.info("Workflow exit condition met, ending workflow")
|
411
|
+
current_task = None
|
412
|
+
break
|
413
|
+
next_task_name = task_value
|
401
414
|
next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
|
402
415
|
# For loops, allow revisiting the same task
|
403
416
|
if next_task and next_task.id == current_task.id:
|
404
417
|
visited_tasks.discard(current_task.id)
|
405
418
|
break
|
406
419
|
|
407
|
-
|
408
|
-
|
409
|
-
|
420
|
+
if not next_task and current_task and current_task.next_tasks:
|
421
|
+
print(current_task.next_tasks)
|
422
|
+
next_task_name = current_task.next_tasks[0]
|
423
|
+
next_task = next((t for t in self.tasks.values() if t.name == next_task_name), None)
|
410
424
|
|
411
425
|
current_task = next_task
|
412
426
|
if not current_task:
|
@@ -1,13 +1,13 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=Pm_HNlIsenf5zIstcVNk6nteJmOEnI4nB-zB-YL0Jgo,1160
|
2
|
-
praisonaiagents/main.py,sha256=
|
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=DDyA8JlHkKoKliWlBC3iNccR2q5rdYljbwogAi1vaUY,34581
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=_1d6Pqyk9EoBSo7E68sKyd1jDRlN1vxvVIRpoMc0Jcw,168
|
6
6
|
praisonaiagents/agents/agents.py,sha256=N55Ae3JkjNgGQ6pXBaBpI73sA80Y-pPUZLOd1NgtiWU,29523
|
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=zMoGYJSrIE-v9lKUkPpPbUspF9cPHeh8l5HM8tyttjU,25303
|
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.32.dist-info/METADATA,sha256=4tDDA-cB-DcwEM-UfhyImUXHmMpXI5rmkq4HEppM4NU,306
|
34
|
+
praisonaiagents-0.0.32.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
35
|
+
praisonaiagents-0.0.32.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
36
|
+
praisonaiagents-0.0.32.dist-info/RECORD,,
|
File without changes
|
File without changes
|