Skip to content

Conversation

@ZackBradshaw
Copy link
Contributor

@ZackBradshaw ZackBradshaw commented Jan 14, 2026

resolves #1270


📚 Documentation preview 📚: https://swarms--1303.org.readthedocs.build/en/1303/

- 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

Parsing failure [404]: '(' was never closed

# Check for empty state
if health["is_empty"]:
health["warnings"].append("State is empty")

Check failure

Code scanning / Pyre

Undefined attribute Error

Undefined attribute [16]: Item Dict of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute append.

# Check for large state
stats = health["statistics"]
if stats["estimated_size_bytes"] > 100 * 1024 * 1024: # 100MB

Check failure

Code scanning / Pyre

Undefined attribute Error

Undefined attribute [16]: Item bool of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute __getitem__.
# 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

Undefined attribute [16]: Item Dict of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute append.
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

Undefined attribute [16]: Item bool of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute __getitem__.
try:
result = validator_func(state)
if not result:
health["errors"].append(

Check failure

Code scanning / Pyre

Undefined attribute Error

Undefined attribute [16]: Item Dict of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute append.
)
health["is_valid"] = False
except Exception as e:
health["errors"].append(

Check failure

Code scanning / Pyre

Undefined attribute Error

Undefined attribute [16]: Item Dict of typing.Union[Dict[str, typing.Any], List[typing.Any], bool] has no attribute append.
@kyegomez
Copy link
Owner

@ZackBradshaw already done

@kyegomez kyegomez closed this Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Improve agent saving state and loading in agent.py

2 participants