I was playing with some of my agents and memory tooling, on the playground.
I was not able to get correct response regarding some queries about episodic memories or user memories.
Code which might be causing the problem:
async def create_agent_run(
agent_id: str,
message: str = Form(...),
stream: bool = Form(True),
monitor: bool = Form(False),
session_id: Optional[str] = Form(None),
user_id: Optional[str] = Form(None),
files: Optional[List[UploadFile]] = File(None),
):
# this starts deepcopy of an existing agent
new_agent_instance = agent.deep_copy(update={"session_id": session_id})
in agent.py
def deep_copy():
# memory is excluded
excluded_fields = ["agent_session", "session_name", "memory"]
The problem happens when I fire a message from the playground.
def initialize_agent(self) -> None:
self.set_debug()
self.set_agent_id()
self.set_session_id()
if self._formatter is None:
self._formatter = SafeFormatter()
if self.memory is None:
self.memory = AgentMemory()
memory is set to a default in-memory AgentMemory overriding the parent agent’s memory specs.
get_tools
is called to attach the tools in the LLM call.
def get_tools():
# this if returns as False, as memory.create_user_memories is not copied fro the parent agent.
if self.memory and self.memory.create_user_memories:
tools.append(self.update_memory)
Is this a known bug? Or is this intended for playground.
Also, I feel memories should also be associated with session_id, or there can be a global memory thingy (chatgpt settings, anyone?)
I had a bit frustrating moment when the agent works as a normal cli (i.e has memories) but when run in the playground it suffers from memory loss. PDB to the rescue.