MemoryAugmentedAgent<T>

Models & Types · AiDotNet.Agentic.Memory

Wraps any IAgent with long-term memory recall: before each run it searches an IAgentMemoryStore for memories relevant to the latest user message and injects them as context, so the agent answers with knowledge gathered across previous conversations.

Implements: IAgent<T>

For Beginners

Before answering, the assistant flips through its long-term notes, pulls out the ones related to your question, and reads them first — so it can use things it learned in earlier, separate chats. It doesn’t decide on its own what to write down; your app does that.

How It Works

This is retrieval-augmented memory (RAG over the agent’s own remembered facts). It composes with the rest of the stack: the inner agent may be an AgentExecutor, a SupervisorAgent, or a Swarm, and the result can in turn be wrapped by a ThreadedAgent for short-term conversation memory. Writing memories is intentionally explicit (call AddAsync) — this wrapper only reads, so what gets remembered stays under the application’s control.

Constructors

Constructor Summary
MemoryAugmentedAgent(IAgent<T> inner, IAgentMemoryStore memory, MemoryAugmentationOptions options) Initializes a new memory-augmented wrapper.

Properties

Property Summary
string Description { get; }
string Name { get; }

Methods

Method Summary
Task<AgentRunResult> RunAsync(IReadOnlyList<ChatMessage> messages, CancellationToken cancellationToken)