sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[BUG] High latency when inititalizing session managers

Open bergjaak opened this issue 2 months ago • 0 comments

Problem Statement

Currently, when using a SessionManager like the AgentCoreMemorySessionManager, there is high latency during initialization of the SessionManager. This is because the current SessionRepository interface (which the AgentCoreMemorySessionManager implements) does not provide any way of retrieving/creating required objects in parallel. Namely, when an AgentCoreMemorySessionManager is being instantiated, we need to check for

  1. Does a previous Agent object exist? (1 API call for existence check) 1b. If not, then create an Agent (another API call)
  2. Does a previous Session object exist? 2b. If not, then create a Session object (another API call)
  3. Are there previous messages in the session? Call API to see

Proposed Solution

Expose a means of performing these operations in parallel so that SessionManager implementations which make remote requests (or perform other higher latency operations during initialization) can do this work in parallel.

Use Case

Initializing a session manager

Alternatives Solutions

I was also wondering, for these integrations that make network requests, would it be useful in Strands to have something that writes to local memory or disk (like, say, sqlite) and then have some periodic job to make the async calls to the remote persistence? At least for writes and reading previous messages. Because then that would eliminate all the latency of the SessionManager integration, and would be ultimately more reliable in that any failure to upload would just be retried later.

Additional Context

No response

bergjaak avatar Nov 28 '25 14:11 bergjaak