Skip to content

Conversation

@michaelnchin
Copy link
Collaborator

Addresses #719.

This PR updates the AgentCore checkpointer to:

  • Add a user-configurable limit argument to AgentCoreMemorySaver.get_tuple(). Currently, this method will always use the default limit of 100 events in AgentCoreEventClient,get_events().
  • In AgentCoreEventClient,get_events(), exit from the response processing loop early if the number of events found exceeds limit. 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.

async def aget_tuple(self, config: RunnableConfig) -> CheckpointTuple | None:
return self.get_tuple(config)
async def aget_tuple(
self, config: RunnableConfig, *, limit: int | None = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think limit is like a connection parameter, so it could be good to set it as an attribute when instantiating the saver, like for the postgres saver.

Also the user will not use aget_tuple, but usually only instantiate the saver. Other methods, like aget, aput, are usually only called by the langgraph internals.

checkpoint_config.session_id, checkpoint_config.actor_id
checkpoint_config.session_id,
checkpoint_config.actor_id,
100 if limit is None else limit,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think None could be allowed as a parameter?

If limit is an attribute it could just be self.limit here and set a default in the __init__?

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

2 participants