Skip to main content

Write Memory

POST/agent/memory/write

Store a memory in the knowledge base. The memory pipeline automatically:

  1. Classifies the memory type
  2. Runs guard checks (conflict detection & quality scoring)
  3. Extracts entities and relationships
  4. Builds/updates the knowledge graph
  5. Stores the vector embedding

Requestโ€‹

Headersโ€‹

HeaderValue
AuthorizationBearer sm_agent_...
Content-Typeapplication/json

Body Parametersโ€‹

contentstringrequired
The memory content to store (1โ€“50,000 characters).
volume_idstring (UUID)required
Target volume to write the memory into.
memory_typeenum
Optional. One of: factual, preference, event, relationship, technical, episodic, procedural. Auto-detected if omitted.

Responseโ€‹

200 Memory stored successfully

{
"status": "approved",
"reason": "New factual information about John Smith's role",
"confidence": 0.92,
"memory_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"agent": "my-agent",
"volume_id": "..."
}
FieldDescription
statusapproved โ€” stored ยท rejected โ€” blocked by guard ยท merged โ€” merged with existing
reasonHuman-readable explanation of the guard decision
confidence0โ€“1 confidence score from the guard
memory_idUUID of the stored memory

Exampleโ€‹

curl -X POST https://api.sharedmemory.ai/agent/memory/write \
-H "Authorization: Bearer sm_agent_..." \
-H "Content-Type: application/json" \
-d '{
"content": "John Smith is the CTO of Acme Corp. He joined in 2022.",
"volume_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"memory_type": "factual"
}'

Errorsโ€‹

StatusErrorDescription
400validation_failedInvalid input โ€” check details for field-level errors
403agent_not_authorized_for_volumeAgent doesn't have write access to this volume
429Too Many RequestsRate limit exceeded (30/min)
500write_failedInternal error โ€” retry with exponential backoff