Skip to main content
AsyncMongoDb stores an Agent’s sessions and run history asynchronously in MongoDB. Use async Agent methods such as arun() and aprint_response().

Usage

Provide either db_url or db_client. This example uses db_url. Install the pymongo (4.9 or later), openai, and ddgs packages:
motor clients are also supported, but motor is deprecated. Use PyMongo’s async client instead.

Run MongoDB

Install Docker Desktop, then start MongoDB on port 27017:
async_mongodb_for_agent.py

Parameters