Spaces method and path for this operation:
Refer to Spaces for more information.
Writes one memory to the session memory store. Pass id to revise an existing memory. The revision replaces the memory in full.
Returns 202 with the memory id and writes the memory in the background, because semantic indexing runs inside the write. The memory becomes searchable after the background write completes.
Requires the contextEngine:write privilege. Without user_id, the route writes the memory for the caller's user profile, and a caller without a user profile gets a 403. Naming another user in user_id also requires contextEngine:manage_memory.
Each AI index in ai_index_ids must exist in this space, and the caller requires the Elasticsearch write privilege on its backing index. Otherwise, the route rejects the request and writes nothing.
After authorization, validation, and feature-flag checks pass, the route writes one memory_remember audit event per request, when the background write finishes or when it rejects the request. The route does not report a failed background write in the response. Instead, it logs the error to the Kibana logs and writes a failure audit event.
Returns a 404 response when Context Engine is turned off in this space (contextEngine:enabled), when memory is turned off (contextEngine:memoryEnabled), or when an AI index in ai_index_ids does not exist.
For more information, refer to the Context Engine documentation.
[Required authorization] Route required privileges: contextEngine:write. Extended privileges (optional, expand functionality when granted): contextEngine:manage_memory.
Body
-
The AI indices that dreaming promotes the memory into. Each must exist in this space, and the caller requires the Elasticsearch
writeprivilege on its backing index.Not more than
100elements. Minimum length of each is1, maximum length of each is256. -
String hints about the memory for dreaming. Accepts up to 50 entries, with non-blank keys of 1 to 256 characters.
-
The memory text. Elasticsearch indexes this field for semantic search.
Minimum length is
1, maximum length is65536. -
The id of an existing memory to revise. The revision replaces the memory in full, and the route does not check whether the id exists. Omit this field to generate a new id.
Minimum length is
1, maximum length is256. -
The session the memory comes from.
Minimum length is
1, maximum length is256. -
The Kibana user profile UID that the memory belongs to. Omit this field to use the caller's user profile. Naming another user requires
contextEngine:manage_memory.Minimum length is
1, maximum length is1024.
Responses
-
The route accepted the memory and is writing it in the background. It becomes searchable after the write completes.
-
user_idis missing and the caller has no user profile,user_idnames another user and the caller lackscontextEngine:manage_memory, or the caller cannot write to one of the AI indices. -
Context Engine or memory is turned off, or an AI index does not exist.
curl \
-X POST "https://${KIBANA_URL}/api/context_engine/memory/_remember" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "Content-Type: application/json" \
-H "kbn-xsrf: true" \
-d '{
"session_id": "8f3c2a1e",
"ai_index_ids": ["ops-memory"],
"content": "checkout-service latency alert fired. Root cause is a connection pool limit after the 3.2 deploy.",
"attributes": { "incident": "INC-4211" }
}'
POST kbn:/api/context_engine/memory/_remember
{
"session_id": "8f3c2a1e",
"ai_index_ids": ["ops-memory"],
"content": "checkout-service latency alert fired. Root cause is a connection pool limit after the 3.2 deploy.",
"attributes": { "incident": "INC-4211" }
}
{
"ai_index_ids": [
"ops-memory"
],
"attributes": {
"incident": "INC-4211"
},
"content": "checkout-service latency alert fired. Root cause is a connection pool limit after the 3.2 deploy.",
"session_id": "8f3c2a1e"
}
{
"ai_index_ids": [
"ops-memory"
],
"attributes": {
"incident": "INC-4211"
},
"content": "checkout-service latency alert fired. Root cause is a connection pool limit after the 3.2 deploy; mitigated by raising max_connections to 200.",
"id": "7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10",
"session_id": "8f3c2a1e"
}
{
"id": "7c1f0b2e-5a43-4b0e-9a57-2f0f6f1d3a10"
}
{
"error": "Forbidden",
"message": "AI index 'ops-memory' is not writable. Writing to it needs the Elasticsearch 'write' privilege on its backing index.",
"statusCode": 403
}
{
"error": "Forbidden",
"message": "Acting on the memory of another user requires the [contextEngine:manage_memory] privilege.",
"statusCode": 403
}
{
"error": "Forbidden",
"message": "The caller has no user profile, so the request cannot be attributed to a user. Log in to Kibana once to create a profile, use an API key whose owner has one, or set `user_id` if you have the `contextEngine:manage_memory` privilege.",
"statusCode": 403
}
{
"error": "Not Found",
"message": "AI index 'ops-memory' not found",
"statusCode": 404
}
{
"error": "Not Found",
"message": "Not Found",
"statusCode": 404
}
{
"error": "Not Found",
"message": "Context Engine memory is turned off.",
"statusCode": 404
}