diff --git a/src/ragent/__init__.py b/src/ragent/__init__.py
index 9a1af7c..ceacc95 100644
--- a/src/ragent/__init__.py
+++ b/src/ragent/__init__.py
@@ -185,7 +185,12 @@ class EventHandler(AssistantEventHandler):
         for tool in data.required_action.submit_tool_outputs.tool_calls:
             for function in self.agent.tools:
                 if function.__name__ == tool.function.name:
-                    tool_outputs.append({"tool_call_id": tool.id, "output": str(function(**json.loads(tool.function.arguments)))})
+                    result = None
+                    try:
+                        result = function(**json.loads(tool.function.arguments))
+                    except Exception as ex:
+                        result = str(ex)
+                    tool_outputs.append({"tool_call_id": tool.id, "output": str(result)})
 
         self.submit_tool_outputs(tool_outputs, run_id)