Constructor UserScopedMemory
UserScopedMemory(AgentMemory, string)
Initializes a new instance of the UserScopedMemory class.
public UserScopedMemory(AgentMemory sharedMemory, string userId)
Parameters
sharedMemoryAgentMemoryThe shared AgentMemory instance that stores all users' data.
userIdstringA unique identifier for the user. This value is used to namespace data source identifiers and must not contain the
"::"separator.
Examples
Example: Creating a user-scoped memory
var sharedMemory = new AgentMemory(embeddingModel);
var userMemory = new UserScopedMemory(sharedMemory, "user_42");
Exceptions
- ArgumentNullException
Thrown when
sharedMemoryoruserIdisnull.- ArgumentException
Thrown when
userIdis empty, whitespace, or contains the reserved"::"separator.