-
-
Notifications
You must be signed in to change notification settings - Fork 717
Add advanced agent state management and recovery modules #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Implemented AgentStateManager for comprehensive state persistence, recovery, versioning, and checkpoint capabilities. - Introduced StateRecovery for handling recovery from corrupted states and migration between different state formats. - Added StateValidator for integrity checks and validation of state files. - Developed StateHistory to manage state version history and snapshots. - Created StateMetadata to track metadata for saved states. - Implemented StateMigration for migrating state between different versions. - Added StateTransformation utilities for transforming and filtering state data. - Included StateDiagnostics for providing diagnostic information about state files and health.
| ) | ||
| from swarms.structs.agent_roles import agent_roles | ||
| from swarms.structs.agent_state_manager import AgentStateManager | ||
| from swarms.structs.agent_state_recovery import ( |
Check failure
Code scanning / Pyre
Parsing failure Error
|
|
||
| # Check for empty state | ||
| if health["is_empty"]: | ||
| health["warnings"].append("State is empty") |
Check failure
Code scanning / Pyre
Undefined attribute Error
|
|
||
| # Check for large state | ||
| stats = health["statistics"] | ||
| if stats["estimated_size_bytes"] > 100 * 1024 * 1024: # 100MB |
Check failure
Code scanning / Pyre
Undefined attribute Error
| # Check for large state | ||
| stats = health["statistics"] | ||
| if stats["estimated_size_bytes"] > 100 * 1024 * 1024: # 100MB | ||
| health["warnings"].append( |
Check failure
Code scanning / Pyre
Undefined attribute Error
| if stats["estimated_size_bytes"] > 100 * 1024 * 1024: # 100MB | ||
| health["warnings"].append( | ||
| f"State is very large: " | ||
| f"{stats['estimated_size_bytes'] / 1024 / 1024:.2f}MB" |
Check failure
Code scanning / Pyre
Undefined attribute Error
| try: | ||
| result = validator_func(state) | ||
| if not result: | ||
| health["errors"].append( |
Check failure
Code scanning / Pyre
Undefined attribute Error
| ) | ||
| health["is_valid"] = False | ||
| except Exception as e: | ||
| health["errors"].append( |
Check failure
Code scanning / Pyre
Undefined attribute Error
|
@ZackBradshaw already done |
resolves #1270
📚 Documentation preview 📚: https://swarms--1303.org.readthedocs.build/en/1303/