Skip to content

The agent engineering platform.

Catch all exceptions in autogpt (#3413)

Zander Chase3d8243ec95c0
diff --git a/langchain/experimental/autonomous_agents/autogpt/agent.py b/langchain/experimental/autonomous_agents/autogpt/agent.py
index ef0b71beee..025f6ca4b4 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}. "