e-naxosMAF COURSE / COURS
Français

MICROSOFT AGENT FRAMEWORK · 0.16.0-rc.1

Demo140 — Native Session

The snapshot loads automatically and saves after answers.

Objectives

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.

Projects
ProjectRole
demos/Demo140_NativeSession/Demo140.App.csprojApp
shared/Maf.Memory/Maf.Memory.csprojShared implementation
shared/Maf.DemoConnection/Maf.DemoConnection.csprojConnection

Launch from the root

$env:MAF_STATE_ROOT = Join-Path $env:TEMP ('maf-memory-' + [guid]::NewGuid().ToString('N'))
dotnet run --project demos/Demo140_NativeSession/Demo140.App.csproj -c Release --no-build

Modes and procedure

Send module=Reporting, wait for a successful answer, save, quit; restart, ask Which module did we discuss? Then forget, quit, restart, load.

public async Task<AgentSession> LoadOrCreateAsync(AIAgent agent, CancellationToken cancellationToken = default)
{
    if (!File.Exists(path))
        return await agent.CreateSessionAsync(cancellationToken);
    var envelope = JsonSerializer.Deserialize<Envelope>(await File.ReadAllTextAsync(path, cancellationToken))
        ?? throw new InvalidDataException("Empty session envelope.");
    if (envelope.Version != 1 || envelope.InstructionVersion != instructionVersion)
        throw new InvalidDataException("Session version or instruction version mismatch. Reset explicitly.");
    return await agent.DeserializeSessionAsync(envelope.Session, cancellationToken: cancellationToken);

shared/Maf.Memory/StateStorage.cs · L79–L87 · 9a895c94534c

Source code · Maf.Memory · Folder

Results and useful failures

The snapshot loads automatically and saves after answers. forget deletes the file and replaces the session. newsession also destroys the snapshot: load does not recover an earlier save after that command.

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

Continue and verify

Prerequisites

Continue reading

Complete demo folder · README

lot008-memory-rag-1 · 2026-10-24 · 9a895c94534cd5fc6f3da883e37e5f7856e588c1