Skip to content

The agent engineering platform.

Print exception type for Python tool (#3126)

ProxyCausal72b7d76d79b0
diff --git a/langchain/tools/python/tool.py b/langchain/tools/python/tool.py
index 81339cedc3..607fec222d 100644
--- a/langchain/tools/python/tool.py
+++ b/langchain/tools/python/tool.py
@@ -89,7 +89,7 @@ class PythonAstREPLTool(BaseTool):
output = str(e)
return output
except Exception as e:
- return str(e)
+ return "{}: {}".format(type(e).__name__, str(e))
async def _arun(self, query: str) -> str:
"""Use the tool asynchronously."""