[LangGraph] Test Async use of MongoDBStore

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Python Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Creating an example of a chatbot that runs using asyncio brought to light that our existing BaseStore (for long term memories) doesn't really extend to asyncio with the existing base checkpointer, MongoDBSaver.

      Right from the get-go, in the constructor, two issues were brought to light.

      1. We create indexes and there is different behaviour of async and normal collection list_indexes

      2. In the asyncio context, it is an anti-pattern to await in the constructor.

      Design

      In discussion with the group, and after checking for gotchas with the LangGraph team, it became clear that the simplest approach to extending these classes to asynchronous settings was to use run_in_executor. So, we opened INTPYTHON-690 to extend the checkpointer, and changed the scope of this task to testing the async functionality of MongoDBStore.

      Definition of done

      • Create a new class {AsyncMongoDBStore}
      • Switch to LangGraph's two-step pattern (1) _{}init{}_ (2) setup() pattern, which we avoided previously.
      • Check if LangGraph guys are requiring setup for sync versions.  [DONE]
      • Set up tests. [DONE]
      • Confirm chatbot example runs. [DONE]

      Pitfalls

      This is one reason that we kept it as 0.0.1. Will review and decide what to release after SciPy.

              Assignee:
              Casey Clements
              Reporter:
              Casey Clements
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: