Use the CreateMemoryStore interface to create a memory store in the current AgentStorage instance.
Prerequisites
-
An AgentStorage instance has been created and is in the
normalstate, and you have obtained the instance endpoint and instance name. -
An API Key has been created.
-
Before creation, plan the combination of input and output types.
inputTypecannot be modified after creation.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The name of the memory store. It can only contain letters, digits, and underscores, with a maximum of 32 characters. |
|
|
string |
No |
The description of the memory store, with a maximum of 1024 bytes (UTF-8). |
|
|
string |
No |
Custom memory extraction instructions, with a maximum of 4096 characters. |
|
|
string |
Conditionally required |
The input type: |
|
|
array |
Conditionally required |
The set of output types, whose elements are |
|
|
string |
No |
Compatibility field: |
The supported input and output combinations are as follows.
|
|
|
Description |
|
|
|
Generate structured memory from messages. |
|
|
|
Generate read-only memory files from messages. |
|
|
|
Generate both structured memory and read-only memory files. |
|
|
|
The application directly manages memory files. |
When no type field is provided, for compatibility with existing calls, a memory store with messages input and structured output is created by default.
Request example
When using API Key authentication, pass the instance name and API Key through the x-ots-instancename and x-ots-apikey request headers.
curl -X POST https://<endpoint>/CreateMemoryStore \
-H "x-ots-instancename: <instance-name>" \
-H "x-ots-apikey: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"memoryStoreName": "agent_memory",
"description": "Agent conversation memory store",
"extractInstructions": "Focus on the user's dietary preferences and travel habits",
"inputType": "messages",
"outputTypes": ["structured", "file"]
}'
Create a memory store whose files are directly managed by the application:
{
"memoryStoreName": "agent_files",
"inputType": "file",
"outputTypes": ["file"]
}
Response
{
"otsInstance": "your-instance-name",
"memoryStoreName": "agent_memory",
"description": "Agent conversation memory store",
"extractInstructions": "Focus on the user's dietary preferences and travel habits",
"inputType": "messages",
"outputTypes": ["structured", "file"],
"createdAt": "2026-08-31T07:19:48.935Z",
"updatedAt": "2026-08-31T07:19:48.935Z"
}
For a memory store created with the new type fields, the response does not return storageMode. When created with the compatibility field, the response returns the normalized inputType, outputTypes, and storageMode together.