Skip to content

Conversation

@michaelnchin
Copy link
Collaborator

@michaelnchin michaelnchin commented Oct 25, 2025

Addresses #719.

This PR updates the AgentCore memory checkpointer integration to:

  • Add an max_results attribute to AgentCoreMemorySaver for limiting the number of events processed.
    • Currently, the limit is hardcoded to 100 events - this will remain as the default for the new attribute. None can also be specified to set no upper limit.
  • Fix the limit parameter of AgentCoreMemorySaver.list(). In BaseCheckpointSaver.list(),
    • In the base method, limit configures the max# of checkpoints to return, but we also use this in the get_events() call. Updated this call to use the new class attribute limit instead.
  • In AgentCoreEventClient,get_events(), exit from the response processing loop early if the number of events found exceeds max_results. If this occurs, a warning will be returned to the user.

@michaelnchin
Copy link
Collaborator Author

Hi @ltoniazzi, thanks for the suggestions in #719 - feel free to try out these changes and let me know if you have any additional feedback.

@michaelnchin michaelnchin changed the title fix(langgraph-checkpoint-aws): Allow limit configuration for AgentCoreMemorySaver get_tuple fix(langgraph-checkpoint-aws): Add event limit attribute to AgentCoreMemorySaver Oct 28, 2025
@michaelnchin
Copy link
Collaborator Author

@jgordley @bergjaak - ready for review

@michaelnchin michaelnchin changed the title fix(langgraph-checkpoint-aws): Add event limit attribute to AgentCoreMemorySaver fix(langgraph-checkpoint-aws): Add max_results attribute to AgentCoreMemorySaver Oct 28, 2025
@ltoniazzi
Copy link

I wonder if it should default to None instead of 100, as I think saver always tries to list events for a thread_id, so I do not see a reason why one would not want to fetch the full checkpoint history by default (also limit in other savers defaults to None as well).

Also, I'm a bit surprised that this change does not break any unit test (I can try add some next week)

@michaelnchin
Copy link
Collaborator Author

@ltoniazzi actually, looking at the ListEvents API reference, maxResults has a hard upper limit of 100 events (defaults to 20 if we don't pass it). I think this is the reason for the original hardcoded limit. If the docs are correct, I think we need to do away with the no-limit None option.

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.

Hardcoded limit to checkpoints retrieval for AgentCore LangGraph Saver

3 participants