Skip to Content

Interface WriteResult

What MemoryOperations.createMemory and MemoryOperations.enrichMemory return.

A write is accepted asynchronously, so this addresses the operation rather than the memory it will become. There is no idx to read here, and a revert issued straight away can report RevertOutcome.NOT_FOUND because ingestion has not finished.

operationId is null when the write was accepted but no id could be minted: the content is worth more than the ability to undo it, so that degrades the write rather than rejecting it. MemoryOperations.revertMemory takes a string, so narrow it rather than asserting — a null fed back in is refused locally as a blank operation_id, which is a confusing way to be told the write was fine.

const written = await session.createMemory({
query: 'how do I authenticate against the memory API',
title: 'The Bearer prefix is case-sensitive',
content: 'A lowercase bearer is rejected with UNAUTHENTICATED.'
})
if (written.operationId !== null) {
await session.revertMemory(written.operationId)
}
interface WriteResult {
    operationId: string | null;
    instructions: Instructions;
}
Index
operationId: string | null

The handle revertMemory undoes, or null if the write cannot be undone.

instructions: Instructions

What the service asks the caller to do next.