Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: integrate replace flag in core_memory_insert (#1612)
cthomas4d9725750d64
diff --git a/letta/functions/function_sets/base.py b/letta/functions/function_sets/base.pyindex 02c507d96..44163deb7 100644--- a/letta/functions/function_sets/base.py+++ b/letta/functions/function_sets/base.py@@ -225,7 +225,10 @@ def core_memory_insert(agent_state: "AgentState", target_block_label: str, new_mcurrent_value_list = current_value.split("\n")if line_number is None:line_number = len(current_value_list)- current_value_list.insert(line_number, new_memory)+ if replace:+ current_value_list[line_number] = new_memory+ else:+ current_value_list.insert(line_number, new_memory)new_value = "\n".join(current_value_list)agent_state.memory.update_block_value(label=target_block_label, value=new_value)return None