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
Copy file name to clipboardExpand all lines: examples/multi_agent/hiearchical_swarm/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ This directory contains examples demonstrating hierarchical swarm patterns for m
4
4
5
5
## Examples
6
6
7
+
-[hierarchical_swarm_autosave_example.py](hierarchical_swarm_autosave_example.py) - **Autosave feature example** - Shows how to automatically save conversation history
# Save conversation history after successful execution
1275
+
ifself.autosaveandself.swarm_workspace_dir:
1276
+
try:
1277
+
self._save_conversation_history()
1278
+
exceptExceptionase:
1279
+
logger.warning(
1280
+
f"Failed to save conversation history: {e}"
1281
+
)
1282
+
1283
+
returnresult
1284
+
1174
1285
exceptExceptionase:
1175
1286
# Stop dashboard on error
1176
1287
ifself.interactiveandself.dashboard:
1177
1288
self.dashboard.update_director_status("ERROR")
1178
1289
self.dashboard.stop()
1179
1290
1291
+
# Save conversation history on error
1292
+
ifself.autosaveandself.swarm_workspace_dir:
1293
+
try:
1294
+
self._save_conversation_history()
1295
+
exceptExceptionassave_error:
1296
+
logger.warning(
1297
+
f"Failed to save conversation history on error: {save_error}"
1298
+
)
1299
+
1180
1300
error_msg=f"[ERROR] Swarm run failed: {str(e)}"
1181
1301
logger.error(
1182
1302
f"{error_msg}\n[TRACE] Traceback: {traceback.format_exc()}\n[BUG] If this issue persists, please report it at: https://github.com/kyegomez/swarms/issues"
1183
1303
)
1304
+
raise
1184
1305
1185
1306
def_get_interactive_task(self) ->str:
1186
1307
"""
@@ -1610,3 +1731,5 @@ def batched_run(
1610
1731
logger.error(
1611
1732
f"{error_msg}\n[TRACE] Traceback: {traceback.format_exc()}\n[BUG] If this issue persists, please report it at: https://github.com/kyegomez/swarms/issues"
0 commit comments