praisonAI 2.3.28__tar.gz → 2.3.30__tar.gz

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.
Files changed (76) hide show
  1. {praisonai-2.3.28 → praisonai-2.3.30}/PKG-INFO +2 -2
  2. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/PKG-INFO +2 -2
  3. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/requires.txt +1 -1
  4. praisonai-2.3.30/praisonai/cli/features/flow_display.py +514 -0
  5. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/main.py +15 -0
  6. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/deploy.py +1 -1
  7. praisonai-2.3.30/praisonai/version.py +1 -0
  8. {praisonai-2.3.28 → praisonai-2.3.30}/pyproject.toml +1 -1
  9. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_phase2_refactor.py +9 -1
  10. praisonai-2.3.28/praisonai/cli/features/flow_display.py +0 -189
  11. praisonai-2.3.28/praisonai/version.py +0 -1
  12. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/SOURCES.txt +0 -0
  13. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/dependency_links.txt +0 -0
  14. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/entry_points.txt +0 -0
  15. {praisonai-2.3.28 → praisonai-2.3.30}/PraisonAI.egg-info/top_level.txt +0 -0
  16. {praisonai-2.3.28 → praisonai-2.3.30}/README.md +0 -0
  17. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/__init__.py +0 -0
  18. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/__main__.py +0 -0
  19. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/agents_generator.py +0 -0
  20. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/api/call.py +0 -0
  21. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/auto.py +0 -0
  22. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/chainlit_ui.py +0 -0
  23. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/__init__.py +0 -0
  24. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/__init__.py +0 -0
  25. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/auto_memory.py +0 -0
  26. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/base.py +0 -0
  27. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/fast_context.py +0 -0
  28. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/guardrail.py +0 -0
  29. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/handoff.py +0 -0
  30. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/image.py +0 -0
  31. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/knowledge.py +0 -0
  32. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/mcp.py +0 -0
  33. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/metrics.py +0 -0
  34. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/router.py +0 -0
  35. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/session.py +0 -0
  36. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/telemetry.py +0 -0
  37. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/todo.py +0 -0
  38. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/tools.py +0 -0
  39. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/cli/features/workflow.py +0 -0
  40. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/inbuilt_tools/__init__.py +0 -0
  41. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/inbuilt_tools/autogen_tools.py +0 -0
  42. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/inc/__init__.py +0 -0
  43. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/inc/config.py +0 -0
  44. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/inc/models.py +0 -0
  45. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/scheduler.py +0 -0
  46. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/setup/__init__.py +0 -0
  47. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/setup/build.py +0 -0
  48. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/setup/post_install.py +0 -0
  49. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/setup/setup_conda_env.py +0 -0
  50. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/setup.py +0 -0
  51. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/test.py +0 -0
  52. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/train.py +0 -0
  53. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/train_vision.py +0 -0
  54. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/agents.py +0 -0
  55. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/callbacks.py +0 -0
  56. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/chat.py +0 -0
  57. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/code.py +0 -0
  58. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/colab.py +0 -0
  59. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/colab_chainlit.py +0 -0
  60. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/components/aicoder.py +0 -0
  61. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/context.py +0 -0
  62. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/database_config.py +0 -0
  63. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/db.py +0 -0
  64. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/realtime.py +0 -0
  65. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/realtimeclient/__init__.py +0 -0
  66. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/realtimeclient/tools.py +0 -0
  67. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/ui/sql_alchemy.py +0 -0
  68. {praisonai-2.3.28 → praisonai-2.3.30}/praisonai/upload_vision.py +0 -0
  69. {praisonai-2.3.28 → praisonai-2.3.30}/setup.cfg +0 -0
  70. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test.py +0 -0
  71. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_agents_playbook.py +0 -0
  72. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_basic.py +0 -0
  73. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_cli_features.py +0 -0
  74. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_custom_tools_fix.py +0 -0
  75. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_double_api_fix.py +0 -0
  76. {praisonai-2.3.28 → praisonai-2.3.30}/tests/test_runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PraisonAI
3
- Version: 2.3.28
3
+ Version: 2.3.30
4
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 human-agent collaboration.
5
5
  Author: Mervin Praison
6
6
  License: MIT
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
  Requires-Dist: rich>=13.7
12
12
  Requires-Dist: markdown>=3.5
13
13
  Requires-Dist: pyparsing>=3.0.0
14
- Requires-Dist: praisonaiagents>=0.1.7
14
+ Requires-Dist: praisonaiagents>=0.1.8
15
15
  Requires-Dist: python-dotenv>=0.19.0
