Crash Recovery
Save execution state to disk so you can resume from where you left off after a crash. Optional and off by default.
Setup
recovery.py
from veska import RecoveryManager
recovery = RecoveryManager(enabled=True)
recovery.set_storage_dir("./savepoints")SavePoint
A SavePoint captures the full execution state:
python
SavePoint(
plan_data: dict, # The execution plan
task_states: dict[str, dict], # Status of each task
agent_memories: dict[str, dict], # Agent memory snapshots
shared_memory: dict, # Shared memory snapshot
metadata: Optional[dict] = None, # Extra data
)
# Properties
savepoint.id # Unique identifier
savepoint.created_at # TimestampSaving state
save.py
savepoint = recovery.save(
plan_data=orchestrator.task_planner.get_all_tasks(),
task_states=current_task_states,
agent_memories=agent_memory_snapshots,
shared_memory=shared_memory_snapshot,
metadata={"prompt": "Build a blog app"},
)Loading state
load.py
# Load the most recent savepoint
savepoint = recovery.load_latest()
if savepoint:
print(f"Resuming from {savepoint.id}")
# Restore plan, task states, memories...
else:
print("No savepoint found, starting fresh")Custom storage
custom.py
# Use your own database for savepoints
def save_to_db(savepoint):
db.insert("savepoints", savepoint.to_dict())
def load_from_db():
data = db.get_latest("savepoints")
return SavePoint.from_dict(data) if data else None
recovery.set_save_callback(save_to_db)
recovery.set_load_callback(load_from_db)With Orchestrator
orch.py
orchestrator = Orchestrator(
model="claude-sonnet-4-6",
agents=[dev_agent],
recovery={"enabled": True, "storage_dir": "./savepoints"},
)
# Savepoints are created automatically at checkpoints