From 72e51fdfeb967279014dc609feaab869778667ea Mon Sep 17 00:00:00 2001 From: cthomas Date: Wed, 23 Apr 2025 17:01:07 -0700 Subject: [PATCH] chore: update sleeptime verbiage everywhere (#1867) --- letta/agents/voice_agent.py | 4 ++-- letta/personas/examples/offline_memory_persona.txt | 4 ---- letta/personas/examples/sleeptime_memory_persona.txt | 5 +++++ letta/server/server.py | 7 +------ tests/integration_test_sleeptime_agent.py | 6 +++--- tests/test_sdk_client.py | 8 ++++---- 6 files changed, 15 insertions(+), 19 deletions(-) delete mode 100644 letta/personas/examples/offline_memory_persona.txt create mode 100644 letta/personas/examples/sleeptime_memory_persona.txt diff --git a/letta/agents/voice_agent.py b/letta/agents/voice_agent.py index a0601183..8b20d9b1 100644 --- a/letta/agents/voice_agent.py +++ b/letta/agents/voice_agent.py @@ -90,7 +90,7 @@ class VoiceAgent(BaseAgent): # ) self.message_buffer_limit = message_buffer_limit # self.message_buffer_min = message_buffer_min - self.offline_memory_agent = EphemeralMemoryAgent( + self.sleeptime_memory_agent = EphemeralMemoryAgent( agent_id=agent_id, openai_client=openai_client, message_manager=message_manager, agent_manager=agent_manager, actor=actor ) @@ -372,7 +372,7 @@ class VoiceAgent(BaseAgent): return f"Failed to call tool. Error: {e}", False async def _recall_memory(self, query, agent_state: AgentState) -> None: - results = await self.offline_memory_agent.step([MessageCreate(role="user", content=[TextContent(text=query)])]) + results = await self.sleeptime_memory_agent.step([MessageCreate(role="user", content=[TextContent(text=query)])]) target_block = next(b for b in agent_state.memory.blocks if b.label == self.summary_block_label) self.block_manager.update_block( block_id=target_block.id, block_update=BlockUpdate(value=results[0].content[0].text), actor=self.actor diff --git a/letta/personas/examples/offline_memory_persona.txt b/letta/personas/examples/offline_memory_persona.txt deleted file mode 100644 index ce65622b..00000000 --- a/letta/personas/examples/offline_memory_persona.txt +++ /dev/null @@ -1,4 +0,0 @@ -I am an expert memory agent that can do the following: -- Consolidate memories into more concise blocks -- Identify patterns in user behavior -- Make inferences based on the memory diff --git a/letta/personas/examples/sleeptime_memory_persona.txt b/letta/personas/examples/sleeptime_memory_persona.txt new file mode 100644 index 00000000..d76b9927 --- /dev/null +++ b/letta/personas/examples/sleeptime_memory_persona.txt @@ -0,0 +1,5 @@ +I am an expert conversation memory agent that can do the following: +- Consolidate memories into more concise blocks +- Identify patterns in user behavior +- Make inferences based on the memory +I manage the memory blocks such that they contain everything that is important about the conversation. diff --git a/letta/server/server.py b/letta/server/server.py index d2576c18..6190773b 100644 --- a/letta/server/server.py +++ b/letta/server/server.py @@ -766,12 +766,7 @@ class SyncServer(Server): memory_blocks=[ CreateBlock( label="memory_persona", - value=( - "I am an expert conversation memory manager. " - "I manage the memory blocks such that they " - "contain everything that is important about " - "the conversation." - ), + value=get_persona_text("sleeptime_memory_persona"), ), ], llm_config=main_agent.llm_config, diff --git a/tests/integration_test_sleeptime_agent.py b/tests/integration_test_sleeptime_agent.py index 3d215baa..f5c3977d 100644 --- a/tests/integration_test_sleeptime_agent.py +++ b/tests/integration_test_sleeptime_agent.py @@ -240,13 +240,13 @@ async def test_sleeptime_edit(server, actor): agent_type="sleeptime_agent", memory_blocks=[ CreateBlock( - label="persona", + label="human", value=get_human_text(DEFAULT_HUMAN), limit=2000, ), CreateBlock( - label="human", - value=get_persona_text("offline_memory_persona"), + label="memory_persona", + value=get_persona_text("sleeptime_memory_persona"), limit=2000, ), CreateBlock( diff --git a/tests/test_sdk_client.py b/tests/test_sdk_client.py index ffa4758f..d51ad028 100644 --- a/tests/test_sdk_client.py +++ b/tests/test_sdk_client.py @@ -529,7 +529,7 @@ def test_send_message_async(client: LettaSDKClient, agent: AgentState): def test_agent_creation(client: LettaSDKClient): """Test that block IDs are properly attached when creating an agent.""" - offline_memory_agent_system = """ + sleeptime_agent_system = """ You are a helpful agent. You will be provided with a list of memory blocks and a user preferences block. You should use the memory blocks to remember information about the user and their preferences. You should also use the user preferences block to remember information about the user's preferences. @@ -555,13 +555,13 @@ def test_agent_creation(client: LettaSDKClient): tool2 = client.tools.upsert_from_function(func=another_test_tool, tags=["test"]) # Create test blocks - offline_persona_block = client.blocks.create(label="persona", value="persona description", limit=5000) + sleeptime_persona_block = client.blocks.create(label="persona", value="persona description", limit=5000) mindy_block = client.blocks.create(label="mindy", value="Mindy is a helpful assistant", limit=5000) # Create agent with the blocks and tools agent = client.agents.create( name=f"test_agent_{str(uuid.uuid4())}", - memory_blocks=[offline_persona_block, mindy_block], + memory_blocks=[sleeptime_persona_block, mindy_block], model="openai/gpt-4o-mini", embedding="openai/text-embedding-ada-002", tool_ids=[tool1.id, tool2.id], @@ -575,7 +575,7 @@ def test_agent_creation(client: LettaSDKClient): assert agent.id is not None # Verify all memory blocks are properly attached - for block in [offline_persona_block, mindy_block, user_preferences_block]: + for block in [sleeptime_persona_block, mindy_block, user_preferences_block]: agent_block = client.agents.blocks.retrieve(agent_id=agent.id, block_label=block.label) assert block.value == agent_block.value and block.limit == agent_block.limit