S. M. Mohiuddin Khan Shiam 2b873a483b
Fix mutable default in ListMemoryConfig (#6729)
### Fix mutable default in
[ListMemoryConfig](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:12:0-18:65)


[ListMemoryConfig](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:12:0-18:65)
used a shared empty list (`memory_contents: List[MemoryContent] = []`)
as its default, causing every
[ListMemory](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:21:0-171:79)
instance to share the same underlying list. This unexpected state
leakage let memories written in one instance silently surface in others,
breaking isolation and leading to hard-to-reproduce bugs.
Replaced the mutable default with a safe Pydantic
`Field(default_factory=list)`, ensuring each configuration—and thus each
[ListMemory](cci:2://file:///c:/Users/T2430514/Downloads/autogen/python/packages/autogen-core/src/autogen_core/memory/_list_memory.py:21:0-171:79)—gets
its own independent list.

---------

Co-authored-by: T2430514 <t2430514@gmail.com>
Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
2025-06-29 15:23:29 +00:00
..

AutoGen Core

AutoGen core offers an easy way to quickly build event-driven, distributed, scalable, resilient AI agent systems. Agents are developed by using the Actor model. You can build and run your agent system locally and easily move to a distributed system in the cloud when you are ready.