# TraconBuilderConversationMemoryExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconbuilderconversationmemoryextensions/
> Summary: TraconBuilderConversationMemoryExtensions: Setup of conversation memory.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Core.dll</code></div>

Setup of conversation memory.

```csharp
public static class TraconBuilderConversationMemoryExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconbuilderconversationmemoryextensions/">TraconBuilderConversationMemoryExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Methods

### <a id="Tracon_TraconBuilderConversationMemoryExtensions_UseConversationMemory_Tracon_ITraconBuilder_System_Action_Tracon_TraconConversationMemoryOptions__"></a> UseConversationMemory\(ITraconBuilder, Action<TraconConversationMemoryOptions\>\)

Sets up conversation memory: an agent whose definition turns on
[MemorySettings.EnableConversationMemory](/api/tracon.memorysettings/#Tracon_MemorySettings_EnableConversationMemory) finds what the same user said in earlier
sessions with that agent and gets it as context.

```csharp
public static ITraconBuilder UseConversationMemory(this ITraconBuilder builder, Action<TraconConversationMemoryOptions> configure)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon configuration chain.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[TraconConversationMemoryOptions](/api/tracon.traconconversationmemoryoptions/)\>

Sets [TraconConversationMemoryOptions.VectorDimensions](/api/tracon.traconconversationmemoryoptions/#Tracon_TraconConversationMemoryOptions_VectorDimensions) and, if you want, the collection name.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The chain, for further configuration.

#### Remarks

Register a `Microsoft.Extensions.VectorData.VectorStore` in the service collection. The
connector package you choose and its embedding model live inside that store; Tracon takes
the store from the container when it compiles an agent that asks for memory, and the build
stops with the missing registration's name if there is none.

A record is scoped by tenant, agent and user, and carries its session. A run with no user, or no
session, neither reads nor writes memory. The store is the host's data: Tracon deletes the records of
a session when the session goes (an erasure of its data subject, `DELETE /api/sessions/{id}`,
or its retention period), but cannot delete what the store keeps for its own reasons, such as backups.

```csharp
builder.AddTracon()
       .UseConversationMemory(options => options.VectorDimensions = 1536);
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` or `configure` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
