From 3d8243ec95c0ced33df60257394c9ddf14955ec0 Mon Sep 17 00:00:00 2001 From: Zander Chase <130414180+vowelparrot@users.noreply.github.com> Date: Sun, 23 Apr 2023 20:02:37 -0700 Subject: [PATCH] Catch all exceptions in autogpt (#3413) Ought to be more autonomous --- langchain/experimental/autonomous_agents/autogpt/agent.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/langchain/experimental/autonomous_agents/autogpt/agent.py b/langchain/experimental/autonomous_agents/autogpt/agent.py index ef0b71be..025f6ca4 100644 --- a/langchain/experimental/autonomous_agents/autogpt/agent.py +++ b/langchain/experimental/autonomous_agents/autogpt/agent.py @@ -110,7 +110,13 @@ class AutoGPT: try: observation = tool.run(action.args) except ValidationError as e: - observation = f"Error in args: {str(e)}" + observation = ( + f"Validation Error in args: {str(e)}, args: {action.args}" + ) + except Exception as e: + observation = ( + f"Error: {str(e)}, {type(e).__name__}, args: {action.args}" + ) result = f"Command {tool.name} returned: {observation}" elif action.name == "ERROR": result = f"Error: {action.args}. "