Skip to content

Conversation

@manuhortet
Copy link
Contributor

@manuhortet manuhortet commented Nov 11, 2025

  • Add create_collection_indexes_async to be used with AsyncMongoDb
  • When clearing collections from cache during client validation (we need this for the same instance to work across event loops), also clear cached indexes

Edit: fixes #5362

@manuhortet manuhortet requested a review from a team as a code owner November 11, 2025 11:00
Copy link
Contributor

@ysolanky ysolanky left a comment

Choose a reason for hiding this comment

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

LGTM

@adiberk
Copy link
Contributor

adiberk commented Nov 14, 2025

I know we are also discussing this in discord

This didn't fix my problem. I think the issue is that Agno (rightfully so) is doing a lot of work to manage the event loop for the motor client and the result of my having a singleton instance is likely causing problems for agno. My guess is that maybe AgentOS does something at the begnning now and the event loop becomes stale on the singleton instance? (I initialize AgentOS in my lifecycle method for fastapi)

regardless, I fixed the issue by simply allowing Agno to manage the client.

However - as noted in discord - if Agno plans on moving to pymongo async client. It will require my own client and my hope is that it will work fine in that scenario

@manuhortet manuhortet merged commit 1cfd730 into main Nov 17, 2025
5 checks passed
@manuhortet manuhortet deleted the fix/async-mongo branch November 17, 2025 10:47
@ppsid24
Copy link

ppsid24 commented Nov 18, 2025

This fix will be included in the upcoming release, I believe? I'm not seeing it in the existing releases.

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.

[Bug] Error on upsert session "Loop is closed" (async mongo client)

5 participants