Skip to main content

Fixed: MAAI001 'Microsoft.Agents.AI.AgentSessionStore' is for evaluation purposes only

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I wrote a durable session store for a Microsoft Agent Framework agent, and the build failed: error MAAI001: 'Microsoft.Agents.AI.AgentSessionStore' is for evaluation purposes only and is subject to change or removal in future updates. In Agent Framework 1.28, AgentSessionStore and its key are experimental. Suppressing MAAI001 in the store's own file agrees to that, and the store compiles.

What I Was Doing​

I was keeping an agent's conversations in Azure Cosmos DB (Part 15: Persistent Conversations). Agent Framework's hosting layer saves and loads conversations through an AgentSessionStore, and Microsoft's self-hosting documentation says to write your own for production. To show the error on its own, I repeated it in a new console app with the smallest store I could write, one that keeps each session's JSON in memory:

Terminal
dotnet new console -n SessionStoreCheck
cd SessionStoreCheck
dotnet add package Microsoft.Agents.AI --version 1.28.0
Program.cs
using System.Collections.Concurrent;
using System.Text.Json;
using Microsoft.Agents.AI;

Console.WriteLine("The session store compiles.");

/// <summary>A session store that keeps each session's JSON in memory, by agent and key.</summary>
public sealed class MemorySessionStore : AgentSessionStore
{
private readonly ConcurrentDictionary<(string AgentId, AgentSessionStoreKey Key), JsonElement> sessions = new();

public override async ValueTask SaveSessionAsync(
AIAgent agent, AgentSessionStoreKey key, AgentSession session, CancellationToken cancellationToken = default) =>
sessions[(agent.Id, key)] = await agent.SerializeSessionAsync(session, cancellationToken: cancellationToken);

public override async ValueTask<AgentSession?> GetSessionAsync(
AIAgent agent, AgentSessionStoreKey key, CancellationToken cancellationToken = default) =>
sessions.TryGetValue((agent.Id, key), out JsonElement json)
? await agent.DeserializeSessionAsync(json, cancellationToken: cancellationToken)
: null;

public override ValueTask DeleteSessionAsync(
AIAgent agent, AgentSessionStoreKey key, CancellationToken cancellationToken = default)
{
sessions.TryRemove((agent.Id, key), out _);
return ValueTask.CompletedTask;
}
}
Terminal
dotnet build

What I Expected​

A successful build. The self-hosting documentation shows the same three methods and doesn't mention a diagnostic.

What I Got​

Five errors, one for each place the code names AgentSessionStore or AgentSessionStoreKey:

Output
Restore complete (0.3s)
SessionStoreCheck net10.0 failed with 5 error(s) (1.4s)
/Users/you/source/SessionStoreCheck/Program.cs(8,42): error MAAI001: 'Microsoft.Agents.AI.AgentSessionStore' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/SessionStoreCheck/Program.cs(13,24): error MAAI001: 'Microsoft.Agents.AI.AgentSessionStoreKey' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/SessionStoreCheck/Program.cs(17,24): error MAAI001: 'Microsoft.Agents.AI.AgentSessionStoreKey' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/SessionStoreCheck/Program.cs(23,24): error MAAI001: 'Microsoft.Agents.AI.AgentSessionStoreKey' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
/Users/you/source/SessionStoreCheck/Program.cs(10,60): error MAAI001: 'Microsoft.Agents.AI.AgentSessionStoreKey' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Build failed with 5 error(s) in 2.1s

macOS-style terminal window titled Terminal — SessionStoreCheck showing dotnet build failing with five MAAI001 errors in Program.cs: Microsoft.Agents.AI.AgentSessionStore and Microsoft.Agents.AI.AgentSessionStoreKey are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed

What I Checked​

Where the errors point. At the base class and at every parameter of type AgentSessionStoreKey. The errors are about the two types themselves, so any store hits them.

