from phi.storage.agent.mongodb import MongoAgentStorage
db_url = "mongodb://ai:ai@localhost:27017/phi"
# Create a storage backend using the Mongo database
storage = MongoAgentStorage(
# store sessions in the agent_sessions collection
collection_name="agent_sessions",
db_url=db_url,
)
# Add storage to the Agent
agent = Agent(storage=storage)