feat: add DakeraMemoryStore (Strands MemoryStore integration) - #1
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
strands-dakeraexposed Dakera only as thedakera_memorytool — the model has to call it explicitly. Strands ≥ 1.45 ships astrands.memorymodule with aMemoryStoreextension point that aMemoryManagerdrives 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 toMemoryEntry(server-sideid/score/importance/created_atpreserved inmetadata).max_search_resultsprecedence: per-callSearchOptions→ configured default → 5.add(content, metadata)→ a single client-side write sink (store_memory). Because the store implementsadd(notadd_messages), enablingextractionuses the manager's client-sideModelExtractor.add_messages/initialize/get_toolsare intentionally left as the inherited Protocol stubs so Strands'_has_methoddetection reports them as absent (verified in tests).DakeraServiceClient; the client is built lazily on first use, and now accepts optionalbase_url/api_key(env fallback unchanged — backward compatible).strands-agentsfloor bumped>=1.0.0→>=1.45.0(first release exposingstrands.memory).Usage
The
dakera_memorytool is unchanged and can be used alongside the store against the same server.Testing
tests/test_store.py— 12 tests with a mockedDakeraServiceClient(no live server/SDK): protocol conformance, write-sink detection via_has_method/_has_write_sink,MemoryEntrymapping,top_kprecedence, and lazy client construction.ruff format --check,ruff check, andmypy srcall clean — verified against realstrands-agents1.45.Checklist
hatch run format/ruff checkcleanmypy srccleanpython/README.mdupdatedDakeraServiceClient()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?"