waldiez 0.5.9__py3-none-any.whl → 0.6.0__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.

Potentially problematic release.


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

Files changed (109) hide show
  1. waldiez/_version.py +1 -1
  2. waldiez/cli.py +113 -24
  3. waldiez/exporting/agent/exporter.py +9 -6
  4. waldiez/exporting/agent/extras/captain_agent_extras.py +44 -7
  5. waldiez/exporting/agent/extras/group_manager_agent_extas.py +6 -1
  6. waldiez/exporting/agent/extras/handoffs/after_work.py +1 -0
  7. waldiez/exporting/agent/extras/handoffs/available.py +1 -0
  8. waldiez/exporting/agent/extras/handoffs/condition.py +3 -1
  9. waldiez/exporting/agent/extras/handoffs/handoff.py +1 -0
  10. waldiez/exporting/agent/extras/handoffs/target.py +1 -0
  11. waldiez/exporting/agent/termination.py +1 -0
  12. waldiez/exporting/chats/utils/common.py +25 -23
  13. waldiez/exporting/core/__init__.py +0 -2
  14. waldiez/exporting/core/constants.py +3 -1
  15. waldiez/exporting/core/context.py +13 -13
  16. waldiez/exporting/core/extras/serializer.py +12 -10
  17. waldiez/exporting/core/protocols.py +0 -141
  18. waldiez/exporting/core/result.py +5 -5
  19. waldiez/exporting/core/types.py +1 -0
  20. waldiez/exporting/core/utils/llm_config.py +2 -2
  21. waldiez/exporting/flow/execution_generator.py +1 -0
  22. waldiez/exporting/flow/merger.py +2 -2
  23. waldiez/exporting/flow/orchestrator.py +1 -0
  24. waldiez/exporting/flow/utils/common.py +3 -3
  25. waldiez/exporting/flow/utils/importing.py +1 -0
  26. waldiez/exporting/flow/utils/logging.py +7 -80
  27. waldiez/exporting/tools/exporter.py +5 -0
  28. waldiez/exporting/tools/factory.py +4 -0
  29. waldiez/exporting/tools/processor.py +5 -1
  30. waldiez/io/__init__.py +3 -1
  31. waldiez/io/_ws.py +15 -5
  32. waldiez/io/models/content/image.py +1 -0
  33. waldiez/io/models/user_input.py +4 -4
  34. waldiez/io/models/user_response.py +1 -0
  35. waldiez/io/mqtt.py +1 -1
  36. waldiez/io/structured.py +98 -45
  37. waldiez/io/utils.py +17 -11
  38. waldiez/io/ws.py +10 -12
  39. waldiez/logger.py +180 -63
  40. waldiez/models/agents/agent/agent.py +2 -1
  41. waldiez/models/agents/agent/update_system_message.py +0 -2
  42. waldiez/models/agents/doc_agent/doc_agent.py +8 -1
  43. waldiez/models/chat/chat.py +1 -0
  44. waldiez/models/chat/chat_data.py +0 -2
  45. waldiez/models/common/base.py +2 -0
  46. waldiez/models/common/dict_utils.py +169 -40
  47. waldiez/models/common/handoff.py +2 -0
  48. waldiez/models/common/method_utils.py +2 -0
  49. waldiez/models/flow/flow.py +6 -6
  50. waldiez/models/flow/info.py +5 -1
  51. waldiez/models/model/_llm.py +31 -14
  52. waldiez/models/model/model.py +4 -1
  53. waldiez/models/model/model_data.py +18 -5
  54. waldiez/models/tool/predefined/_config.py +5 -1
  55. waldiez/models/tool/predefined/_duckduckgo.py +4 -0
  56. waldiez/models/tool/predefined/_email.py +477 -0
  57. waldiez/models/tool/predefined/_google.py +4 -1
  58. waldiez/models/tool/predefined/_perplexity.py +4 -1
  59. waldiez/models/tool/predefined/_searxng.py +4 -1
  60. waldiez/models/tool/predefined/_tavily.py +4 -1
  61. waldiez/models/tool/predefined/_wikipedia.py +5 -2
  62. waldiez/models/tool/predefined/_youtube.py +4 -1
  63. waldiez/models/tool/predefined/protocol.py +3 -0
  64. waldiez/models/tool/tool.py +22 -4
  65. waldiez/models/waldiez.py +12 -0
  66. waldiez/runner.py +37 -54
  67. waldiez/running/__init__.py +6 -0
  68. waldiez/running/base_runner.py +381 -363
  69. waldiez/running/environment.py +1 -0
  70. waldiez/running/exceptions.py +9 -0
  71. waldiez/running/post_run.py +10 -4
  72. waldiez/running/pre_run.py +199 -66
  73. waldiez/running/protocol.py +21 -101
  74. waldiez/running/run_results.py +1 -1
  75. waldiez/running/standard_runner.py +83 -276
  76. waldiez/running/step_by_step/__init__.py +46 -0
  77. waldiez/running/step_by_step/breakpoints_mixin.py +512 -0
  78. waldiez/running/step_by_step/command_handler.py +151 -0
  79. waldiez/running/step_by_step/events_processor.py +199 -0
  80. waldiez/running/step_by_step/step_by_step_models.py +541 -0
  81. waldiez/running/step_by_step/step_by_step_runner.py +750 -0
  82. waldiez/running/subprocess_runner/__base__.py +279 -0
  83. waldiez/running/subprocess_runner/__init__.py +16 -0
  84. waldiez/running/subprocess_runner/_async_runner.py +362 -0
  85. waldiez/running/subprocess_runner/_sync_runner.py +456 -0
  86. waldiez/running/subprocess_runner/runner.py +570 -0
  87. waldiez/running/timeline_processor.py +1 -1
  88. waldiez/running/utils.py +492 -3
  89. waldiez/utils/version.py +2 -6
  90. waldiez/ws/__init__.py +71 -0
  91. waldiez/ws/__main__.py +15 -0
  92. waldiez/ws/_file_handler.py +199 -0
  93. waldiez/ws/_mock.py +74 -0
  94. waldiez/ws/cli.py +235 -0
  95. waldiez/ws/client_manager.py +851 -0
  96. waldiez/ws/errors.py +416 -0
  97. waldiez/ws/models.py +988 -0
  98. waldiez/ws/reloader.py +363 -0
  99. waldiez/ws/server.py +508 -0
  100. waldiez/ws/session_manager.py +393 -0
  101. waldiez/ws/session_stats.py +83 -0
  102. waldiez/ws/utils.py +410 -0
  103. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/METADATA +105 -96
  104. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/RECORD +108 -83
  105. waldiez/running/patch_io_stream.py +0 -210
  106. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/WHEEL +0 -0
  107. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/entry_points.txt +0 -0
  108. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/licenses/LICENSE +0 -0
  109. {waldiez-0.5.9.dist-info → waldiez-0.6.0.dist-info}/licenses/NOTICE.md +0 -0
@@ -0,0 +1,541 @@
1
+ # SPDX-License-Identifier: Apache-2.0.
2
+ # Copyright (c) 2024 - 2025 Waldiez and contributors.
3
+ # pylint: disable=unused-argument,disable=line-too-long
4
+ # flake8: noqa: E501
5
+ """Step-by-step execution models for Waldiez."""
6
+
7
+ import re
8
+ from enum import Enum
9
+ from typing import Annotated, Any, Literal, Union
10
+
11
+ from pydantic import BaseModel, Field, ValidationInfo, field_validator
12
+
13
+
14
+ class WaldiezBreakpointType(Enum):
15
+ """Types of breakpoints available."""
16
+
17
+ EVENT = "event" # Break on specific event type
18
+ AGENT = "agent" # Break on any event from specific agent
19
+ AGENT_EVENT = "agent_event" # Break on specific event from specific agent
20
+ ALL = "all" # Break on all events (default step mode)
21
+
22
+
23
+ class WaldiezDebugStepAction(Enum):
24
+ """Available actions during step-by-step execution."""
25
+
26
+ CONTINUE = "c" # Continue to next event
27
+ STEP = "s" # Step through (same as continue, but explicit)
28
+ RUN = "r" # Run without stopping (disable step mode)
29
+ QUIT = "q" # Quit execution
30
+ INFO = "i" # Show detailed event information
31
+ HELP = "h" # Show help
32
+ STATS = "st" # Show execution statistics
33
+ ADD_BREAKPOINT = "ab" # Add a breakpoint
34
+ REMOVE_BREAKPOINT = "rb" # Remove a breakpoint
35
+ LIST_BREAKPOINTS = "lb" # List all breakpoints
36
+ CLEAR_BREAKPOINTS = "cb" # Clear all breakpoints
37
+ UNKNOWN = "unknown" # Unknown command
38
+
39
+
40
+ VALID_CONTROL_COMMANDS = {
41
+ "", # continue/step (allow empty input)
42
+ "c", # continue
43
+ "r", # run
44
+ "s", # step
45
+ "h", # help
46
+ "q", # quit
47
+ "i", # info
48
+ "st", # stats
49
+ "ab", # add_breakpoint
50
+ "rb", # remove_breakpoint
51
+ "lb", # list_breakpoints
52
+ "cb", # clear_breakpoints
53
+ }
54
+
55
+
56
+ class WaldiezBreakpoint(BaseModel):
57
+ """Breakpoint definition with enhanced validation."""
58
+
59
+ type: WaldiezBreakpointType
60
+ event_type: str | None = None # Required for EVENT and AGENT_EVENT
61
+ agent_name: str | None = None # Required for AGENT and AGENT_EVENT
62
+ description: str | None = None # Human-readable description
63
+
64
+ # noinspection PyNestedDecorators,PyUnusedLocal
65
+ @field_validator("event_type")
66
+ @classmethod
67
+ def validate_event_type(
68
+ cls,
69
+ v: str | None,
70
+ info: ValidationInfo,
71
+ ) -> str | None:
72
+ """Validate event type format.
73
+
74
+ Parameters
75
+ ----------
76
+ v : str | None
77
+ The event type to validate.
78
+ info : ValidationInfo
79
+ Validation context information.
80
+
81
+ Returns
82
+ -------
83
+ str | None
84
+ The validated event type or None if not provided.
85
+
86
+ Raises
87
+ ------
88
+ ValueError
89
+ If the event type format is invalid.
90
+ """
91
+ if v is None:
92
+ return v
93
+
94
+ # Basic validation - event types should be alphanumeric with underscores
95
+ if not re.match(r"^[a-zA-Z][a-zA-Z0-9_]*$", v):
96
+ raise ValueError(
97
+ "Invalid breakpoint format. Event type must start with a letter and contain only "
98
+ "letters, numbers, and underscores"
99
+ )
100
+ return v
101
+
102
+ # noinspection PyNestedDecorators,PyUnusedLocal
103
+ @field_validator("agent_name")
104
+ @classmethod
105
+ def validate_agent_name(
106
+ cls,
107
+ v: str | None,
108
+ info: ValidationInfo,
109
+ ) -> str | None:
110
+ """Validate agent name format.
111
+
112
+ Parameters
113
+ ----------
114
+ v : str | None
115
+ The agent name to validate.
116
+ info : ValidationInfo
117
+ Validation context information.
118
+
119
+ Returns
120
+ -------
121
+ str | None
122
+ The validated agent name or None if not provided.
123
+
124
+ Raises
125
+ ------
126
+ ValueError
127
+ If the agent name format is invalid.
128
+ """
129
+ if v is None:
130
+ return v
131
+
132
+ # Agent names should not be empty or just whitespace
133
+ if not v.strip():
134
+ raise ValueError("Agent name cannot be empty or just whitespace")
135
+
136
+ return v.strip()
137
+
138
+ def model_post_init(self, __context: Any, /) -> None:
139
+ """Validate breakpoint consistency after initialization.
140
+
141
+ Raises
142
+ ------
143
+ ValueError
144
+ If the breakpoint configuration is invalid.
145
+ """
146
+ if self.type == WaldiezBreakpointType.EVENT and not self.event_type:
147
+ raise ValueError("EVENT breakpoints require an event_type")
148
+
149
+ if self.type == WaldiezBreakpointType.AGENT and not self.agent_name:
150
+ raise ValueError("AGENT breakpoints require an agent_name")
151
+
152
+ if self.type == WaldiezBreakpointType.AGENT_EVENT:
153
+ if not self.event_type or not self.agent_name:
154
+ raise ValueError(
155
+ "AGENT_EVENT breakpoints require both"
156
+ " event_type and agent_name"
157
+ )
158
+
159
+ def __hash__(self) -> int:
160
+ """Get the hash value for the breakpoint."""
161
+ return hash((self.type, self.event_type, self.agent_name))
162
+
163
+ def __str__(self) -> str:
164
+ """Get the string representation for display."""
165
+ if self.type == WaldiezBreakpointType.EVENT:
166
+ return f"event:{self.event_type}"
167
+ if self.type == WaldiezBreakpointType.AGENT:
168
+ return f"agent:{self.agent_name}"
169
+ if self.type == WaldiezBreakpointType.AGENT_EVENT:
170
+ return f"{self.agent_name}:{self.event_type}"
171
+ # else: # ALL
172
+ return "all"
173
+
174
+ # pylint: disable=too-complex
175
+ @classmethod
176
+ def from_string( # noqa: C901
177
+ cls,
178
+ breakpoint_str: str,
179
+ ) -> "WaldiezBreakpoint":
180
+ """Parse breakpoint from string format with enhanced validation.
181
+
182
+ Parameters
183
+ ----------
184
+ breakpoint_str : str
185
+ The string representation of the breakpoint.
186
+
187
+ Returns
188
+ -------
189
+ WaldiezBreakpoint
190
+ The parsed breakpoint object.
191
+
192
+ Raises
193
+ ------
194
+ ValueError
195
+ If the breakpoint string format is invalid.
196
+ """
197
+ if not breakpoint_str or not isinstance( # pyright: ignore
198
+ breakpoint_str,
199
+ str,
200
+ ):
201
+ raise ValueError("Breakpoint specification cannot be empty")
202
+
203
+ breakpoint_str = breakpoint_str.strip()
204
+ if not breakpoint_str:
205
+ raise ValueError(
206
+ "Breakpoint specification cannot be just whitespace"
207
+ )
208
+
209
+ if breakpoint_str == "all":
210
+ return cls(type=WaldiezBreakpointType.ALL)
211
+
212
+ if breakpoint_str.startswith("event:"):
213
+ event_type = breakpoint_str[6:] # Remove "event:" prefix
214
+ if not event_type:
215
+ raise ValueError("Event type cannot be empty after 'event:'")
216
+ return cls(type=WaldiezBreakpointType.EVENT, event_type=event_type)
217
+
218
+ if breakpoint_str.startswith("agent:"):
219
+ agent_name = breakpoint_str[6:] # Remove "agent:" prefix
220
+ if not agent_name:
221
+ raise ValueError("Agent name cannot be empty after 'agent:'")
222
+ return cls(type=WaldiezBreakpointType.AGENT, agent_name=agent_name)
223
+
224
+ if ":" in breakpoint_str and not breakpoint_str.startswith(
225
+ ("event:", "agent:")
226
+ ):
227
+ # Format: "agent_name:event_type"
228
+ parts = breakpoint_str.split(":", 1)
229
+ if len(parts) != 2:
230
+ raise ValueError("Invalid agent:event format")
231
+
232
+ agent_name, event_type = parts
233
+ if not agent_name or not event_type:
234
+ raise ValueError(
235
+ "Both agent name and event type must be specified"
236
+ )
237
+
238
+ return cls(
239
+ type=WaldiezBreakpointType.AGENT_EVENT,
240
+ agent_name=agent_name,
241
+ event_type=event_type,
242
+ )
243
+
244
+ # Default to event type - but validate it's reasonable
245
+ if ":" in breakpoint_str:
246
+ raise ValueError(
247
+ "Invalid breakpoint format. Use 'event:type', 'agent:name', "
248
+ "'agent:event', or 'all'"
249
+ )
250
+
251
+ return cls(type=WaldiezBreakpointType.EVENT, event_type=breakpoint_str)
252
+
253
+ def matches(self, event: dict[str, Any]) -> bool:
254
+ """Check if this breakpoint matches the given event.
255
+
256
+ Parameters
257
+ ----------
258
+ event : dict[str, Any]
259
+ The event to check against.
260
+
261
+ Returns
262
+ -------
263
+ bool
264
+ True if the event matches the breakpoint, False otherwise.
265
+ """
266
+ if self.type == WaldiezBreakpointType.ALL:
267
+ return True
268
+
269
+ if self.type == WaldiezBreakpointType.EVENT:
270
+ return event.get("type") == self.event_type
271
+
272
+ if self.type == WaldiezBreakpointType.AGENT:
273
+ return (
274
+ event.get("sender") == self.agent_name
275
+ or event.get("recipient") == self.agent_name
276
+ )
277
+
278
+ if self.type == WaldiezBreakpointType.AGENT_EVENT:
279
+ return event.get("type") == self.event_type and (
280
+ event.get("sender") == self.agent_name
281
+ or event.get("recipient") == self.agent_name
282
+ )
283
+
284
+ # noinspection PyUnreachableCode
285
+ return False
286
+
287
+
288
+ # Enhanced configuration class for runtime settings
289
+ class WaldiezDebugConfig(BaseModel):
290
+ """Configuration for debug session settings."""
291
+
292
+ max_event_history: int = Field(default=1000, ge=1, le=10000)
293
+ auto_continue: bool = Field(default=False)
294
+ step_mode: bool = Field(default=True)
295
+ enable_stats_collection: bool = Field(default=True)
296
+ command_timeout_seconds: float = Field(default=300.0, gt=0)
297
+
298
+
299
+ # Rest of the existing message classes remain the same...
300
+ class WaldiezDebugBreakpointsList(BaseModel):
301
+ """Debug breakpoints message."""
302
+
303
+ type: Literal["debug_breakpoints_list"] = "debug_breakpoints_list"
304
+ breakpoints: (
305
+ list[str | WaldiezBreakpoint] | list[str] | list[WaldiezBreakpoint]
306
+ )
307
+
308
+ @property
309
+ def breakpoint_objects(self) -> list[WaldiezBreakpoint]:
310
+ """Get all breakpoints as WaldiezBreakpoint objects."""
311
+ result: list[WaldiezBreakpoint] = []
312
+ for bp in self.breakpoints:
313
+ if isinstance(bp, str):
314
+ try:
315
+ result.append(WaldiezBreakpoint.from_string(bp))
316
+ except ValueError:
317
+ # Skip invalid breakpoints rather than failing
318
+ continue
319
+ else:
320
+ result.append(bp)
321
+ return result
322
+
323
+
324
+ class WaldiezDebugBreakpointAdded(BaseModel):
325
+ """Debug breakpoint added message."""
326
+
327
+ type: Literal["debug_breakpoint_added"] = "debug_breakpoint_added"
328
+ breakpoint: Union[str, WaldiezBreakpoint]
329
+
330
+ @property
331
+ def breakpoint_object(self) -> WaldiezBreakpoint:
332
+ """Get breakpoint as WaldiezBreakpoint object."""
333
+ if isinstance(self.breakpoint, str):
334
+ return WaldiezBreakpoint.from_string(self.breakpoint)
335
+ return self.breakpoint
336
+
337
+
338
+ class WaldiezDebugBreakpointRemoved(BaseModel):
339
+ """Debug breakpoint removed message."""
340
+
341
+ type: Literal["debug_breakpoint_removed"] = "debug_breakpoint_removed"
342
+ breakpoint: Union[str, WaldiezBreakpoint]
343
+
344
+ @property
345
+ def breakpoint_object(self) -> WaldiezBreakpoint:
346
+ """Get breakpoint as WaldiezBreakpoint object."""
347
+ if isinstance(self.breakpoint, str):
348
+ return WaldiezBreakpoint.from_string(self.breakpoint)
349
+ return self.breakpoint
350
+
351
+
352
+ class WaldiezDebugHelpCommand(BaseModel):
353
+ """Help command information."""
354
+
355
+ cmds: list[str] = Field(
356
+ default_factory=list, description="List of command aliases"
357
+ )
358
+ desc: str
359
+
360
+
361
+ class WaldiezDebugHelpCommandGroup(BaseModel):
362
+ """Help command group information."""
363
+
364
+ title: str
365
+ commands: list[WaldiezDebugHelpCommand]
366
+
367
+
368
+ class WaldiezDebugPrint(BaseModel):
369
+ """Debug print message."""
370
+
371
+ type: Literal["debug_print"] = "debug_print"
372
+ content: str
373
+
374
+
375
+ class WaldiezDebugInputRequest(BaseModel):
376
+ """Debug input request message."""
377
+
378
+ type: Literal["debug_input_request"] = "debug_input_request"
379
+ prompt: str
380
+ request_id: str
381
+
382
+
383
+ class WaldiezDebugInputResponse(BaseModel):
384
+ """Debug input response message."""
385
+
386
+ type: Literal["debug_input_response"] = "debug_input_response"
387
+ request_id: str
388
+ data: str
389
+
390
+
391
+ class WaldiezDebugEventInfo(BaseModel):
392
+ """Debug event info message."""
393
+
394
+ type: Literal["debug_event_info"] = "debug_event_info"
395
+ event: dict[str, Any]
396
+
397
+
398
+ class WaldiezDebugStats(BaseModel):
399
+ """Debug stats message."""
400
+
401
+ type: Literal["debug_stats"] = "debug_stats"
402
+ stats: dict[str, Any]
403
+
404
+
405
+ class WaldiezDebugHelp(BaseModel):
406
+ """Debug help message."""
407
+
408
+ type: Literal["debug_help"] = "debug_help"
409
+ help: list[WaldiezDebugHelpCommandGroup]
410
+
411
+
412
+ class WaldiezDebugError(BaseModel):
413
+ """Debug error message."""
414
+
415
+ type: Literal["debug_error"] = "debug_error"
416
+ error: str
417
+
418
+
419
+ class WaldiezDebugBreakpointCleared(BaseModel):
420
+ """Debug breakpoint cleared message."""
421
+
422
+ type: Literal["debug_breakpoint_cleared"] = "debug_breakpoint_cleared"
423
+ message: str
424
+
425
+
426
+ WaldiezDebugMessage = Annotated[
427
+ Union[
428
+ WaldiezDebugPrint,
429
+ WaldiezDebugInputRequest,
430
+ WaldiezDebugInputResponse,
431
+ WaldiezDebugEventInfo,
432
+ WaldiezDebugStats,
433
+ WaldiezDebugHelp,
434
+ WaldiezDebugError,
435
+ WaldiezDebugBreakpointsList,
436
+ WaldiezDebugBreakpointAdded,
437
+ WaldiezDebugBreakpointRemoved,
438
+ WaldiezDebugBreakpointCleared,
439
+ ],
440
+ Field(discriminator="type"),
441
+ ]
442
+
443
+
444
+ class WaldiezDebugMessageWrapper(BaseModel):
445
+ """Wrapper for debug messages."""
446
+
447
+ # noinspection PyTypeHints
448
+ message: WaldiezDebugMessage
449
+
450
+
451
+ HELP_MESSAGE = WaldiezDebugHelp(
452
+ help=[
453
+ WaldiezDebugHelpCommandGroup(
454
+ title="Basic Commands",
455
+ commands=[
456
+ WaldiezDebugHelpCommand(
457
+ cmds=["continue", "c"], desc="Continue to the next step"
458
+ ),
459
+ WaldiezDebugHelpCommand(
460
+ cmds=["step", "s"], desc="Step through the next event"
461
+ ),
462
+ WaldiezDebugHelpCommand(
463
+ cmds=["run", "r"], desc="Run without stopping"
464
+ ),
465
+ WaldiezDebugHelpCommand(
466
+ cmds=["quit", "q"], desc="Quit the debugger"
467
+ ),
468
+ WaldiezDebugHelpCommand(
469
+ cmds=["info", "i"], desc="Show detailed event information"
470
+ ),
471
+ WaldiezDebugHelpCommand(
472
+ cmds=["help", "h"], desc="Show this help message"
473
+ ),
474
+ WaldiezDebugHelpCommand(
475
+ cmds=["stats", "st"], desc="Show execution statistics"
476
+ ),
477
+ ],
478
+ ),
479
+ WaldiezDebugHelpCommandGroup(
480
+ title="Breakpoint Commands",
481
+ commands=[
482
+ WaldiezDebugHelpCommand(
483
+ cmds=["add_breakpoint", "ab"],
484
+ desc="Add breakpoint. Usage: 'ab [spec]' where spec is 'event:<type>', 'agent:<name>', '<name>:<event>', or 'all'",
485
+ ),
486
+ WaldiezDebugHelpCommand(
487
+ cmds=["remove_breakpoint", "rb"],
488
+ desc="Remove breakpoint. Usage: 'rb [spec]' with same format as add",
489
+ ),
490
+ WaldiezDebugHelpCommand(
491
+ cmds=["list_breakpoints", "lb"], desc="List all breakpoints"
492
+ ),
493
+ WaldiezDebugHelpCommand(
494
+ cmds=["clear_breakpoints", "cb"],
495
+ desc="Clear all breakpoints",
496
+ ),
497
+ ],
498
+ ),
499
+ WaldiezDebugHelpCommandGroup(
500
+ title="Breakpoint Examples",
501
+ commands=[
502
+ WaldiezDebugHelpCommand(
503
+ desc="'ab' - Add breakpoint for the current event type"
504
+ ),
505
+ WaldiezDebugHelpCommand(
506
+ desc="'ab event:tool_call' - Break on all 'tool_call' events"
507
+ ),
508
+ WaldiezDebugHelpCommand(
509
+ desc="'ab agent:user' - Break on any event from 'user' agent"
510
+ ),
511
+ WaldiezDebugHelpCommand(
512
+ desc="'ab assistant:tool_call' - Break on 'tool_call' events from 'assistant'"
513
+ ),
514
+ WaldiezDebugHelpCommand(desc="'ab all' - Break on all events"),
515
+ WaldiezDebugHelpCommand(
516
+ desc="'rb event:tool_call' - Remove 'tool_call' event breakpoint"
517
+ ),
518
+ ],
519
+ ),
520
+ WaldiezDebugHelpCommandGroup(
521
+ title="Tips",
522
+ commands=[
523
+ WaldiezDebugHelpCommand(
524
+ desc="Press Enter alone to continue (same as 'c')"
525
+ ),
526
+ WaldiezDebugHelpCommand(
527
+ desc="Use (s)tep to go through events one by one"
528
+ ),
529
+ WaldiezDebugHelpCommand(
530
+ desc="Use (r)un to continue without stopping"
531
+ ),
532
+ WaldiezDebugHelpCommand(
533
+ desc="Set specific breakpoints to avoid noise: 'ab event:message'"
534
+ ),
535
+ WaldiezDebugHelpCommand(
536
+ desc="Check (st)ats regularly to monitor progress"
537
+ ),
538
+ ],
539
+ ),
540
+ ]
541
+ )