from a1 import Context, Runtime
# Auto-save context on every change
ctx = Context.from_file("chat.json", keep_updated=True)
ctx.user("Hello") # Automatically saved
# Load context
ctx = Context.from_file("chat.json")
# Auto-save entire runtime and all contexts
runtime = Runtime.from_file("session.json", keep_updated=True)
with runtime:
ctx = get_context("main")
ctx.user("Hello") # All contexts auto-saved to session.json
# Load runtime with all contexts restored
runtime = Runtime.from_file("session.json")