waldiez 0.5.2__py3-none-any.whl → 0.5.4__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 (79) hide show
  1. waldiez/_version.py +1 -1
  2. waldiez/cli.py +5 -27
  3. waldiez/exporter.py +0 -13
  4. waldiez/exporting/agent/exporter.py +38 -0
  5. waldiez/exporting/agent/extras/__init__.py +2 -0
  6. waldiez/exporting/agent/extras/doc_agent_extras.py +366 -0
  7. waldiez/exporting/agent/extras/group_member_extras.py +3 -2
  8. waldiez/exporting/agent/processor.py +113 -15
  9. waldiez/exporting/chats/processor.py +2 -21
  10. waldiez/exporting/chats/utils/common.py +66 -1
  11. waldiez/exporting/chats/utils/group.py +6 -3
  12. waldiez/exporting/chats/utils/nested.py +1 -1
  13. waldiez/exporting/chats/utils/sequential.py +25 -9
  14. waldiez/exporting/chats/utils/single.py +8 -6
  15. waldiez/exporting/core/context.py +0 -12
  16. waldiez/exporting/core/extras/agent_extras/standard_extras.py +3 -1
  17. waldiez/exporting/core/extras/base.py +20 -17
  18. waldiez/exporting/core/extras/path_resolver.py +39 -41
  19. waldiez/exporting/core/extras/serializer.py +16 -1
  20. waldiez/exporting/core/protocols.py +17 -0
  21. waldiez/exporting/core/types.py +6 -9
  22. waldiez/exporting/flow/execution_generator.py +56 -21
  23. waldiez/exporting/flow/exporter.py +1 -4
  24. waldiez/exporting/flow/factory.py +0 -9
  25. waldiez/exporting/flow/file_generator.py +6 -0
  26. waldiez/exporting/flow/orchestrator.py +27 -21
  27. waldiez/exporting/flow/utils/__init__.py +0 -2
  28. waldiez/exporting/flow/utils/common.py +15 -96
  29. waldiez/exporting/flow/utils/importing.py +4 -0
  30. waldiez/io/mqtt.py +33 -14
  31. waldiez/io/redis.py +18 -13
  32. waldiez/io/structured.py +9 -4
  33. waldiez/io/utils.py +32 -0
  34. waldiez/io/ws.py +8 -2
  35. waldiez/models/__init__.py +6 -0
  36. waldiez/models/agents/__init__.py +8 -0
  37. waldiez/models/agents/agent/agent.py +136 -38
  38. waldiez/models/agents/agent/agent_type.py +3 -2
  39. waldiez/models/agents/agents.py +10 -0
  40. waldiez/models/agents/doc_agent/__init__.py +13 -0
  41. waldiez/models/agents/doc_agent/doc_agent.py +126 -0
  42. waldiez/models/agents/doc_agent/doc_agent_data.py +149 -0
  43. waldiez/models/agents/doc_agent/rag_query_engine.py +127 -0
  44. waldiez/models/chat/chat_message.py +1 -1
  45. waldiez/models/flow/flow.py +13 -2
  46. waldiez/models/model/__init__.py +2 -2
  47. waldiez/models/model/_aws.py +75 -0
  48. waldiez/models/model/_llm.py +516 -0
  49. waldiez/models/model/_price.py +30 -0
  50. waldiez/models/model/model.py +45 -2
  51. waldiez/models/model/model_data.py +2 -83
  52. waldiez/models/tool/predefined/_duckduckgo.py +123 -0
  53. waldiez/models/tool/predefined/_google.py +31 -9
  54. waldiez/models/tool/predefined/_perplexity.py +161 -0
  55. waldiez/models/tool/predefined/_searxng.py +152 -0
  56. waldiez/models/tool/predefined/_tavily.py +46 -9
  57. waldiez/models/tool/predefined/_wikipedia.py +26 -6
  58. waldiez/models/tool/predefined/_youtube.py +36 -8
  59. waldiez/models/tool/predefined/registry.py +6 -0
  60. waldiez/models/waldiez.py +12 -0
  61. waldiez/runner.py +184 -382
  62. waldiez/running/__init__.py +2 -4
  63. waldiez/running/base_runner.py +136 -118
  64. waldiez/running/environment.py +61 -17
  65. waldiez/running/post_run.py +70 -14
  66. waldiez/running/pre_run.py +42 -0
  67. waldiez/running/protocol.py +42 -48
  68. waldiez/running/run_results.py +5 -5
  69. waldiez/running/standard_runner.py +429 -0
  70. waldiez/running/timeline_processor.py +1166 -0
  71. waldiez/utils/version.py +12 -1
  72. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/METADATA +61 -63
  73. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/RECORD +77 -66
  74. waldiez/running/import_runner.py +0 -424
  75. waldiez/running/subprocess_runner.py +0 -100
  76. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/WHEEL +0 -0
  77. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/entry_points.txt +0 -0
  78. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/licenses/LICENSE +0 -0
  79. {waldiez-0.5.2.dist-info → waldiez-0.5.4.dist-info}/licenses/NOTICE.md +0 -0
