diff --git a/python/extensions/agent_init/_15_load_profile_settings.py b/python/extensions/agent_init/_15_load_profile_settings.py index d4c9b5ab42..562f404b77 100644 --- a/python/extensions/agent_init/_15_load_profile_settings.py +++ b/python/extensions/agent_init/_15_load_profile_settings.py @@ -4,7 +4,7 @@ class LoadProfileSettings(Extension): - + async def execute(self, **kwargs) -> None: if not self.agent or not self.agent.config.profile: @@ -36,18 +36,18 @@ async def execute(self, **kwargs) -> None: if settings_override: # Preserve the original memory_subdir unless it's explicitly overridden current_memory_subdir = self.agent.config.memory_subdir + # FIX: Also preserve the original profile + original_profile = self.agent.config.profile + new_config = initialize_agent(override_settings=settings_override) + if ( "agent_memory_subdir" not in settings_override and current_memory_subdir != "default" ): new_config.memory_subdir = current_memory_subdir + + # FIX: Restore the original profile + new_config.profile = original_profile + self.agent.config = new_config - # self.agent.context.log.log( - # type="info", - # content=( - # "Loaded custom settings for agent " - # f"{self.agent.number} with profile '{self.agent.config.profile}'." - # ), - # ) -