MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1
Demo130 — Session Persistence
Context survives the first restart and remains empty after reset and restart.
Objectives
- Persist explicit business context and distinguish it from unsaved conversation history.
Prepare the demo
Start at the root of the complete distribution built in Release. Shared projects Maf.Memory and Maf.DemoConnection are required. Answers use live chat without embeddings. Local read, reset, forget and save commands need no generated answer. Demo170 calls chat directly for its comparison.
| Project | Role |
|---|---|
| demos/Demo130_SessionPersistence/Demo130.App.csproj | App |
| shared/Maf.Memory/Maf.Memory.csproj | Shared implementation |
| shared/Maf.DemoConnection/Maf.DemoConnection.csproj | Connection |
Launch from the root
$env:MAF_STATE_ROOT = Join-Path $env:TEMP ('maf-memory-' + [guid]::NewGuid().ToString('N'))dotnet run --project demos/Demo130_SessionPersistence/Demo130.App.csproj -c Release --no-buildModes and procedure
setctx module=Reporting, showctx, quit; restart with the same root, showctx; reset, quit, restart, showctx.
public void Set(string value)
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);
if (value.Length > 4096)
throw new ArgumentException("Context must not exceed 4096 characters.");
Execute("INSERT INTO AgentState(Key, Value) VALUES ('context', $value) ON CONFLICT(Key) DO UPDATE SET Value=excluded.Value;", value);
}
/// <summary>Clears rows transactionally without deleting pooled SQLite files.</summary>
public void Reset() => Execute("DELETE FROM AgentState;");
Results and useful failures
Context survives the first restart and remains empty after reset and restart. setctx replaces the active session; messages are never persisted in AgentState.
These observations are expected from inspecting the linked public code revision. The site lot separately reruns deterministic tests: it does not present an unmeasured generated answer or provider score as observed output.
Persistence and limits
Facts in Demo150/160 and the Demo170 comparison stay in-process. Demo130 retains SQLite context only; Demo140 retains its JSON snapshot. Forgetting one session does not purge other stores or backups. Admission errors remain visible without fallback. Scripted tests alone qualify no model.
dotnet test tests/Maf.Memory.Tests/Maf.Memory.Tests.csproj -m:1 -c Release --no-build --no-restore