File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2460,12 +2460,17 @@ def load_agent_session(self, session: AgentSession):
24602460 # If we haven't instantiated the memory yet, set it to the memory from the database
24612461 if self .memory is None :
24622462 self .memory = session .memory # type: ignore
2463-
2463+
24642464 if not (isinstance (self .memory , AgentMemory ) or isinstance (self .memory , Memory )):
24652465 # Is it a dict of `AgentMemory`?
24662466 if isinstance (self .memory , dict ) and "create_user_memories" in self .memory :
24672467 # Convert dict to AgentMemory
24682468 self .memory = AgentMemory (** self .memory )
2469+ # Convert dict to Memory
2470+ elif isinstance (self .memory , dict ):
2471+ memory_dict = self .memory
2472+ memory_dict .pop ("runs" )
2473+ self .memory = Memory (** memory_dict )
24692474 else :
24702475 raise TypeError (f"Expected memory to be a dict or AgentMemory, but got { type (self .memory )} " )
24712476
You can’t perform that action at this time.
0 commit comments