Whether there's another way. WithSessionStore, which gives a hosted agent its store, takes an AgentSessionStore. A durable store has to derive from it, and Microsoft's documentation is plain about it: MAF doesn't include a general-purpose durable session store.

What Agent Framework's documentation says about MAAI001. Agent Framework marks experimental APIs with [Experimental("MAAI001")]. Its documentation on declarative workflows, which use another of them, says: Suppress the diagnostic at the call site or in your project file, with <NoWarn>$(NoWarn);MAAI001</NoWarn>.

What .NET says about experimental APIs. The .NET documentation on experimental features: To express consent to using an experimental feature, you suppress the specific diagnostic, and When you suppress the warning, you acknowledge that the API shape or functionality might change in the next major release. It recommends <NoWarn> and adds that Since each experimental feature has a separate ID, consenting to using one experimental feature doesn't consent to using another. Agent Framework doesn't give each experimental API its own ID: the store, its key and the declarative workflows' JSON options all report MAAI001. A project-wide <NoWarn> agrees to every API that reports it.

Why It Happens​

AgentSessionStore and AgentSessionStoreKey are marked experimental in Microsoft.Agents.AI.Abstractions 1.28.0. Code that uses an experimental API doesn't compile until you agree, by suppressing the diagnostic, that the API can change or be removed.

The Fix​

Suppress MAAI001 at the top of the file that holds the store, and say why:

Program.cs (the first lines)
// AgentSessionStore is experimental in Agent Framework 1.28 (MAAI001): I accept that it can change.
#pragma warning disable MAAI001

using System.Collections.Concurrent;
using System.Text.Json;
using Microsoft.Agents.AI;

The consent covers this file only. Another file that uses a different experimental Agent Framework API still gets the error, so you agree to each one where you use it.

Or in the project file​

<NoWarn> in the project file works too, and it's the way the .NET documentation recommends:

SessionStoreCheck.csproj (in the PropertyGroup)
<NoWarn>$(NoWarn);MAAI001</NoWarn>

I built the store both ways, and both compiled. With <NoWarn>, though, the project agrees to every Agent Framework API that reports MAAI001, including ones you add later without noticing.

After the Fix​

Output
Restore complete (0.2s)
SessionStoreCheck net10.0 succeeded (1.1s) → bin/Debug/net10.0/SessionStoreCheck.dll

Build succeeded in 1.6s

macOS-style terminal window titled Terminal — SessionStoreCheck showing dotnet build succeeding after the pragma, and dotnet run printing The session store compiles.

Common Mistakes​

MistakeWhat happensDo this instead
Suppressing MAAI001 for the whole project without thinking about itYou agree to every Agent Framework API that reports MAAI001, not only the storeSuppress it in the store's file
Suppressing every warning with #pragma warning disable and no IDReal warnings in that file disappear tooName the ID: #pragma warning disable MAAI001
Upgrading Agent Framework without reading the release notesAn experimental API can change, and your store with itRead the release notes of every update

Troubleshooting​

SymptomLikely causeFix
error MAAI001: 'Microsoft.Agents.AI.AgentSessionStore' is for evaluation purposes onlyThe class derives from an experimental type#pragma warning disable MAAI001 in that file
The same error for AgentSessionStoreKey, in another fileThe pragma covers one file onlyAdd it to every file that uses the key, or keep those files few

FAQ​

Is it safe to use an experimental API in production?​

It works, but it can change in a later version, and that's what you agree to. Keep the code that uses it in one place, as a single store class does, so a change touches one file.

Does the in-memory store need the suppression?​

No. WithInMemorySessionStore() creates Agent Framework's own store, and your code never names the experimental types.

Conclusion​

MAAI001 on AgentSessionStore means that the session store API is experimental in Agent Framework 1.28, and there's no other way to give the hosting layer a durable store. Suppress MAAI001 in the file that holds your store, with a comment that says why. A project-wide <NoWarn> works too, but it agrees to every Agent Framework API that reports MAAI001 at once.

Additional Resources​