Getting started
5-minute quickstart
Save one verified outcome in Session A, start a completely new process, and prove Session B resumes from that evidence.
What you will build
Session A saves one verified fact about Acme. Then you start a new Python process with no Session A chat history. Session B recovers the same fact from MAGLA Memory.
Time: about 5 minutes · You need: Python 3.10+, terminal, free project · You do not need: Docker, a database, a local server or a card.
1. Create a project and copy the key
Use the project form. The secret key is shown once.
export MAGLA_MEMORY_API_KEY='mmc1.…' export MAGLA_MEMORY_BASE_URL='https://magla-memory.5-180-47-236.sslip.io'
2. Check the service
curl -sS "$MAGLA_MEMORY_BASE_URL/v1/status" \ -H "Authorization: Bearer $MAGLA_MEMORY_API_KEY" \ | python3 -m json.tool
Look for "ready": true, "product": "MAGLA Memory" and your project_id.
3. Download the Python client
curl -fsS "$MAGLA_MEMORY_BASE_URL/sdk/python" -o magla_memory.py
4. Session A — save the result
import os
from magla_memory import Memory
BASE_URL = os.environ.get(
"MAGLA_MEMORY_BASE_URL",
"https://magla-memory.5-180-47-236.sslip.io",
)
API_KEY = os.environ["MAGLA_MEMORY_API_KEY"]
SCOPE = "quickstart-acme"
TASK = "Prepare a proposal for Acme"
memory = Memory(API_KEY, base_url=BASE_URL)
work = memory.preflight(TASK, current_context="", limit=5, scope_lock=SCOPE)
if work["resume_from"] is None:
print("SESSION_A_START=fresh")
else:
print("SESSION_A_START=resume")
# Demo fact. In your agent, replace this with a result you just verified.
verified_result = "Acme prefers annual billing and requires SSO."
assert "annual billing" in verified_result and "SSO" in verified_result
saved = memory.record_outcome(
work_receipt=work["work_receipt"],
operation="research Acme requirements",
expected_result="A verified customer requirement is available for the proposal", observed_result=verified_result,
success_state="SUCCEEDED",
bounded_condition="Quickstart demo: only the Acme requirement above is asserted",
evidence_refs=["quickstart://acme/verified-requirement"],
verification_basis="TEST_PASS",
next_action="Draft a proposal with annual billing and SSO",
scope_lock=SCOPE,
)
print("SESSION_A_SAVED=1")
print(f"PERSISTED={str(saved['persisted']).lower()}")
print(f"READBACK_VERIFIED={str(saved['readback_verified']).lower()}")
print(f"OUTCOME_ID={saved['outcome_id']}")
Run PYTHONPATH=. python3 session_a.py. Expect PERSISTED=true and READBACK_VERIFIED=true.
5. Session B — start fresh
import os
from magla_memory import Memory
BASE_URL = os.environ.get(
"MAGLA_MEMORY_BASE_URL",
"https://magla-memory.5-180-47-236.sslip.io",
)
API_KEY = os.environ["MAGLA_MEMORY_API_KEY"]
SCOPE = "quickstart-acme"
memory = Memory(API_KEY, base_url=BASE_URL)
work = memory.preflight(
"Continue the Acme proposal in a new process",
current_context="No chat history from Session A is available.",
limit=5,
scope_lock=SCOPE,
)
checkpoint = work["resume_from"]
if checkpoint is None:
raise SystemExit("No checkpoint found. Run session_a.py first.")
print("SESSION_B_RECOVERED=1")
print("REMEMBERED=" + checkpoint["observed_result"])
print("NEXT=" + checkpoint["next_action"])
Run PYTHONPATH=. python3 session_b.py.
It worked. Session B should print:
REMEMBERED=Acme prefers annual billing and requires SSO. That is the verified operational-continuity proof across processes.If it did not work
AUTH_REQUIRED— missing Bearer header.AUTH_INVALID— malformed, revoked or inactive key.MONTHLY_QUOTA_EXCEEDED— rolling 30-day limit reached.No checkpoint found— Session A did not save a checkpoint first.