Use the DeleteMemory interface to delete a single long-term memory.
Prerequisites
-
An AgentStorage instance has been created and is in the
normalstate, and the instance endpoint and instance name have been obtained. -
An API Key has been created.
-
Scope rule:
scopeis optional. When provided, all four fields (appId,tenantId,agentId, andrunId) are required, and the wildcard*is not allowed.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The name of the memory store. |
|
|
string |
Yes |
The memory ID. |
|
|
object |
No |
The optional full Scope used to verify memory ownership. When provided, all four fields are required, and the wildcard |
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>/DeleteMemory \
-H "x-ots-instancename: <instance-name>" \
-H "x-ots-apikey: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"memoryStoreName":"agent_memory","memoryId":"<memory-id>","scope":{"appId":"app-001","tenantId":"user-001","agentId":"assistant","runId":"session-001"}}'
Response
|
Field |
Description |
|
|
Whether the deletion succeeded. |
|
|
The ID of the deleted memory. |
|
|
The name of the memory store. |
{
"deleted": true,
"memoryId": "1b88d0d65a5b6c0d9142e9b7c7347048",
"memoryStoreName": "agent_memory"
}