16
16
  Requires-Dist: instructor>=1.3.3
17
17
  Requires-Dist: PyYAML>=6.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PraisonAI
3
- Version: 2.3.28
3
+ Version: 2.3.30
4
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 human-agent collaboration.
5
5
  Author: Mervin Praison
6
6
  License: MIT
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
  Requires-Dist: rich>=13.7
12
12
  Requires-Dist: markdown>=3.5
13
13
  Requires-Dist: pyparsing>=3.0.0
14
- Requires-Dist: praisonaiagents>=0.1.7
14
+ Requires-Dist: praisonaiagents>=0.1.8
15
15
  Requires-Dist: python-dotenv>=0.19.0
16
16
  Requires-Dist: instructor>=1.3.3
17
17
  Requires-Dist: PyYAML>=6.0
@@ -1,7 +1,7 @@
1
1
  rich>=13.7
2
2
  markdown>=3.5
3
3
  pyparsing>=3.0.0
4
- praisonaiagents>=0.1.7
4
+ praisonaiagents>=0.1.8
5
5
  python-dotenv>=0.19.0
6
6
  instructor>=1.3.3
7
7
  PyYAML>=6.0
@@ -0,0 +1,514 @@
1
+ """
2
+ Flow Display Handler for CLI.
3
+
4
+ Shows a visual flow diagram of the workflow WITHOUT executing it.
5
+ Usage: praisonai agents.yaml --flow-display
6
+ """
7
+
8
+ from typing import Any, Dict, Tuple
9
+ from .base import FlagHandler
10
+ import os
11
+ import yaml
12
+
13
+
14
+ class FlowDisplayHandler(FlagHandler):
15
+ """
16
+ Handler for --flow-display flag.
17
+
18
+ Shows a visual flow diagram/chart of agents and tasks WITHOUT executing.
19
+ This allows users to preview the workflow structure before running it.
20
+
21
+ Example:
22
+ praisonai agents.yaml --flow-display
23
+ """
24
+
25
+ def __init__(self, verbose: bool = False):
26
+ super().__init__(verbose)
27
+ self._console = None
28
+
29
+ @property
30
+ def feature_name(self) -> str:
31
+ return "flow_display"
32
+
33
+ @property
34
+ def flag_name(self) -> str:
35
+ return "flow-display"
36
+
37
+ @property
38
+ def flag_help(self) -> str:
39
+ return "Show workflow flow diagram without executing"
40
+
41
+ def _get_console(self):
42
+ """Get or create Rich Console."""
43
+ if self._console is None:
44
+ try:
45
+ from rich.console import Console
46
+ self._console = Console()
47
+ except ImportError:
48
+ pass
49
+ return self._console
50
+
51
+ def check_dependencies(self) -> Tuple[bool, str]:
52
+ """Check if Rich is available."""
53
+ try:
54
+ import importlib.util
55
+ rich_available = importlib.util.find_spec("rich") is not None
56
+ if not rich_available:
57
+ return False, "rich not installed. Install with: pip install rich"
58
+ return True, ""
59
+ except ImportError:
60
+ return False, "rich not installed. Install with: pip install rich"
61
+
62
+ def apply_to_agent_config(self, config: Dict[str, Any], flag_value: Any) -> Dict[str, Any]:
63
+ """Apply flow display configuration."""
64
+ if flag_value:
65
+ config['flow_display'] = True
66
+ return config
67
+
68
+ def display_flow_diagram(self, yaml_file: str, show_footer: bool = True) -> bool:
69
+ """
70
+ Display a visual flow diagram of the workflow from YAML file.
71
+
72
+ Args:
73
+ yaml_file: Path to the agents.yaml file
74
+ show_footer: Whether to show the "run without --flow-display" footer
75
+
76
+ Returns:
77
+ True if displayed successfully, False otherwise
78
+ """
79
+ console = self._get_console()
80
+ if not console:
81
+ print("Rich library not available for flow display")
82
+ return False
83
+
84
+ # Load YAML config
85
+ try:
86
+ if not os.path.exists(yaml_file):
87
+ console.print(f"[red]Error: File not found: {yaml_file}[/red]")
88
+ return False
89
+
90
+ with open(yaml_file, 'r') as f:
91
+ config = yaml.safe_load(f)
92
+ except Exception as e:
93
+ console.print(f"[red]Error loading YAML: {e}[/red]")
94
+ return False
95
+
96
+ # Detect YAML format: 'roles' (old) or 'agents'+'steps' (new workflow)
97
+ has_roles = 'roles' in config and config['roles']
98
+ has_agents = 'agents' in config and config['agents']
99
+ has_steps = 'steps' in config and config['steps']
100
+
101
+ if not has_roles and not has_agents:
102
+ console.print("[red]Error: Invalid YAML format. No 'roles' or 'agents' found.[/red]")
103
+ return False
104
+
105
+ try:
106
+ from rich.panel import Panel
107
+ from rich.table import Table
108
+ from rich.text import Text
109
+ from rich import box
110
+
111
+ # Determine format type
112
+ is_workflow_format = has_agents and has_steps
113
+
114
+ # Extract workflow info based on format
115
+ if is_workflow_format:
116
+ name = config.get('name', 'Workflow')
117
+ description = config.get('description', '')
118
+ framework = config.get('framework', 'praisonai')
119
+ workflow_config = config.get('workflow', {})
120
+ memory = workflow_config.get('memory_config', {}).get('persist', False)
121
+ num_agents = len(config['agents'])
122
+ num_steps = len(config['steps'])
123
+ else:
124
+ name = config.get('topic', 'Workflow')
125
+ description = ''
126
+ framework = config.get('framework', 'praisonai')
127
+ process = config.get('process', 'sequential')
128
+ memory = config.get('memory', False)
129
+ num_agents = len(config['roles'])
130
+ num_steps = sum(len(details.get('tasks', {})) for details in config['roles'].values())
131
+
132
+ # Build the flow diagram
133
+ console.print()
134
+
135
+ # === HEADER ===
136
+ header = Text()
137
+ header.append("📊 WORKFLOW FLOW DIAGRAM\n", style="bold cyan")
138
+ header.append("─" * 40, style="dim")
139
+
140
+ header_panel = Panel(
141
+ header,
142
+ border_style="cyan",
143
+ box=box.DOUBLE_EDGE,
144
+ padding=(0, 2)
145
+ )
146
+ console.print(header_panel)
147
+
148
+ # === WORKFLOW INFO ===
149
+ info_table = Table(show_header=False, box=None, padding=(0, 2))
150
+ info_table.add_column("Key", style="bold yellow")
151
+ info_table.add_column("Value", style="white")
152
+
153
+ info_table.add_row("📋 Name:", name)
154
+ if description:
155
+ desc_short = description[:60] + "..." if len(description) > 60 else description
156
+ info_table.add_row("📝 Description:", desc_short)
157
+ info_table.add_row("⚙️ Framework:", framework)
158
+
159
+ if is_workflow_format:
160
+ info_table.add_row("🔄 Format:", "WORKFLOW (steps-based)")
161
+ planning = workflow_config.get('planning', False)
162
+ info_table.add_row("🧠 Planning:", "✅ Enabled" if planning else "❌ Disabled")
163
+ else:
164
+ info_table.add_row("🔄 Process:", process.upper())
165
+
166
+ info_table.add_row("💾 Memory:", "✅ Enabled" if memory else "❌ Disabled")
167
+ info_table.add_row("👥 Agents:", str(num_agents))
168
+ info_table.add_row("📝 Steps:", str(num_steps))
169
+
170
+ console.print(Panel(info_table, title="[bold white]Workflow Configuration[/bold white]",
171
+ border_style="blue", box=box.ROUNDED))
172
+ console.print()
173
+
174
+ # === FLOW DIAGRAM ===
175
+ if is_workflow_format:
176
+ self._display_steps_flow(console, config)
177
+ else:
178
+ process = config.get('process', 'sequential')
179
+ if process == 'sequential':
180
+ self._display_sequential_flow(console, config)
181
+ elif process == 'hierarchical':
182
+ self._display_hierarchical_flow(console, config)
183
+ else:
184
+ self._display_sequential_flow(console, config)
185
+
186
+ # === DETAILED AGENT INFO ===
187
+ console.print()
188
+ if is_workflow_format:
189
+ self._display_workflow_agent_details(console, config)
190
+ else:
191
+ self._display_agent_details(console, config)
192
+
193
+ # === FOOTER ===
194
+ if show_footer:
195
+ console.print()
196
+ footer = Text()
197
+ footer.append("💡 ", style="bold")
198
+ footer.append("To execute this workflow, run without --flow-display flag", style="dim italic")
199
+ console.print(Panel(footer, border_style="dim", box=box.ROUNDED))
200
+ console.print()
201
+
202
+ return True
203
+
204
+ except ImportError as e:
205
+ console.print(f"[red]Error: Rich components not available: {e}[/red]")
206
+ return False
207
+
208
+ def _display_sequential_flow(self, console, config: Dict):
209
+ """Display sequential flow diagram."""
210
+ from rich.panel import Panel
211
+ from rich.text import Text
212
+ from rich import box
213
+
214
+ roles = list(config['roles'].items())
215
+
216
+ # Box width (content area)
217
+ BOX_WIDTH = 36
218
+
219
+ def pad_line(content: str, width: int = BOX_WIDTH) -> str:
220
+ """Pad content to fixed width."""
221
+ padding = width - len(content)
222
+ if padding > 0:
223
+ return content + " " * padding
224
+ return content[:width]
225
+
226
+ flow_text = Text()
227
+ flow_text.append(" SEQUENTIAL EXECUTION FLOW\n\n", style="bold magenta")
228
+
229
+ for i, (role_key, details) in enumerate(roles):
230
+ role_name = details.get('role', role_key)
231
+ tasks = list(details.get('tasks', {}).keys())
232
+
233
+ # Agent box
234
+ if i == 0:
235
+ flow_text.append(" ┌── START ──┐\n", style="green")
236
+ flow_text.append(" │\n", style="dim")
237
+ flow_text.append(" ▼\n", style="dim")
238
+
239
+ # Agent node
240
+ flow_text.append(" ╔════════════════════════════════════╗\n", style="cyan")
241
+ line = f" Agent {i+1}: {role_name}"
242
+ flow_text.append(f" ║{pad_line(line)}║\n", style="cyan")
243
+
244
+ # Tasks
245
+ for task in tasks:
246
+ line = f" -> {task}"
247
+ flow_text.append(f" ║{pad_line(line)}║\n", style="dim white")
248
+
249
+ flow_text.append(" ╚════════════════════════════════════╝\n", style="cyan")
250
+
251
+ # Arrow to next
252
+ if i < len(roles) - 1:
253
+ flow_text.append(" │\n", style="dim")
254
+ flow_text.append(" output\n", style="dim italic")
255
+ flow_text.append(" ▼\n", style="dim")
256
+ else:
257
+ flow_text.append(" │\n", style="dim")
258
+ flow_text.append(" ▼\n", style="dim")
259
+ flow_text.append(" └── END ────┘\n", style="red")
260
+
261
+ console.print(Panel(flow_text, border_style="magenta", box=box.DOUBLE_EDGE,
262
+ title="[bold white]Execution Flow[/bold white]"))
263
+
264
+ def _display_hierarchical_flow(self, console, config: Dict):
265
+ """Display hierarchical flow diagram."""
266
+ from rich.panel import Panel
267
+ from rich.text import Text
268
+ from rich import box
269
+
270
+ manager_llm = config.get('manager_llm', 'default')
271
+
272
+ flow_text = Text()
273
+ flow_text.append("👑 HIERARCHICAL EXECUTION FLOW\n\n", style="bold magenta")
274
+
275
+ # Manager at top
276
+ flow_text.append(" ┌──────────────────────┐\n", style="yellow")
277
+ flow_text.append(" │ 👑 MANAGER AGENT │\n", style="bold yellow")
278
+ flow_text.append(f" │ LLM: {manager_llm:<14}│\n", style="dim yellow")
279
+ flow_text.append(" └──────────┬───────────┘\n", style="yellow")
280
+ flow_text.append(" │\n", style="dim")
281
+ flow_text.append(" ┌──────────┴───────────┐\n", style="dim")
282
+ flow_text.append(" │ delegates to │\n", style="dim italic")
283
+ flow_text.append(" └──────────┬───────────┘\n", style="dim")
284
+
285
+ roles = list(config['roles'].items())
286
+ num_agents = len(roles)
287
+
288
+ # Draw branches
289
+ if num_agents > 0:
290
+ branch_line = " "
291
+ for i in range(num_agents):
292
+ if i == 0:
293
+ branch_line += "┌" + "─" * 8
294
+ elif i == num_agents - 1:
295
+ branch_line += "┬" + "─" * 8 + "┐"
296
+ else:
297
+ branch_line += "┬" + "─" * 8
298
+ flow_text.append(branch_line + "\n", style="dim")
299
+
300
+ # Agent boxes
301
+ for i, (role_key, details) in enumerate(roles):
302
+ flow_text.append("\n ╔═══════════════╗", style="cyan")
303
+ flow_text.append("\n")
304
+
305
+ for i, (role_key, details) in enumerate(roles):
306
+ role_name = details.get('role', role_key)[:12]
307
+ flow_text.append(f" ║ 🤖 {role_name:<10} ║", style="cyan")
308
+ flow_text.append("\n")
309
+
310
+ for i, (role_key, details) in enumerate(roles):
311
+ flow_text.append(" ╚═══════════════╝", style="cyan")
312
+ flow_text.append("\n")
313
+
314
+ console.print(Panel(flow_text, border_style="magenta", box=box.DOUBLE_EDGE,
315
+ title="[bold white]Execution Flow[/bold white]"))
316
+
317
+ def _display_agent_details(self, console, config: Dict):
318
+ """Display detailed agent information."""
319
+ from rich.table import Table
320
+ from rich import box
321
+
322
+ table = Table(
323
+ title="[bold cyan]📋 Agent & Task Details[/bold cyan]",
324
+ box=box.ROUNDED,
325
+ show_header=True,
326
+ header_style="bold magenta",
327
+ border_style="blue",
328
+ padding=(0, 1),
329
+ expand=True
330
+ )
331
+
332
+ table.add_column("#", style="dim", width=3, justify="center")
333
+ table.add_column("Agent", style="bold yellow", min_width=15)
334
+ table.add_column("Role", style="cyan", min_width=15)
335
+ table.add_column("Goal", style="white", min_width=25, overflow="fold")
336
+ table.add_column("Tasks", style="green", min_width=20)
337
+ table.add_column("Tools", style="magenta", min_width=15)
338
+
339
+ for i, (role_key, details) in enumerate(config['roles'].items(), 1):
340
+ role_name = details.get('role', role_key)
341
+ goal = details.get('goal', '-')
342
+ if len(goal) > 50:
343
+ goal = goal[:47] + "..."
344
+
345
+ tasks = list(details.get('tasks', {}).keys())
346
+ tasks_str = "\n".join(f"• {t}" for t in tasks) if tasks else "-"
347
+
348
+ tools = details.get('tools', [])
349
+ tools_str = ", ".join(t for t in tools if t) if tools else "-"
350
+
351
+ table.add_row(
352
+ str(i),
353
+ role_name,
354
+ role_key,
355
+ goal,
356
+ tasks_str,
357
+ tools_str
358
+ )
359
+
360
+ console.print(table)
361
+
362
+ def _display_steps_flow(self, console, config: Dict):
363
+ """Display steps-based workflow flow diagram."""
364
+ from rich.panel import Panel
365
+ from rich.text import Text
366
+ from rich import box
367
+
368
+ steps = config.get('steps', [])
369
+ agents = config.get('agents', {})
370
+
371
+ # Box width (content area)
372
+ BOX_WIDTH = 36
373
+
374
+ def pad_line(content: str, width: int = BOX_WIDTH) -> str:
375
+ """Pad content to fixed width, accounting for emoji width."""
376
+ # Emojis typically take 2 character widths
377
+ emoji_count = sum(1 for c in content if ord(c) > 0x1F300)
378
+ actual_len = len(content) + emoji_count # Add extra for emoji width
379
+ padding = width - actual_len
380
+ if padding > 0:
381
+ return content + " " * padding
382
+ return content[:width]
383
+
384
+ flow_text = Text()
385
+ flow_text.append(" STEPS-BASED EXECUTION FLOW\n\n", style="bold magenta")
386
+
387
+ flow_text.append(" ┌── START ──┐\n", style="green")
388
+ flow_text.append(" │\n", style="dim")
389
+ flow_text.append(" ▼\n", style="dim")
390
+
391
+ for i, step in enumerate(steps):
392
+ # Determine step type
393
+ agent_key = step.get('agent', '')
394
+ step_name = step.get('name', '')
395
+
396
+ # Check for special step types
397
+ has_route = 'route' in step
398
+ has_parallel = 'parallel' in step
399
+ has_loop = 'loop' in step
400
+ has_repeat = 'repeat' in step
401
+
402
+ if has_route:
403
+ # Route step
404
+ flow_text.append(" ╔════════════════════════════════════╗\n", style="yellow")
405
+ line = f" ROUTE: {step_name or 'routing'}"
406
+ flow_text.append(f" ║{pad_line(line)}║\n", style="yellow")
407
+
408
+ routes = step['route']
409
+ for route_name, route_agents in routes.items():
410
+ agents_str = ", ".join(route_agents) if isinstance(route_agents, list) else str(route_agents)
411
+ line = f" -> {route_name}: {agents_str}"
412
+ flow_text.append(f" ║{pad_line(line)}║\n", style="yellow")
413
+
414
+ flow_text.append(" ╚════════════════════════════════════╝\n", style="yellow")
415
+
416
+ elif has_parallel:
417
+ # Parallel step
418
+ flow_text.append(" ╔════════════════════════════════════╗\n", style="green")
419
+ line = f" PARALLEL: {step_name or 'parallel'}"
420
+ flow_text.append(f" ║{pad_line(line)}║\n", style="green")
421
+
422
+ for p_step in step['parallel']:
423
+ p_agent = p_step.get('agent', '?')
424
+ line = f" |-- {p_agent}"
425
+ flow_text.append(f" ║{pad_line(line)}║\n", style="green")
426
+
427
+ flow_text.append(" ╚════════════════════════════════════╝\n", style="green")
428
+
429
+ else:
430
+ # Regular agent step
431
+ agent_info = agents.get(agent_key, {})
432
+ agent_name = agent_info.get('name', agent_key)
433
+
434
+ flow_text.append(" ╔════════════════════════════════════╗\n", style="cyan")
435
+ line = f" Step {i+1}: {agent_name}"
436
+ flow_text.append(f" ║{pad_line(line)}║\n", style="cyan")
437
+
438
+ # Show modifiers
439
+ if has_loop:
440
+ loop_over = step['loop'].get('over', '?')
441
+ line = f" [loop over: {loop_over}]"
442
+ flow_text.append(f" ║{pad_line(line)}║\n", style="dim magenta")
443
+
444
+ if has_repeat:
445
+ until = step['repeat'].get('until', '?')
446
+ max_iter = step['repeat'].get('max_iterations', '?')
447
+ line = f" [repeat until: {until} max:{max_iter}]"
448
+ flow_text.append(f" ║{pad_line(line)}║\n", style="dim magenta")
449
+
450
+ flow_text.append(" ╚════════════════════════════════════╝\n", style="cyan")
451
+
452
+ # Arrow to next
453
+ if i < len(steps) - 1:
454
+ flow_text.append(" │\n", style="dim")
455
+ flow_text.append(" ▼\n", style="dim")
456
+
457
+ flow_text.append(" │\n", style="dim")
458
+ flow_text.append(" ▼\n", style="dim")
459
+ flow_text.append(" └── END ────┘\n", style="red")
460
+
461
+ console.print(Panel(flow_text, border_style="magenta", box=box.DOUBLE_EDGE,
462
+ title="[bold white]Execution Flow[/bold white]"))
463
+
464
+ def _display_workflow_agent_details(self, console, config: Dict):
465
+ """Display detailed agent information for workflow format."""
466
+ from rich.table import Table
467
+ from rich import box
468
+
469
+ table = Table(
470
+ title="[bold cyan]📋 Agent Details[/bold cyan]",
471
+ box=box.ROUNDED,
472
+ show_header=True,
473
+ header_style="bold magenta",
474
+ border_style="blue",
475
+ padding=(0, 1),
476
+ expand=True
477
+ )
478
+
479
+ table.add_column("#", style="dim", width=3, justify="center")
480
+ table.add_column("Agent Key", style="bold yellow", min_width=15)
481
+ table.add_column("Name", style="cyan", min_width=15)
482
+ table.add_column("Role", style="white", min_width=20)
483
+ table.add_column("Goal", style="green", min_width=25, overflow="fold")
484
+
485
+ for i, (agent_key, details) in enumerate(config['agents'].items(), 1):
486
+ name = details.get('name', agent_key)
487
+ role = details.get('role', '-')
488
+ goal = details.get('goal', '-')
489
+ if len(goal) > 40:
490
+ goal = goal[:37] + "..."
491
+
492
+ table.add_row(
493
+ str(i),
494
+ agent_key,
495
+ name,
496
+ role,
497
+ goal
498
+ )
499
+
500
+ console.print(table)
501
+
502
+ def execute(self, yaml_file: str = None, **kwargs) -> bool:
503
+ """
504
+ Execute flow display - shows diagram without running workflow.
505
+
506
+ Args:
507
+ yaml_file: Path to the YAML file
508
+
509
+ Returns:
510
+ True if displayed successfully
511
+ """
512
+ if yaml_file:
513
+ return self.display_flow_diagram(yaml_file)
514
+ return False
@@ -495,6 +495,21 @@ class PraisonAI:
495
495
  print(result)
