Skip to content

fix: make AsyncMemory.from_config a regular classmethod#4183

Merged
kartik-mem0 merged 1 commit intomem0ai:mainfrom
Br1an67:fix/issue-2755-async-from-config
Mar 30, 2026
Merged

fix: make AsyncMemory.from_config a regular classmethod#4183
kartik-mem0 merged 1 commit intomem0ai:mainfrom
Br1an67:fix/issue-2755-async-from-config

Conversation

@Br1an67
Copy link
Copy Markdown
Contributor

@Br1an67 Br1an67 commented Mar 1, 2026

Description

AsyncMemory.from_config() is declared as async but contains no async operations — it only validates config and calls cls(config). This forces users to use await even in synchronous initialization contexts (e.g. FastAPI module-level setup).

Remove the async keyword so it can be called as a regular classmethod.

Fixes #2755

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Test Script (please provide)
from mem0.memory.main import AsyncMemory
import inspect
assert not inspect.iscoroutinefunction(AsyncMemory.from_config)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

from_config() contains no async operations (only MemoryConfig
validation and cls() construction). Remove the async keyword so
it can be called outside an async context, e.g. during FastAPI
module initialization.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 1, 2026

CLA assistant check
All committers have signed the CLA.

@Br1an67
Copy link
Copy Markdown
Contributor Author

Br1an67 commented Mar 9, 2026

Hi — just a gentle bump on this. Happy to make any changes if needed!

@kartik-mem0 kartik-mem0 merged commit 97291aa into mem0ai:main Mar 30, 2026
6 of 7 checks passed
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.

AsyncMemory.from_config no need to be async

3 participants