diff --git a/web/src/app/chat/components/research-activities-block.tsx b/web/src/app/chat/components/research-activities-block.tsx
index 408e802..239bea4 100644
--- a/web/src/app/chat/components/research-activities-block.tsx
+++ b/web/src/app/chat/components/research-activities-block.tsx
@@ -304,10 +304,58 @@ function PythonToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
+ {toolCall.result && }
);
}
+function PythonToolCallResult({ result }: { result: string }) {
+ const { resolvedTheme } = useTheme();
+ const hasError = useMemo(
+ () => result.includes("Error executing code:\n"),
+ [result],
+ );
+ const error = useMemo(() => {
+ if (hasError) {
+ const parts = result.split("```\nError: ");
+ if (parts.length > 1) {
+ return parts[1]!.trim();
+ }
+ }
+ return null;
+ }, [result, hasError]);
+ const stdout = useMemo(() => {
+ if (!hasError) {
+ const parts = result.split("```\nStdout: ");
+ if (parts.length > 1) {
+ return parts[1]!.trim();
+ }
+ }
+ return null;
+ }, [result, hasError]);
+ return (
+ <>
+
+ {hasError ? "Error when executing the above code" : "Execution output"}
+
+
+
+ {error ?? stdout ?? "(empty)"}
+
+
+ >
+ );
+}
+
function MCPToolCall({ toolCall }: { toolCall: ToolCallRuntime }) {
const tool = useMemo(() => findMCPTool(toolCall.name), [toolCall.name]);
const { resolvedTheme } = useTheme();