AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(agent): Gracefully handle failure to load non-existing agent (#6938)
Krzysztof Czerwinski1881f4f7cd8c
diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.pyindex 20f1d98724..47908a3add 100644--- a/autogpts/autogpt/autogpt/app/main.py+++ b/autogpts/autogpt/autogpt/app/main.py@@ -164,7 +164,12 @@ async def run_auto_gpt(if re.match(r"^\d+$", load_existing_agent):load_existing_agent = existing_agents[int(load_existing_agent) - 1]elif load_existing_agent and load_existing_agent not in existing_agents:- raise ValueError(f"Unknown agent '{load_existing_agent}'")+ logger.info(+ f"Unknown agent '{load_existing_agent}', "+ f"creating a new one instead.",+ extra={"color": Fore.YELLOW},+ )+ load_existing_agent = ""# Either load existing or set up new agent stateagent = None