Skip to content

feat: add DakeraMemoryStore (Strands MemoryStore integration) - #1

Merged
ferhimedamine merged 1 commit into
mainfrom
feat/memory-store
Jul 7, 2026
Merged

feat: add DakeraMemoryStore (Strands MemoryStore integration)#1
ferhimedamine merged 1 commit into
mainfrom
feat/memory-store

Conversation

@ferhimedamine

Copy link
Copy Markdown
Contributor

Problem

strands-dakera exposed Dakera only as the dakera_memory tool — the model has to call it explicitly. Strands ≥ 1.45 ships a strands.memory module with a MemoryStore extension point that a MemoryManager drives inside the agent loop: it searches stores to recall context (injected into the prompt automatically) and, when writable, writes new memories — directly or via periodic extraction from the conversation. This adds that second, out-of-the-box integration.

Design

  • DakeraMemoryStore(MemoryStore) (store.py) implements the two methods that matter for a vector-DB-style backend:
    • search(query, options) → Dakera decay-weighted recall, mapped to MemoryEntry (server-side id/score/importance/created_at preserved in metadata). max_search_results precedence: per-call SearchOptions → configured default → 5.
    • add(content, metadata) → a single client-side write sink (store_memory). Because the store implements add (not add_messages), enabling extraction uses the manager's client-side ModelExtractor.
    • add_messages / initialize / get_tools are intentionally left as the inherited Protocol stubs so Strands' _has_method detection reports them as absent (verified in tests).
  • Reuses the existing DakeraServiceClient; the client is built lazily on first use, and now accepts optional base_url / api_key (env fallback unchanged — backward compatible).
  • strands-agents floor bumped >=1.0.0>=1.45.0 (first release exposing strands.memory).

Usage

from strands import Agent
from strands.memory import MemoryManager
from strands_dakera import DakeraMemoryStore

store = DakeraMemoryStore(agent_id="alex", writable=True, extraction=True)
agent = Agent(memory_manager=MemoryManager(stores=[store]))

agent("Remember that I prefer dark-mode dashboards.")
agent("How do I like my dashboards?")  # recalls the stored preference

The dakera_memory tool is unchanged and can be used alongside the store against the same server.

Testing

  • tests/test_store.py — 12 tests with a mocked DakeraServiceClient (no live server/SDK): protocol conformance, write-sink detection via _has_method/_has_write_sink, MemoryEntry mapping, top_k precedence, and lazy client construction.
  • Full suite: 28 passed (16 existing tool + 12 store). ruff format --check, ruff check, and mypy src all clean — verified against real strands-agents 1.45.

Checklist

  • hatch run format / ruff check clean
  • mypy src clean
  • Tests pass on the mocked client (py3.10–3.13 matrix in CI)
  • README + python/README.md updated
  • Backward compatible (tool API and DakeraServiceClient() unchanged)

Context: requested by a Strands maintainer on the community docs PR (strands-agents/harness-sdk#3082) — "would you be able to integrate as a store instead?"

Adds a MemoryStore backend alongside the existing dakera_memory tool, so a
Dakera server can be wired into the agent loop via a MemoryManager (Strands
>=1.45) with automatic memory injection and conversation extraction — not only
as an explicitly-called tool.

- store.py: DakeraMemoryStore(MemoryStore) implementing search (decay-weighted
  recall) + add (client-side write sink); add_messages/initialize/get_tools left
  as inherited Protocol stubs so the manager detects them as absent.
- DakeraServiceClient: accept optional base_url/api_key (env fallback preserved).
- Bump strands-agents floor to >=1.45.0 (first release shipping strands.memory).
- 12 tests (search top_k precedence, MemoryEntry mapping, write-sink detection,
  lazy client); README + python/README updated. Full suite 28 passed, ruff +
  mypy clean.
@ferhimedamine
ferhimedamine merged commit a8abb34 into main Jul 7, 2026
5 checks passed
@ferhimedamine
ferhimedamine deleted the feat/memory-store branch July 7, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant