[FEATURE] Configure memory injection through the harness memory option
Human Overview
No response
SDK Language
Both / Not language-specific
Problem Statement
The harness builds its own MemoryManager from the memory option (stores, model, directory, writable) but doesn't expose injection settings. Since #5298, recall injects up to 5 entries on each user turn, which is the SDK default. Through the harness option there is no way to inject fewer entries, turn injection off while keeping the search_memory tool, or cap how much text is injected. With FileMemoryStore, each entry is a whole topic file, so injected text can be large, and it is paid as uncached input on every call that injects it.
The only workaround is passing a MemoryManager instance. That bypasses the harness's default store location, writable handling, and extraction model, and delegates no longer get memory.
Proposed Solution
- Accept an
injectionfield on the harness memory option in harness-ts and harness-py, passed through toMemoryManager:false, or the SDK's injection config (trigger,maxEntries/max_entries,query,format). Omitting it keeps today's defaults. - Consider adding a size cap to the SDK's memory injection config (per entry or per injection), so whole-file entries can't grow without bound.
Use Case
- Tool-only recall for cost-sensitive agents.
- Smaller injections for agents with many or large memory topics.
- Tuning recall without giving up the harness's memory defaults.
Alternatives Solutions
- Passing a
MemoryManagerinstance: works, but loses the harness defaults listed above. - Turning memory off: loses recall entirely.
Some personal opinion...
I am currently working with memory a lot and I think that in addition to being able to set the entry count, it is better to default the option to NOT injecting any. I personally don't think injecting memory is even a good design in the beginning, as there is no programmatic way to judge whether an entry is any related to a current conversation. We could query the memory with specific keywords so that it can be somewhat generic to apply to any conversation, but still, there isn't a good way to determine what keywords should be used, and there is no way to rank one entry over another. In addition, when injecting entries, there should be a maximum token allowed (preferably settable), as mentioned in the issue, different entries (obviously) have different sizes.
That's a fair point; I do think it should be configurable, and we need to stay cost aware. That being said, we have seen improvements in performance when injecting context. I agree that it is largely dependent on the quality of the search, which can vary.
Good feedback @lizradway thoughts on this?