@@ -12,7 +12,15 @@ import tempfile
12
12
  import threading
13
13
  from pathlib import Path
14
14
  from types import TracebackType
15
- from typing import TYPE_CHECKING, Type, Union
15
+ from typing import (
16
+ TYPE_CHECKING,
17
+ Any,
18
+ Callable,
19
+ Coroutine,
20
+ Optional,
21
+ Type,
22
+ Union,
23
+ )
16
24
 
17
25
  from anyio.from_thread import start_blocking_portal
18
26
  from typing_extensions import Self
@@ -20,7 +28,6 @@ from typing_extensions import Self
20
28
  from waldiez.exporter import WaldiezExporter
21
29
  from waldiez.logger import WaldiezLogger, get_logger
22
30
  from waldiez.models import Waldiez
23
- from waldiez.utils import get_waldiez_version
24
31
 
25
32
  from .environment import refresh_environment, reset_env_vars, set_env_vars
26
33
  from .post_run import after_run
@@ -35,7 +42,11 @@ from .utils import (
35
42
  )
36
43
 
37
44
  if TYPE_CHECKING:
38
- from autogen import ChatResult # type: ignore[import-untyped]
45
+ from autogen.events import BaseEvent # type: ignore[import-untyped]
46
+ from autogen.io.run_response import ( # type: ignore[import-untyped]
47
+ AsyncRunResponseProtocol,
48
+ RunResponseProtocol,
49
+ )
39
50
 
40
51
 
41
52
  class WaldiezBaseRunner(WaldiezRunnerProtocol):
@@ -54,9 +65,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
54
65
  - _a_stop: Async actions to perform when stopping the flow.
55
66
  """
56
67
 
57
- _threaded: bool
58
68
  _structured_io: bool
59
- _isolated: bool
60
69
  _output_path: str | Path | None
61
70
  _uploads_root: str | Path | None
62
71
  _skip_patch_io: bool
@@ -68,29 +77,30 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
68
77
  output_path: str | Path | None,
69
78
  uploads_root: str | Path | None,
70
79
  structured_io: bool,
71
- isolated: bool,
72
- threaded: bool,
73
80
  skip_patch_io: bool = False,
74
81
  ) -> None:
75
82
  """Initialize the Waldiez manager."""
76
83
  self._waldiez = waldiez
77
84
  WaldiezBaseRunner._running = False
78
85
  WaldiezBaseRunner._structured_io = structured_io
79
- WaldiezBaseRunner._isolated = isolated
80
86
  WaldiezBaseRunner._output_path = output_path
81
87
  WaldiezBaseRunner._uploads_root = uploads_root
82
- WaldiezBaseRunner._threaded = threaded
83
88
  WaldiezBaseRunner._skip_patch_io = skip_patch_io
84
89
  self._called_install_requirements = False
85
90
  self._exporter = WaldiezExporter(waldiez)
86
91
  self._stop_requested = threading.Event()
87
92
  self._logger = get_logger()
93
+ self._print: Callable[..., None] = print
94
+ self._send: Callable[["BaseEvent"], None] = self._print
95
+ self._input: (
96
+ Callable[..., str] | Callable[..., Coroutine[Any, Any, str]]
97
+ ) = input
88
98
  self._last_results: Union[
89
- "ChatResult",
90
- list["ChatResult"],
91
- dict[int, "ChatResult"],
99
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
92
100
  ] = []
93
101
  self._last_exception: Exception | None = None
102
+ self._execution_complete_event = threading.Event()
103
+ self._execution_thread: Optional[threading.Thread] = None
94
104
 
95
105
  def is_running(self) -> bool:
96
106
  """Check if the workflow is currently running.
