Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

Make CLI agent flag errors more clear, and dont throw error if flags dont contradict existing agent config (#290)

Sarah Woodersc1fd8d6df1dc
diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py
index 7a2a21017..20dc1bdba 100644
--- a/memgpt/cli/cli.py
+++ b/memgpt/cli/cli.py
@@ -108,9 +108,12 @@ def run(
printd("Index path:", agent_config.save_agent_index_dir())
# persistence_manager = LocalStateManager(agent_config).load() # TODO: implement load
# TODO: load prior agent state
- assert not any(
- [persona, human, model]
- ), f"Cannot override existing agent state with command line arguments: {persona}, {human}, {model}"
+ if persona and persona != agent_config.persona:
+ raise ValueError(f"Cannot override {agent_config.name} existing persona {agent_config.persona} with {persona}")
+ if human and human != agent_config.human:
+ raise ValueError(f"Cannot override {agent_config.name} existing human {agent_config.human} with {human}")
+ if model and model != agent_config.model:
+ raise ValueError(f"Cannot override {agent_config.name} existing model {agent_config.model} with {model}")
# load existing agent
memgpt_agent = AgentAsync.load_agent(memgpt.interface, agent_config)