496
496
  return result
497
497
  else:
498
+ # Flow Display - Show flow diagram WITHOUT executing (--flow-display flag)
499
+ if getattr(args, 'flow_display', False):
500
+ from .features.flow_display import FlowDisplayHandler
501
+ flow_handler = FlowDisplayHandler(verbose=getattr(args, 'verbose', False))
502
+ flow_handler.display_flow_diagram(self.agent_file)
503
+ return # Exit without executing
504
+
505
+ # Always show flow diagram before execution (default behavior)
506
+ try:
507
+ from .features.flow_display import FlowDisplayHandler
508
+ flow_handler = FlowDisplayHandler(verbose=getattr(args, 'verbose', False))
509
+ flow_handler.display_flow_diagram(self.agent_file, show_footer=False)
510
+ except Exception:
511
+ pass # Continue even if flow display fails
512
+
498
513
  agents_generator = AgentsGenerator(
499
514
  self.agent_file,
500
515
  self.framework,
@@ -57,7 +57,7 @@ class CloudDeployer:
57
57
  file.write("FROM python:3.11-slim\n")
58
58
  file.write("WORKDIR /app\n")
59
59
  file.write("COPY . .\n")
60
- file.write("RUN pip install flask praisonai==2.3.28 gunicorn markdown\n")
60
+ file.write("RUN pip install flask praisonai==2.3.30 gunicorn markdown\n")
61
61
  file.write("EXPOSE 8080\n")
62
62
  file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
63
63
 
@@ -0,0 +1 @@
1
+ __version__ = "2.3.30"
@@ -12,7 +12,7 @@ dependencies = [
12
12
  "rich>=13.7",
13
13
  "markdown>=3.5",
14
14
  "pyparsing>=3.0.0",
15
- "praisonaiagents>=0.1.7",
15
+ "praisonaiagents>=0.1.8",
16
16
  "python-dotenv>=0.19.0",
17
17
  "instructor>=1.3.3",
18
18
  "PyYAML>=6.0",
@@ -1,15 +1,21 @@
1
1
  #!/usr/bin/env python3
2
- """Test script to verify Phase 2 refactoring maintains backward compatibility"""
2
+ """Test script to verify Phase 2 refactoring maintains backward compatibility
3
+
4
+ NOTE: These tests make real API calls and require valid API keys.
5
+ They are marked with @pytest.mark.real to be excluded from CI.
6
+ """
3
7
 
4
8
  import asyncio
5
9
  import sys
6
10
  import os
11
+ import pytest
7
12
 
8
13
  # Add the correct path for imports
9
14
  sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src/praisonai-agents'))
10
15
 
11
16
  from praisonaiagents.llm import LLM
12
17
 
18
+ @pytest.mark.real
13
19
  def test_sync_methods():
14
20
  """Test synchronous methods still work correctly"""
15
21
  print("Testing synchronous methods...")
@@ -52,6 +58,7 @@ def test_sync_methods():
52
58
 
53
59
  print("✅ Synchronous methods working correctly\n")
54
60
 
61
+ @pytest.mark.real
55
62
  async def test_async_methods():
56
63
  """Test asynchronous methods still work correctly"""
57
64
  print("Testing asynchronous methods...")
@@ -94,6 +101,7 @@ async def test_async_methods():
94
101
 
95
102
  print("✅ Asynchronous methods working correctly\n")
96
103
 
104
+ @pytest.mark.real
97
105
  def test_edge_cases():
98
106
  """Test edge cases and special scenarios"""
99
107
  print("Testing edge cases...")
@@ -1,189 +0,0 @@
1
- """
2
- Flow Display Handler for CLI.
3
-
4
- Provides visual workflow tracking.
5
- Usage: praisonai agents.yaml --flow-display
6
- """
7
-
8
- from typing import Any, Dict, Tuple, List
9
- from .base import FlagHandler
10
-
11
-
12
- class FlowDisplayHandler(FlagHandler):
13
- """
14
- Handler for --flow-display flag.
15
-
16
- Enables visual workflow tracking for multi-agent executions.
17
-
18
- Example:
19
- praisonai agents.yaml --flow-display
20
- praisonai "Complex task" --flow-display
21
- """
22
-
23
- @property
24
- def feature_name(self) -> str:
25
- return "flow_display"
26
-
27
- @property
28
- def flag_name(self) -> str:
29
- return "flow-display"
30
-
31
- @property
32
- def flag_help(self) -> str:
33
- return "Enable visual workflow tracking"
34
-
35
- def check_dependencies(self) -> Tuple[bool, str]:
36
- """Check if FlowDisplay is available."""
37
- try:
38
- import importlib.util
39
- if importlib.util.find_spec("praisonaiagents") is not None:
40
- return True, ""
41
- return False, "praisonaiagents not installed"
42
- except ImportError:
43
- return False, "praisonaiagents not installed. Install with: pip install praisonaiagents"
44
-
45
- def _get_flow_display(self):
46
- """Get FlowDisplay class lazily."""
47
- try:
48
- from praisonaiagents import FlowDisplay
49
- return FlowDisplay
50
- except ImportError:
51
- return None
52
-
53
- def create_flow_display(self, title: str = "Workflow") -> Any:
54
- """
55
- Create a FlowDisplay instance.
56
-
57
- Args:
58
- title: Title for the workflow display
59
-
60
- Returns:
61
- FlowDisplay instance or None
62
- """
63
- FlowDisplay = self._get_flow_display()
64
- if not FlowDisplay:
65
- self.print_status(
66
- "FlowDisplay requires praisonaiagents. Install with: pip install praisonaiagents",
67
- "error"
68
- )
69
- return None
70
-
71
- try:
72
- return FlowDisplay(title=title)
73
- except Exception as e:
74
- self.log(f"Failed to create FlowDisplay: {e}", "error")
75
- return None
76
-
77
- def apply_to_agent_config(self, config: Dict[str, Any], flag_value: Any) -> Dict[str, Any]:
78
- """
79
- Apply flow display configuration.
80
-
81
- Args:
82
- config: Agent configuration dictionary
83
- flag_value: Boolean indicating flow display
84
-
85
- Returns:
86
- Modified configuration
87
- """
88
- if flag_value:
89
- config['flow_display'] = True
90
- return config
91
-
92
- def display_workflow_start(self, workflow_name: str, agents: List[str] = None):
93
- """
94
- Display workflow start.
95
-
96
- Args:
97
- workflow_name: Name of the workflow
98
- agents: List of agent names
99
- """
100
- self.print_status(f"\n🚀 Starting Workflow: {workflow_name}", "info")
101
- self.print_status("=" * 50, "info")
102
-
103
- if agents:
104
- self.print_status("Agents:", "info")
105
- for i, agent in enumerate(agents, 1):
106
- self.print_status(f" {i}. {agent}", "info")
107
-
108
- self.print_status("=" * 50, "info")
109
-
110
- def display_step(self, step_num: int, step_name: str, status: str = "running"):
111
- """
112
- Display a workflow step.
113
-
114
- Args:
115
- step_num: Step number
116
- step_name: Name of the step
117
- status: Step status (running, completed, failed)
118
- """
119
- icons = {
120
- 'running': '⏳',
121
- 'completed': '✅',
122
- 'failed': '❌',
123
- 'pending': '⬜'
124
- }
125
- icon = icons.get(status, '•')
126
- self.print_status(f" {icon} Step {step_num}: {step_name}", "info")
127
-
128
- def display_workflow_end(self, success: bool = True, duration: float = None):
129
- """
130
- Display workflow end.
131
-
132
- Args:
133
- success: Whether workflow completed successfully
134
- duration: Workflow duration in seconds
135
- """
136
- self.print_status("=" * 50, "info")
137
-
138
- if success:
139
- msg = "✅ Workflow completed successfully"
140
- else:
141
- msg = "❌ Workflow failed"
142
-
143
- if duration:
144
- msg += f" ({duration:.2f}s)"
145
-
146
- self.print_status(msg, "success" if success else "error")
147
-
148
- def track_execution(self, func):
149
- """
150
- Decorator to track function execution in flow display.
151
-
152
- Args:
153
- func: Function to track
154
-
155
- Returns:
156
- Wrapped function
157
- """
158
- import functools
159
-
160
- @functools.wraps(func)
161
- def wrapper(*args, **kwargs):
162
- func_name = func.__name__
163
-
164
- self.display_step(1, func_name, "running")
165
-
166
- try:
167
- result = func(*args, **kwargs)
168
- self.display_step(1, func_name, "completed")
169
- return result
170
- except Exception:
171
- self.display_step(1, func_name, "failed")
172
- raise
173
-
174
- return wrapper
175
-
176
- def execute(self, workflow_name: str = None, **kwargs) -> Any:
177
- """
178
- Execute flow display setup.
179
-
180
- Args:
181
- workflow_name: Name of the workflow
182
-
183
- Returns:
184
- FlowDisplay instance or None
185
- """
186
- if workflow_name:
187
- self.display_workflow_start(workflow_name)
188
-
189
- return self.create_flow_display(workflow_name or "Workflow")
@@ -1 +0,0 @@
1
- __version__ = "2.3.28"
File without changes
File without changes
File without changes
File without changes
File without changes