@@ -102,9 +112,64 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
102
112
  """
103
113
  return WaldiezBaseRunner._running
104
114
 
105
- # ===================================================================
106
- # PRIVATE METHODS TO OVERRIDE IN SUBCLASSES
107
- # ===================================================================
115
+ def wait_for_completion(self, timeout: Optional[float] = None) -> bool:
116
+ """Wait for non-blocking execution to complete.
117
+
118
+ This is a base implementation that subclasses can override if needed.
119
+
120
+ Parameters
121
+ ----------
122
+ timeout: float | None
123
+ The maximum time to wait for completion, in seconds.
124
+ If None, wait indefinitely.
125
+
126
+ Returns
127
+ -------
128
+ bool
129
+ True if the workflow completed successfully, False if it timed out.
130
+ """
131
+ # Default implementation - subclasses can override
132
+ if not self.is_running():
133
+ return True
134
+
135
+ if self._execution_thread and self._execution_thread.is_alive():
136
+ self._execution_thread.join(timeout)
137
+ return not self._execution_thread.is_alive()
138
+
139
+ return self._execution_complete_event.wait(timeout or 0)
140
+
141
+ def get_execution_stats(self) -> dict[str, Any]:
142
+ """Get basic execution statistics.
143
+
144
+ Returns
145
+ -------
146
+ dict[str, Any]
147
+ A dictionary containing execution statistics.
148
+ - is_running: Whether the runner is currently running.
149
+ - has_thread: Whether there is an execution thread.
150
+ - thread_alive: Whether the execution thread is alive.
151
+ - has_error: Whether there was an error during execution.
152
+ """
153
+ return {
154
+ "is_running": self.is_running(),
155
+ "has_thread": self._execution_thread is not None,
156
+ "thread_alive": (
157
+ self._execution_thread.is_alive()
158
+ if self._execution_thread
159
+ else False
160
+ ),
161
+ "has_error": self._last_exception is not None,
162
+ }
163
+
164
+ # Helper for subclasses
165
+ def _signal_completion(self) -> None:
166
+ """Signal that execution has completed."""
167
+ self._execution_complete_event.set()
168
+
169
+ def _reset_completion_state(self) -> None:
170
+ """Reset completion state for new execution."""
171
+ self._execution_complete_event.clear()
172
+
108
173
  def _before_run(
109
174
  self,
110
175
  output_file: Path,
@@ -119,10 +184,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
119
184
  path=file_name,
120
185
  force=True,
121
186
  uploads_root=uploads_root,
122
- # if not isolated, we use structured IO in a context manager
123
- structured_io=WaldiezBaseRunner._structured_io
124
- and WaldiezBaseRunner._isolated,
125
- skip_patch_io=WaldiezBaseRunner._skip_patch_io,
187
+ structured_io=WaldiezBaseRunner._structured_io,
126
188
  )
127
189
  return temp_dir
128
190
 
@@ -149,11 +211,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
149
211
  output_file: Path,
150
212
  uploads_root: Path | None,
151
213
  skip_mmd: bool,
152
- ) -> Union[
153
- "ChatResult",
154
- list["ChatResult"],
155
- dict[int, "ChatResult"],
156
- ]: # pyright: ignore
214
+ skip_timeline: bool,
215
+ ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
157
216
  """Run the Waldiez flow."""
158
217
  raise NotImplementedError(
159
218
  "The _run method must be implemented in the subclass."
@@ -165,11 +224,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
165
224
  output_file: Path,
166
225
  uploads_root: Path | None,
167
226
  skip_mmd: bool,
168
- ) -> Union[
169
- "ChatResult",
170
- list["ChatResult"],
171
- dict[int, "ChatResult"],
172
- ]: # pyright: ignore
227
+ skip_timeline: bool,
228
+ ) -> Union[list["AsyncRunResponseProtocol"], list["RunResponseProtocol"]]:
173
229
  """Run the Waldiez flow asynchronously."""
174
230
  raise NotImplementedError(
175
231
  "The _a_run method must be implemented in the subclass."
@@ -181,6 +237,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
181
237
  output_file: Path,
182
238
  uploads_root: Path | None,
183
239
  skip_mmd: bool,
240
+ skip_timeline: bool,
184
241
  ) -> None:
185
242
  """Start running the Waldiez flow in a non-blocking way."""
186
243
  raise NotImplementedError(
@@ -193,6 +250,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
193
250
  output_file: Path,
194
251
  uploads_root: Path | None,
195
252
  skip_mmd: bool,
253
+ skip_timeline: bool,
196
254
  ) -> None:
197
255
  """Start running the Waldiez flow in a non-blocking way asynchronously.
