{
  "id": "developer-guide",
  "title": "Build with Redis Agent Memory",
  "url": "https://redis.io/docs/latest/develop/ai/context-engine/agent-memory/developer-guide/",
  "summary": "API reference, SDK examples, and language-specific guides for building with Redis Agent Memory.",
  "tags": [
    "docs",
    "develop",
    "ai"
  ],
  "last_updated": "2026-07-17T17:01:49-05:00",
  "page_type": "content",
  "content_hash": "e7f710508cf1d2dcb7fe6dcb68fd098346583b6f4e6e82d4581a4c644339d156",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Everything you need to start building with Redis Agent Memory — REST API reference, SDK examples, and language-specific guides.\n\n<div class=\"grid grid-cols-1 md:grid-cols-3 gap-6 my-8\">\n  \n  \n  \n</div>"
    },
    {
      "id": "what-you-can-build",
      "title": "What you can build",
      "role": "content",
      "text": "Redis Agent Memory gives your agents a two-tier memory layer available via REST API and Python SDK:\n\n<ul class=\"my-4 space-y-2\">\n  <li class=\"flex gap-3\"><span class=\"text-redis-red-500 font-bold mt-0.5\">&#9679;</span><span><strong>Session memory</strong> — Store the current conversation as a sequence of events. Query by session ID to reconstruct context for the next agent turn.</span></li>\n  <li class=\"flex gap-3\"><span class=\"text-redis-red-500 font-bold mt-0.5\">&#9679;</span><span><strong>Long-term memory</strong> — Automatically extract and persist important facts, preferences, and patterns from session events. Search semantically to retrieve what's relevant.</span></li>\n  <li class=\"flex gap-3\"><span class=\"text-redis-red-500 font-bold mt-0.5\">&#9679;</span><span><strong>Multi-session recall</strong> — Retrieve memories across sessions and users using semantic search, with filtering by session, owner, namespace, topic, and memory type.</span></li>\n  <li class=\"flex gap-3\"><span class=\"text-redis-red-500 font-bold mt-0.5\">&#9679;</span><span><strong>Direct memory writes</strong> — Bulk-create long-term memories from external sources without going through a session, for importing existing knowledge.</span></li>\n</ul>"
    },
    {
      "id": "api-quick-start",
      "title": "API quick start",
      "role": "content",
      "text": "**1. Add a session event** — store a conversation turn in short-term memory:\n\n[code example]\n\nAgent Memory automatically promotes important information (like preferences) to long-term memory in the background.\n\n**2. Search long-term memory** — retrieve relevant context before the next agent response:\n\n[code example]\n\nSee the full [API and SDK examples](https://redis.io/docs/latest/develop/ai/context-engine/agent-memory/api-examples) for all endpoints, including session retrieval, memory deletion, and search filters."
    },
    {
      "id": "language-guides",
      "title": "Language guides",
      "role": "content",
      "text": "The guides below show how to implement agent memory patterns **directly using Redis client libraries** — without the managed Agent Memory service. This is a good option if you prefer to self-host, want full control over the implementation, or are using a language that doesn't yet have an Agent Memory SDK. For the managed service, use the [REST API](https://redis.io/docs/latest/develop/ai/context-engine/agent-memory/api-examples) from any language.\n\n\nStep-by-step examples for building agent memory into your application using your preferred Redis client library:\n\n- [Python (redis-py)](https://redis.io/docs/latest/develop/use-cases/agent-memory/redis-py)\n- [Node.js (node-redis)](https://redis.io/docs/latest/develop/use-cases/agent-memory/nodejs)\n- [Go](https://redis.io/docs/latest/develop/use-cases/agent-memory/go)\n- [Java (Jedis)](https://redis.io/docs/latest/develop/use-cases/agent-memory/java-jedis)\n- [Java (Lettuce)](https://redis.io/docs/latest/develop/use-cases/agent-memory/java-lettuce)\n- [.NET](https://redis.io/docs/latest/develop/use-cases/agent-memory/dotnet)\n- [PHP](https://redis.io/docs/latest/develop/use-cases/agent-memory/php)\n- [Ruby](https://redis.io/docs/latest/develop/use-cases/agent-memory/ruby)\n- [Rust](https://redis.io/docs/latest/develop/use-cases/agent-memory/rust)"
    },
    {
      "id": "set-up-authentication",
      "title": "Set up authentication",
      "role": "content",
      "text": "All API calls require an Agent Memory API key and a Store ID. Pass the key as a Bearer token and the store ID as a path parameter:\n\n[code example]\n\nTo get your API endpoint, key, and Store ID, see [Create an Agent Memory service](https://redis.io/docs/latest/operate/rc/context-engine/agent-memory/create-service)."
    }
  ],
  "examples": [
    {
      "id": "api-quick-start-ex0",
      "language": "json",
      "code": "POST /v1/stores/{storeId}/session-memory/events\n{\n    \"sessionId\": \"session-abc\",\n    \"actorId\": \"user-123\",\n    \"role\": \"USER\",\n    \"content\": [{ \"text\": \"I prefer vegetarian restaurants.\" }],\n    \"createdAt\": \"2026-06-01T10:00:00Z\"\n}",
      "section_id": "api-quick-start"
    },
    {
      "id": "api-quick-start-ex1",
      "language": "json",
      "code": "POST /v1/stores/{storeId}/long-term-memory/search\n{\n    \"text\": \"user dietary preferences\",\n    \"filter\": {\n        \"ownerId\": { \"eq\": \"user-123\" }\n    }\n}",
      "section_id": "api-quick-start"
    },
    {
      "id": "set-up-authentication-ex0",
      "language": "sh",
      "code": "curl -X POST \"https://$HOST/v1/stores/$STORE_ID/session-memory/events\" \\\n    -H \"Authorization: Bearer $API_KEY\" \\\n    -H \"Content-Type: application/json\" \\\n    -d '{ ... }'",
      "section_id": "set-up-authentication"
    }
  ]
}
