Skip to main content

Memory API

Store and retrieve persistent key-value data for your agents. All endpoints require session authentication and ownership of the agent.

Get memory

GET /api/memory?agentId=agent_123

Query parameters

ParameterTypeRequiredDescription
agentIdstringYesID of the agent

Response

{
  "memory": {
    "preferences": { "theme": "dark" },
    "context": "Last conversation was about scheduling"
  },
  "agentId": "agent_123",
  "count": 2,
  "lastUpdated": "2026-03-19T00:00:00Z"
}

Errors

CodeDescription
400agentId query parameter required
401Unauthorized
404Agent not found

Store memory (single key)

POST /api/memory
Write a single key-value pair to agent memory.

Request body

FieldTypeRequiredDescription
agentIdstringYesID of the agent
keystringYesMemory key
memoryanyYesValue to store (max 100 KB)

Response

{
  "success": true,
  "agentId": "agent_123",
  "key": "preferences",
  "saved": "2026-03-19T00:00:00Z"
}

Errors

CodeDescription
400agentId required, memory data required, or value too large (max 100 KB)
401Unauthorized
404Agent not found

Store memory (bulk)

POST /api/memory
Write multiple key-value pairs in a single request.

Request body

FieldTypeRequiredDescription
agentIdstringYesID of the agent
memoryobjectYesObject of key-value pairs to store (max 50 keys)
{
  "agentId": "agent_123",
  "memory": {
    "preferences": { "theme": "dark" },
    "context": "Scheduling discussion"
  }
}

Response

{
  "success": true,
  "agentId": "agent_123",
  "keysUpdated": 2,
  "saved": "2026-03-19T00:00:00Z"
}

Errors

CodeDescription
400agentId required, memory data required, or too many keys (max 50)
401Unauthorized
404Agent not found