198
256
 
@@ -216,14 +274,13 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
216
274
  def _after_run(
217
275
  self,
218
276
  results: Union[
219
- "ChatResult",
220
- list["ChatResult"],
221
- dict[int, "ChatResult"],
277
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
222
278
  ],
223
279
  output_file: Path,
224
280
  uploads_root: Path | None,
225
281
  temp_dir: Path,
226
282
  skip_mmd: bool,
283
+ skip_timeline: bool,
227
284
  ) -> None:
228
285
  """Run after the flow execution."""
229
286
  # Save results
@@ -237,20 +294,20 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
237
294
  flow_name=self.waldiez.name,
238
295
  uploads_root=uploads_root,
239
296
  skip_mmd=skip_mmd,
297
+ skip_timeline=skip_timeline,
240
298
  )
241
299
  self.log.info("Cleanup completed")
242
300
 
243
301
  async def _a_after_run(
244
302
  self,
245
303
  results: Union[
246
- "ChatResult",
247
- list["ChatResult"],
248
- dict[int, "ChatResult"],
304
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
249
305
  ],
250
306
  output_file: Path,
251
307
  uploads_root: Path | None,
252
308
  temp_dir: Path,
253
309
  skip_mmd: bool,
310
+ skip_timeline: bool,
254
311
  ) -> None:
255
312
  """Run after the flow execution asynchronously."""
256
313
  self._after_run(
@@ -259,6 +316,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
259
316
  uploads_root=uploads_root,
260
317
  temp_dir=temp_dir,
261
318
  skip_mmd=skip_mmd,
319
+ skip_timeline=skip_timeline,
262
320
  )
263
321
 
264
322
  def _stop(self) -> None:
@@ -309,9 +367,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
309
367
  for req in self.waldiez.requirements
310
368
  if req not in sys.modules and "waldiez" not in req
311
369
  }
312
- waldiez_version = get_waldiez_version()
313
- if "waldiez" not in sys.modules:
314
- extra_requirements.add(f"waldiez=={waldiez_version}")
315
370
  return extra_requirements
316
371
 
317
372
  def install_requirements(self) -> None:
@@ -387,14 +442,9 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
387
442
  output_path: str | Path | None = None,
388
443
  uploads_root: str | Path | None = None,
389
444
  structured_io: bool | None = None,
390
- threaded: bool | None = None,
391
- skip_patch_io: bool | None = None,
392
445
  skip_mmd: bool = False,
393
- ) -> Union[
394
- "ChatResult",
395
- list["ChatResult"],
396
- dict[int, "ChatResult"],
397
- ]: # pyright: ignore
446
+ skip_timeline: bool = False,
447
+ ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
398
448
  """Run the Waldiez flow in blocking mode.
399
449
 
400
450
  Parameters
@@ -406,31 +456,24 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
406
456
  structured_io : bool
407
457
  Whether to use structured IO instead of the default 'input/print',
408
458
  by default False.
409
- threaded : bool | None
410
- Whether to run the flow in a threaded environment, by default None.
411
459
  skip_mmd : bool
412
460
  Whether to skip generating the mermaid diagram, by default False.
413
- skip_patch_io : bool | None
414
- Whether to skip patching the IO streams, by default None.
461
+ skip_timeline : bool
462
+ Whether to skip generating the timeline JSON.
415
463
 
416
464
  Returns
417
465
  -------
418
- Union[ChatResult, list[ChatResult], dict[int, ChatResult]]
419
- The result of the run, which can be a single ChatResult,
420
- a list of ChatResults,
421
- or a dictionary mapping indices to ChatResults.
466
+ Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]
467
+ The result of the run, which can be a list of RunResponseProtocol
468
+ or a list of AsyncRunResponseProtocol.
422
469
 
423
470
  Raises
424
471
  ------
425
472
  RuntimeError
426
473
  If the runner is already running.
427
474
  """
