Skip to main content
POST
/
product
/
add
Add memories
curl --request POST \
  --url https://api.example.com/product/add \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": "<string>",
  "session_id": "<string>",
  "task_id": "<string>",
  "writable_cube_ids": [
    "<string>"
  ],
  "async_mode": "async",
  "mode": "fast",
  "custom_tags": [
    "<string>"
  ],
  "info": {},
  "messages": "<string>",
  "chat_history": [
    {
      "content": "<string>",
      "role": "<string>",
      "name": "<string>",
      "chat_time": "<string>",
      "message_id": "<string>"
    }
  ],
  "is_feedback": false,
  "mem_cube_id": "<string>",
  "memory_content": "<string>",
  "doc_path": "<string>",
  "source": "<string>",
  "operation": [
    {
      "permissions": [
        "read"
      ],
      "mem_cube_id": "<string>"
    }
  ]
}
'
{
  "message": "<string>",
  "code": 200,
  "data": [
    "<unknown>"
  ]
}

Body

application/json

Request model for creating memories.

user_id
string

User ID

session_id
string | null

Session ID. If not provided, a default session will be used.

task_id
string | null

Task ID for monitering async tasks

writable_cube_ids
string[] | null

List of cube IDs user can write for multi-cube add

async_mode
enum<string>
default:async

Whether to add memory in async mode. Use 'async' to enqueue background add (non-blocking), or 'sync' to add memories in the current call. Default: 'async'.

Available options:
async,
sync
mode
enum<string> | null

(Internal) Add mode used only when async_mode='sync'. If set to 'fast', the handler will use a fast add pipeline. Ignored when async_mode='async'.

Available options:
fast,
fine
custom_tags
string[] | null

Custom tags for this add request, e.g. ['Travel', 'family']. These tags can be used as filters in search.

info
Info · object

Additional metadata for the add request. All keys can be used as filters in search. Example: {'agent_id': 'xxxxxx', 'app_id': 'xxxx', 'source_type': 'web', 'source_url': 'https://www.baidu.com', 'source_content': '西湖是杭州最著名的景点'}.

messages

List of messages to store. Supports: - system / user / assistant messages with 'content' and 'chat_time'; - tool messages including: * tool_description (name, description, parameters), * tool_input (call_id, name, argument), * raw tool messages where content is str or list[str], * tool_output with structured output items (input_text / input_image / input_file, etc.). Also supports pure input items when there is no dialog.

chat_history
(ChatCompletionSystemMessageParam · object | ChatCompletionUserMessageParam · object | ChatCompletionAssistantMessageParam · object | ChatCompletionToolMessageParam · object)[] | null

Historical chat messages used internally by algorithms. If None, internal stored history will be used; if provided (even an empty list), this value will be used as-is.

is_feedback
boolean
default:false

Whether this request represents user feedback. Default: False.

mem_cube_id
string | null

(Deprecated) Target cube ID for this add request (optional for developer API).

memory_content
string | null

(Deprecated) Plain memory content to store. Prefer using messages.

doc_path
string | null

(Deprecated / internal) Path to document to store.

source
string | null

(Deprecated) Simple source tag of the memory. Prefer using info.source_type / info.source_url.

operation
PermissionDict · object[] | null

(Internal) Operation definitions for multi-cube write permissions.

Response

Successful Response

Response model for memory operations.

message
string
required

Response message

code
integer
default:200

Response status code

data
any[] | null

Response data