Repository navigation
feat(agents): conversation / short-term memory on DynamoDB (#290) - #349
Open
codeforstartups wants to merge 1 commit into
Open
codeforstartups wants to merge 1 commit into
codeforstartups wants to merge 1 commit into
Conversation
InMemoryMemoryStore and DynamoDBMemoryStore with window, token-budget and summary policies and a per-thread scratchpad. ReActAgent(memory=...) loads earlier turns for a thread_id, stores the system prompt once, keeps the #345 shared-state context in the user turn, and records each final answer (including runs finished via resume()). Ported onto the current agent loop from Shivam Gupta's #336, with fixes: - DynamoDBMemoryStore.append uses update_item on the message attributes, so a scratchpad written concurrently is not overwritten (was read + put_item) - documents the 400 KB item limit and recommends a trimming policy - a run on a thread whose checkpoint is finished starts a new turn, so memory and the checkpointer can share a thread_id Co-authored-by: shivamm-gupta <72978868+shivamm-gupta@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #290. Supersedes #336 by @shivamm-gupta (credited as co-author). #336 was written against the agent loop before #328/#345, so it conflicts in
react.pyand drops the shared-state context. This ports it onto the current loop.Stacked on #348 (HITL interrupts) — both change
react.py. Review/merge #348 first; GitHub will retarget this PR todevelopmentautomatically when #348's branch is deleted.What it does
From #336, unchanged:
InMemoryMemoryStore,DynamoDBMemoryStore, window / token-budget / summary policies, scratchpad, and its tests.Fixes made while porting
DynamoDBMemoryStore.appendread the item twice and rewrote it withput_item, so aset_scratchpadin between was lost. It now usesupdate_itemon the message attributes only.AgentStatecontext.thread_id: the secondrun()used to reload the finished checkpoint instead of starting a new turn. A finished checkpoint now starts a new turn; unfinished ones (e.g.max_steps_reached) still resume as before — the existing resumption test is unchanged.resume().Tests
#336's 7 tests kept, plus 6 new: scratchpad survives
append, item metadata, shared-state context in the stored turn, memory + checkpointer multi-turn, finished checkpoint starts fresh, memory with interrupt/resume. Local: ruff clean, strict mypy clean, 1137 passed.🤖 Generated with Claude Code