SingleStore.AgentFramework
0.1.0
dotnet add package SingleStore.AgentFramework --version 0.1.0
NuGet\Install-Package SingleStore.AgentFramework -Version 0.1.0
<PackageReference Include="SingleStore.AgentFramework" Version="0.1.0" />
<PackageVersion Include="SingleStore.AgentFramework" Version="0.1.0" />
<PackageReference Include="SingleStore.AgentFramework" />
paket add SingleStore.AgentFramework --version 0.1.0
#r "nuget: SingleStore.AgentFramework, 0.1.0"
#:package SingleStore.AgentFramework@0.1.0
#addin nuget:?package=SingleStore.AgentFramework&version=0.1.0
#tool nuget:?package=SingleStore.AgentFramework&version=0.1.0
SingleStore Microsoft Agent Framework integrations
Attention: The code in this repository is intended for experimental use only and is not fully tested, documented, or supported by SingleStore. Visit the SingleStore Forums to ask questions about this repository.
This repository contains SingleStore integrations for the Microsoft Agent Framework.
Add the SingleStore Microsoft Agent Framework integrations NuGet package to your project.
dotnet add package SingleStore.AgentFramework --prerelease
Chat history provider
SingleStoreChatHistoryProvider stores an agent's messages in SingleStore and returns them on the next turn.
You can set it as the agent's chat history provider.
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using SingleStore.AgentFramework;
using var historyProvider = new SingleStoreChatHistoryProvider(
"<Connection String>",
_ => new SingleStoreChatHistoryProvider.State(conversationId),
new SingleStoreChatHistoryProviderOptions
{
MaxMessagesToRetrieve = 20,
});
AIAgent agent = chatClient.AsAIAgent(new ChatClientAgentOptions
{
ChatHistoryProvider = historyProvider,
});
Where <Connection String> is a connection string to the SingleStore instance, in the format that SingleStore .NET Connector expects, for example Host=localhost;Port=3306;Database=db;Username=root;Password=secret.
The database named in the connection string must already exist. The provider creates the table on first use.
The default table name is MAFChatHistory. Set TableName on SingleStoreChatHistoryProviderOptions to use a different table:
new SingleStoreChatHistoryProviderOptions
{
TableName = "MyChatHistory",
}
conversationId identifies the stored conversation.
The key should be unique per conversation: the initializer runs once for each new session that has no state yet, and one provider instance usually serves many sessions.
The same key reads and writes the same history, including when RunAsync is called without a session.
MaxMessagesToRetrieve is the maximum number of messages returned to the agent. Only the newest messages are included.
Leave it unset to return the full history.
ClearMessagesAsync deletes the stored messages for one conversation and returns how many rows were removed.
AgentSession session = await agent.CreateSessionAsync();
int deleted = await historyProvider.ClearMessagesAsync(session);
See SingleStoreChatHistoryProviderSample for a usage example.
Chat history memory
ChatHistoryMemoryProvider stores an agent's messages in a vector index and searches them when answering a later turn. Matching messages from the configured search scope are added to the prompt.
This uses SingleStoreVectorStore from the SingleStore Semantic Kernel connector and ChatHistoryMemoryProvider from Microsoft Agent Framework. Install SingleStore.SemanticKernel, and install Microsoft.Agents.AI when the project does not already reference it. SingleStore.AgentFramework is not required.
dotnet add package SingleStore.SemanticKernel --prerelease
dotnet add package Microsoft.Agents.AI
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using SingleStore.SemanticKernel;
using var vectorStore = new SingleStoreVectorStore(
"<Connection String>",
new SingleStoreVectorStoreOptions
{
EmbeddingGenerator = embeddingGenerator,
});
using var memoryProvider = new ChatHistoryMemoryProvider(
vectorStore,
collectionName: "ChatHistoryMemory",
vectorDimensions: 768,
_ => new ChatHistoryMemoryProvider.State(
storageScope: new() { UserId = userId, SessionId = Guid.NewGuid().ToString("N") },
searchScope: new() { UserId = userId }));
AIAgent agent = chatClient.AsAIAgent(new ChatClientAgentOptions
{
AIContextProviders = [memoryProvider],
});
Where <Connection String> has the same format as for the chat history provider. The database named in the connection string must already exist. The provider creates the ChatHistoryMemory collection on first use.
embeddingGenerator produces the vectors for each message. vectorDimensions must be the number of dimensions that generator returns. 768 matches nomic-embed-text.
storageScope is written onto each stored message. searchScope selects which of those messages a search can return. Both scopes can set any combination of ApplicationId, AgentId, UserId, and SessionId, and only the values you set are used as filters. Leave searchScope unset to search with storageScope.
The example above stores each session separately for one user, and searches every session for that user. A search returns a message only when each value set on searchScope equals the value written from storageScope. Messages stored without AgentId or ApplicationId are left out of a search that sets either field.
See SingleStoreChatHistoryMemorySample for a usage example.
Agent session store
SingleStoreAgentSessionStore stores an agent session in SingleStore so a later request can resume it.
You can pass it to AIHostAgent. The host loads the session for a conversation, runs the agent, and saves the session again. The agent's default in-memory chat history is kept in the session, so saving the session also saves those messages.
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Hosting;
using SingleStore.AgentFramework;
var sessionKey = new AgentSessionStoreKey(conversationId)
.WithPartition("host", "host-identity");
using var store = new SingleStoreAgentSessionStore("<Connection String>", "support-agent", null);
var agent = new AIHostAgent(innerAgent, store, "host-identity");
AgentSession session = await agent.GetOrCreateSessionAsync(sessionKey);
await agent.RunAsync("My name is Alice.", session);
await agent.SaveSessionAsync(sessionKey, session);
Where <Connection String> has the same format as for the chat history provider. The database named in the connection string must already exist. The store creates the table on first use.
The default table name is MAFAgentSession. Set TableName on SingleStoreAgentSessionStoreOptions to use a different table:
new SingleStoreAgentSessionStoreOptions
{
TableName = "MyAgentSessions",
}
"support-agent" is the store namespace. Keep it the same across restarts, because the stored sessions are keyed by it. Each store instance serves one namespace.
conversationId identifies one conversation. "host-identity" is a partition of sessionKey. The store does not read the identity passed to AIHostAgent, so get, save, and delete all use sessionKey. A different conversation id or host partition addresses a different session.
DeleteSessionAsync removes the stored session for that key. A missing session is left unchanged:
await store.DeleteSessionAsync(agent, sessionKey);
See SingleStoreAgentSessionStoreSample for a usage example.
Checkpoint store
SingleStoreCheckpointStore stores workflow checkpoints in SingleStore so a later run can resume from any completed step.
You can wrap it in a CheckpointManager and pass it when running a workflow. The manager automatically writes a checkpoint at the end of each step.
using Microsoft.Agents.AI.Workflows;
using SingleStore.AgentFramework;
using var store = new SingleStoreCheckpointStore("<Connection String>", null);
var checkpointManager = CheckpointManager.CreateJson(store);
// Start a workflow run and collect checkpoints as steps complete
await using StreamingRun run = await InProcessExecution.RunStreamingAsync(
workflow,
input,
checkpointManager,
sessionId);
// Later, resume execution from a saved checkpoint
await using StreamingRun resumed = await InProcessExecution.ResumeStreamingAsync(
workflow,
savedCheckpoint,
checkpointManager);
Where <Connection String> has the same format as for the chat history provider. The database named in the connection string must already exist. The store creates the table on first use.
The default table name is MAFCheckpoint. Set TableName on SingleStoreCheckpointStoreOptions to use a different table:
new SingleStoreCheckpointStoreOptions
{
TableName = "MyCheckpoints",
}
sessionId groups checkpoints that belong to the same workflow run. When rebuilding a workflow for resumption, ensure any agents use the same Id (and Name, if set) so their state maps to the checkpoint.
See SingleStoreCheckpointStoreSample for a usage example.
Agent file store
SingleStoreAgentFileStore stores an agent's files in SingleStore so a later conversation can read them.
You can pass it to FileMemoryProvider. The provider gives the agent tools that write and read those files, and it adds the saved memories to the next turn.
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
using SingleStore.AgentFramework;
const string workingFolder = "users/alice";
using var store = new SingleStoreAgentFileStore("<Connection String>", null);
using var fileMemoryProvider = new FileMemoryProvider(
store,
_ => new FileMemoryState { WorkingFolder = workingFolder });
AIAgent agent = chatClient.AsAIAgent(new ChatClientAgentOptions
{
AIContextProviders = [fileMemoryProvider],
});
Where <Connection String> has the same format as for the chat history provider. The database named in the connection string must already exist. The store creates the table on first use.
The default table name is MAFAgentFile. Set TableName on SingleStoreAgentFileStoreOptions to use a different table:
new SingleStoreAgentFileStoreOptions
{
TableName = "MyAgentFiles",
}
workingFolder is the directory the provider uses for storing memories. File names passed to the tools are relative to that folder.
See SingleStoreAgentFileStoreSample for a usage example.
Release process
Releasing a new version takes two steps.
1. Push a version tag
Push a version tag using semantic versioning with a v prefix (v<major>.<minor>.<patch>, for example v1.2.3):
git tag v1.0.1
git push origin v1.0.1
The package version is derived from the tag (the leading v is stripped). This triggers the CI workflow, which:
- Runs the test matrix
- Builds the connector with the release version
- Signs
SingleStore.AgentFramework.dllwith Azure Artifact Signing - Packs the signed assemblies into a NuGet package and publishes it to NuGet.org
- Creates a draft GitHub Release with auto-generated release notes and the package (
SingleStore.AgentFramework.<version>.nupkg)
2. Publish the draft release
After the workflow succeeds, open the Releases page, review the draft release for the new tag (edit the notes if needed), and click Publish release.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Microsoft.Agents.AI (>= 1.26.0)
- Microsoft.Agents.AI.Workflows (>= 1.26.0)
- SingleStore.SemanticKernel (>= 0.1.1)
- System.Linq.Async (>= 7.0.1)
-
.NETStandard 2.0
- Microsoft.Agents.AI (>= 1.26.0)
- Microsoft.Agents.AI.Workflows (>= 1.26.0)
- SingleStore.SemanticKernel (>= 0.1.1)
- System.Linq.Async (>= 7.0.1)
-
net10.0
- Microsoft.Agents.AI (>= 1.26.0)
- Microsoft.Agents.AI.Workflows (>= 1.26.0)
- SingleStore.SemanticKernel (>= 0.1.1)
- System.Linq.Async (>= 7.0.1)
-
net8.0
- Microsoft.Agents.AI (>= 1.26.0)
- Microsoft.Agents.AI.Workflows (>= 1.26.0)
- SingleStore.SemanticKernel (>= 0.1.1)
- System.Linq.Async (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 80 | 11/11/2026 |