428
- if skip_patch_io is not None:
429
- WaldiezBaseRunner._skip_patch_io = skip_patch_io
430
475
  if structured_io is not None:
431
476
  WaldiezBaseRunner._structured_io = structured_io
432
- if threaded is not None:
433
- WaldiezBaseRunner._threaded = threaded
434
477
  if self.is_running():
435
478
  raise RuntimeError("Workflow already running")
436
479
  if self.waldiez.is_async:
@@ -440,7 +483,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
440
483
  output_path,
441
484
  uploads_root,
442
485
  structured_io,
443
- skip_patch_io,
444
486
  skip_mmd,
445
487
  )
446
488
  output_file, uploads_root_path = self._prepare_paths(
@@ -455,9 +497,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
455
497
  refresh_environment()
456
498
  WaldiezBaseRunner._running = True
457
499
  results: Union[
458
- "ChatResult",
459
- list["ChatResult"],
460
- dict[int, "ChatResult"],
500
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
461
501
  ] = []
462
502
  old_env_vars = set_env_vars(self.waldiez.get_flow_env_vars())
463
503
  try:
@@ -468,6 +508,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
468
508
  output_file=output_file,
469
509
  uploads_root=uploads_root_path,
470
510
  skip_mmd=skip_mmd,
511
+ skip_timeline=skip_timeline,
471
512
  )
472
513
  finally:
473
514
  WaldiezBaseRunner._running = False
@@ -478,7 +519,9 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
478
519
  uploads_root=uploads_root_path,
479
520
  temp_dir=temp_dir,
480
521
  skip_mmd=skip_mmd,
522
+ skip_timeline=skip_timeline,
481
523
  )
524
+ self._print("<Waldiez> - Done running the flow.")
482
525
  if sys.path[0] == str(temp_dir):
483
526
  sys.path.pop(0)
484
527
  return results
@@ -488,13 +531,9 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
488
531
  output_path: str | Path | None = None,
489
532
  uploads_root: str | Path | None = None,
490
533
  structured_io: bool | None = None,
491
- skip_patch_io: bool | None = None,
492
534
  skip_mmd: bool = False,
493
- ) -> Union[
494
- "ChatResult",
495
- list["ChatResult"],
496
- dict[int, "ChatResult"],
497
- ]: # pyright: ignore
535
+ skip_timeline: bool = False,
536
+ ) -> Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]:
498
537
  """Run the Waldiez flow asynchronously.
499
538
 
500
539
  Parameters
@@ -506,25 +545,22 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
506
545
  structured_io : bool
507
546
  Whether to use structured IO instead of the default 'input/print',
508
547
  by default False.
509
- skip_patch_io : bool | None
510
- Whether to skip patching I/O, by default None.
511
548
  skip_mmd : bool
512
549
  Whether to skip generating the mermaid diagram, by default False.
550
+ skip_timeline : bool
551
+ Whether to skip generating the timeline JSON, by default False.
513
552
 
514
553
  Returns
515
554
  -------
516
- Union[ChatResult, list[ChatResult], dict[int, ChatResult]]
517
- The result of the run, which can be a single ChatResult,
518
- a list of ChatResults,
519
- or a dictionary mapping indices to ChatResults.
555
+ Union[list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]]
556
+ The result of the run, which can be a list of RunResponseProtocol
557
+ or a list of AsyncRunResponseProtocol.
520
558
 
521
559
  Raises
522
560
  ------
523
561
  RuntimeError
524
562
  If the runner is already running.
525
563
  """
526
- if skip_patch_io is not None:
527
- WaldiezBaseRunner._skip_patch_io = skip_patch_io
528
564
  if structured_io is not None:
529
565
  WaldiezBaseRunner._structured_io = structured_io
530
566
  if self.is_running():
@@ -541,10 +577,9 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
541
577
  refresh_environment()
542
578
  WaldiezBaseRunner._running = True
543
579
  results: Union[
544
- "ChatResult",
545
- list["ChatResult"],
546
- dict[int, "ChatResult"],
580
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
547
581
  ] = []
582
+ old_env_vars = set_env_vars(self.waldiez.get_flow_env_vars())
548
583
  try:
549
584
  async with a_chdir(to=temp_dir):
550
585
  sys.path.insert(0, str(temp_dir))
@@ -553,15 +588,18 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
553
588
  output_file=output_file,
554
589
  uploads_root=uploads_root_path,
555
590
  skip_mmd=skip_mmd,
591
+ skip_timeline=skip_timeline,
556
592
  )
557
593
  finally:
558
594
  WaldiezBaseRunner._running = False
595
+ reset_env_vars(old_env_vars)
559
596
  await self._a_after_run(
560
597
  results=results,
561
598
  output_file=output_file,
562
599
  uploads_root=uploads_root_path,
563
600
  temp_dir=temp_dir,
564
601
  skip_mmd=skip_mmd,
602
+ skip_timeline=skip_timeline,
565
603
  )
566
604
  if sys.path[0] == str(temp_dir):
567
605
  sys.path.pop(0)
@@ -572,8 +610,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
572
610
  output_path: str | Path | None,
573
611
  uploads_root: str | Path | None,
574
612
  structured_io: bool | None = None,
575
- skip_patch_io: bool | None = None,
576
613
  skip_mmd: bool = False,
614
+ skip_timeline: bool = False,
577
615
  ) -> None:
578
616
  """Start running the Waldiez flow in a non-blocking way.
579
617
 
@@ -585,18 +623,16 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
585
623
  The runtime uploads root.
586
624
  structured_io : bool | None
587
625
  Whether to use structured IO instead of the default 'input/print'.
588
- skip_patch_io : bool | None
589
- Whether to skip patching I/O, by default None.
590
626
  skip_mmd : bool
591
627
  Whether to skip generating the mermaid diagram, by default False.
628
+ skip_timeline : bool
629
+ Whether to skip generating the timeline JSON, by default False.
592
630
 
593
631
  Raises
594
632
  ------
595
633
  RuntimeError
596
634
  If the runner is already running.
597
635
  """
598
- if skip_patch_io is not None:
599
- WaldiezBaseRunner._skip_patch_io = skip_patch_io
600
636
  if structured_io is not None:
601
637
  WaldiezBaseRunner._structured_io = structured_io
602
638
  if self.is_running():
@@ -617,6 +653,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
617
653
  output_file=output_file,
618
654
  uploads_root=uploads_root_path,
619
655
  skip_mmd=skip_mmd,
656
+ skip_timeline=skip_timeline,
620
657
  )
621
658
 
622
659
  async def a_start(
@@ -624,8 +661,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
624
661
  output_path: str | Path | None,
625
662
  uploads_root: str | Path | None,
626
663
  structured_io: bool | None = None,
627
- skip_patch_io: bool | None = None,
628
664
  skip_mmd: bool = False,
665
+ skip_timeline: bool = False,
629
666
  ) -> None:
630
667
  """Asynchronously start running the Waldiez flow in a non-blocking way.
631
668
 
@@ -637,18 +674,16 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
637
674
  The runtime uploads root.
638
675
  structured_io : bool | None = None
639
676
  Whether to use structured IO instead of the default 'input/print'.
640
- skip_patch_io : bool | None = None
641
- Whether to skip patching I/O, by default None.
642
- skip_mmd : bool | None = None
643
- Whether to skip generating the mermaid diagram, by default None.
677
+ skip_mmd : bool = False
678
+ Whether to skip generating the mermaid diagram, by default False.
679
+ skip_timeline : bool = False
680
+ Whether to skip generating the timeline JSON, by default False.
644
681
 
645
682
  Raises
646
683
  ------
647
684
  RuntimeError
648
685
  If the runner is already running.
649
686
  """
650
- if skip_patch_io is not None:
651
- WaldiezBaseRunner._skip_patch_io = skip_patch_io
652
687
  if structured_io is not None:
653
688
  WaldiezBaseRunner._structured_io = structured_io
654
689
  if self.is_running():
@@ -669,19 +704,19 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
669
704
  output_file=output_file,
670
705
  uploads_root=uploads_root_path,
671
706
  skip_mmd=skip_mmd,
707
+ skip_timeline=skip_timeline,
672
708
  )
673
709
 
674
710
  def after_run(
675
711
  self,
676
712
  results: Union[
677
- "ChatResult",
678
- list["ChatResult"],
679
- dict[int, "ChatResult"],
713
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
680
714
  ],
681
715
  output_file: Path,
682
716
  uploads_root: Path | None,
683
717
  temp_dir: Path,
684
718
  skip_mmd: bool,
719
+ skip_timeline: bool,
685
720
  ) -> None:
686
721
  """Actions to perform after running the flow.
687
722
 
@@ -697,6 +732,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
697
732
  The path to the temporary directory used during the run.
698
733
  skip_mmd : bool
699
734
  Whether to skip generating the mermaid diagram.
735
+ skip_timeline : bool
736
+ Whether to skip generating the timeline JSON.
700
737
  """
701
738
  self._after_run(
702
739
  results=results,
@@ -704,19 +741,19 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
704
741
  uploads_root=uploads_root,
705
742
  temp_dir=temp_dir,
706
743
  skip_mmd=skip_mmd,
744
+ skip_timeline=skip_timeline,
707
745
  )
708
746
 
709
747
  async def a_after_run(
710
748
  self,
711
749
  results: Union[
712
- "ChatResult",
713
- list["ChatResult"],
714
- dict[int, "ChatResult"],
750
+ list["RunResponseProtocol"], list["AsyncRunResponseProtocol"]
715
751
  ],
716
752
  output_file: Path,
717
753
  uploads_root: Path | None,
718
754
  temp_dir: Path,
719
755
  skip_mmd: bool,
756
+ skip_timeline: bool,
720
757
  ) -> None:
721
758
  """Asynchronously perform actions after running the flow.
722
759
 
@@ -732,6 +769,8 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
732
769
  The path to the temporary directory used during the run.
733
770
  skip_mmd : bool
734
771
  Whether to skip generating the mermaid diagram.
772
+ skip_timeline : bool
773
+
735
774
  """
736
775
  await self._a_after_run(
737
776
  results=results,
@@ -739,6 +778,7 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
739
778
  uploads_root=uploads_root,
740
779
  temp_dir=temp_dir,
741
780
  skip_mmd=skip_mmd,
781
+ skip_timeline=skip_timeline,
742
782
  )
743
783
 
744
784
  def stop(self) -> None:
@@ -783,21 +823,11 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
783
823
  """Get the logger for the runner."""
784
824
  return self._logger
785
825
 
786
- @property
787
- def threaded(self) -> bool:
788
- """Check if the runner is running in a threaded environment."""
789
- return WaldiezBaseRunner._threaded
790
-
791
826
  @property
792
827
  def structured_io(self) -> bool:
793
828
  """Check if the runner is using structured IO."""
794
829
  return WaldiezBaseRunner._structured_io
795
830
 
796
- @property
797
- def isolated(self) -> bool:
798
- """Check if the runner is running in an isolated environment."""
799
- return WaldiezBaseRunner._isolated
800
-
801
831
  @property
802
832
  def output_path(self) -> str | Path | None:
803
833
  """Get the output path for the runner."""
@@ -824,9 +854,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
824
854
  output_path: str | Path | None = None,
825
855
  uploads_root: str | Path | None = None,
826
856
  structured_io: bool = False,
827
- isolated: bool = False,
828
- threaded: bool = False,
829
- skip_patch_io: bool = True,
830
857
  ) -> "WaldiezBaseRunner":
831
858
  """Load a waldiez flow from a file and create a runner.
832
859
 
@@ -849,12 +876,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
849
876
  structured_io : bool, optional
850
877
  Whether to use structured IO instead of the default 'input/print',
851
878
  by default False.
852
- isolated : bool, optional
853
- Whether to run the flow in an isolated environment, default False.
854
- threaded : bool, optional
855
- Whether to run the flow in a threaded environment, default False.
856
- skip_patch_io : bool, optional
857
- Whether to skip patching IO, by default True.
858
879
 
859
880
  Returns
860
881
  -------
@@ -873,9 +894,6 @@ class WaldiezBaseRunner(WaldiezRunnerProtocol):
873
894
  output_path=output_path,
874
895
  uploads_root=uploads_root,
875
896
  structured_io=structured_io,
876
- isolated=isolated,
877
- threaded=threaded,
878
- skip_patch_io=skip_patch_io,
879
897
  )
880
898
 
881
899
  def __enter__(self) -> Self: