diff --git a/open-webui/tools/run_code.py b/open-webui/tools/run_code.py
index fdce980..17f2270 100644
--- a/open-webui/tools/run_code.py
+++ b/open-webui/tools/run_code.py
@@ -299,6 +299,9 @@ async def _fail(error_message, status="SANDBOX_ERROR"):
)
status = "OK"
output = result.stdout or result.stderr
+ await emitter.message(
+ f"\n\nCode Execution
\nI executed the following {language} code:\n```{language}\n{code}\n```\n```Output\n{output.strip()}\n```\n \n"
+ )
if output:
output = output.strip()
if debug:
diff --git a/src/openwebui/tools/run_code.py b/src/openwebui/tools/run_code.py
index 37e6fd4..b706dc6 100644
--- a/src/openwebui/tools/run_code.py
+++ b/src/openwebui/tools/run_code.py
@@ -252,6 +252,9 @@ async def _fail(error_message, status="SANDBOX_ERROR"):
)
status = "OK"
output = result.stdout or result.stderr
+ await emitter.message(
+ f"\n\nCode Execution
\nI executed the following {language} code:\n```{language}\n{code}\n```\n```Output\n{output.strip()}\n```\n \n"
+ )
if output:
output = output.strip()
if debug: