You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Autosave is enabled by default (`autosave=True`). Conversation history is automatically saved to `{workspace_dir}/swarms/ConcurrentWorkflow/{workflow-name}-{timestamp}/conversation_history.json`.
181
+
182
+
To set a custom workspace directory name, use the `WORKSPACE_DIR` environment variable:
181
183
182
184
```python
185
+
import os
186
+
from swarms import Agent, ConcurrentWorkflow
187
+
188
+
# Set custom workspace directory where conversation history will be saved
189
+
# If not set, defaults to 'agent_workspace' in the current directory
Copy file name to clipboardExpand all lines: docs/swarms/structs/hierarchical_swarm.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,8 @@ Initializes a new HierarchicalSwarm instance.
66
66
|`multi_agent_prompt_improvements`|`bool`|`False`| No | Enable enhanced multi-agent collaboration prompts |
67
67
|`interactive`|`bool`|`False`| No | Enable interactive mode with Hierarchical Swarms dashboard visualization |
68
68
|`planning_enabled`|`bool`|`True`| No | Enable planning phase before task distribution |
69
+
|`autosave`|`bool`|`True`| No | Whether to enable autosaving of conversation history |
70
+
|`verbose`|`bool`|`False`| No | Whether to enable verbose logging |
69
71
70
72
#### Returns
71
73
@@ -481,6 +483,31 @@ The dashboard automatically:
481
483
|**Detailed View**| Full output history for each agent in each loop |
482
484
|**Real-time Updates**| Dashboard refreshes automatically as operations progress |
483
485
486
+
## Autosave Feature
487
+
488
+
Autosave is enabled by default (`autosave=True`). Conversation history is automatically saved to `{workspace_dir}/swarms/HierarchicalSwarm/{swarm-name}-{timestamp}/conversation_history.json` after all loops complete.
489
+
490
+
To set a custom workspace directory name, use the `WORKSPACE_DIR` environment variable:
491
+
492
+
```python
493
+
import os
494
+
from swarms import Agent, HierarchicalSwarm
495
+
496
+
# Set custom workspace directory where conversation history will be saved
497
+
# If not set, defaults to 'agent_workspace' in the current directory
498
+
os.environ["WORKSPACE_DIR"] ="my_project"
499
+
500
+
# Create swarm (autosave enabled by default)
501
+
swarm = HierarchicalSwarm(
502
+
name="analysis-swarm",
503
+
agents=[research_agent, financial_agent],
504
+
max_loops=2,
505
+
)
506
+
507
+
# Run swarm - conversation automatically saved after all loops
508
+
result = swarm.run("Analyze Tesla (TSLA) stock")
509
+
```
510
+
484
511
## Planning Feature
485
512
486
513
The `planning_enabled` parameter controls whether the director performs an initial planning phase before creating task orders. When enabled, the director:
Copy file name to clipboardExpand all lines: docs/swarms/structs/sequential_workflow.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,11 @@ graph TD
34
34
|`shared_memory_system`|`callable`| Optional callable for managing shared memory between agents. |
35
35
|`multi_agent_collab_prompt`|`bool`| If True, appends a collaborative prompt to each agent's system prompt. |
36
36
|`team_awareness`|`bool`| Enables sequential awareness features (passed to internal `AgentRearrange`). Defaults to `False`. |
37
+
|`autosave`|`bool`| Whether to enable autosaving of conversation history. Defaults to `True`. |
38
+
|`verbose`|`bool`| Whether to enable verbose logging. Defaults to `False`. |
37
39
|`flow`|`str`| A string representing the order of agents (e.g., "Agent1 -> Agent2 -> Agent3"). |
38
40
|`agent_rearrange`|`AgentRearrange`| Internal helper for managing agent execution. |
41
+
|`swarm_workspace_dir`|`str`| The workspace directory where conversation history is saved (set automatically when autosave is enabled). |
39
42
40
43
## Methods
41
44
@@ -53,6 +56,8 @@ The constructor initializes the `SequentialWorkflow` object.
53
56
-`shared_memory_system` (`callable`, optional): Callable for shared memory management. Defaults to `None`.
54
57
-`multi_agent_collab_prompt` (`bool`, optional): If True, appends a collaborative prompt to each agent's system prompt. Defaults to `False`.
55
58
-`team_awareness` (`bool`, optional): Enables sequential awareness features in the underlying `AgentRearrange`. Defaults to `False`.
59
+
-`autosave` (`bool`, optional): Whether to enable autosaving of conversation history. Defaults to `True`.
60
+
-`verbose` (`bool`, optional): Whether to enable verbose logging. Defaults to `False`.
56
61
-`*args`: Variable length argument list.
57
62
-`**kwargs`: Arbitrary keyword arguments.
58
63
@@ -308,6 +313,32 @@ print(result)
308
313
|`description`| Description of workflow purpose | Standard description |
309
314
|`max_loops`| Number of times to execute workflow | 1 |
310
315
|`team_awareness`| Enable sequential awareness features | False |
316
+
|`autosave`| Enable automatic saving of conversation history | True |
317
+
|`verbose`| Enable verbose logging | False |
318
+
319
+
## Autosave Feature
320
+
321
+
Autosave is enabled by default (`autosave=True`). Conversation history is automatically saved to `{workspace_dir}/swarms/SequentialWorkflow/{workflow-name}-{timestamp}/conversation_history.json`.
322
+
323
+
To set a custom workspace directory name, use the `WORKSPACE_DIR` environment variable:
324
+
325
+
```python
326
+
import os
327
+
from swarms import Agent, SequentialWorkflow
328
+
329
+
# Set custom workspace directory where conversation history will be saved
330
+
# If not set, defaults to 'agent_workspace' in the current directory
331
+
os.environ["WORKSPACE_DIR"] ="my_project"
332
+
333
+
# Create workflow (autosave enabled by default)
334
+
workflow = SequentialWorkflow(
335
+
name="content-workflow",
336
+
agents=[writer, editor],
337
+
)
338
+
339
+
# Run workflow - conversation automatically saved
340
+
result = workflow.run("Write a blog post about AI")
0 commit comments