Code Execution
Code Execution lets Hatz run Python in a secure sandbox so it can analyze data, transform files, create charts, and generate downloadable outputs such as spreadsheets, documents, presentations, PDFs, images, text files, and zip files.
For most users, the easiest way to use Code Execution is to turn on Auto-Tool. Auto-Tool selects the tools needed for the request, including Code Execution when the task requires file generation or code-backed analysis. When you upload document files, Hatz should also bind Code Execution automatically for document work.
For document editing examples, see AI Document Editing with Code Execution.
When to use Code Execution
Analyze, clean, filter, merge, or summarize CSV and Excel files.
Create charts, tables, reports, and data exports.
Generate or edit Word documents, PowerPoint decks, PDFs, and spreadsheets.
Convert files into another supported format.
Run calculations or code-backed checks that need more precision than a normal chat response.
Package multiple outputs into a zip file for download.
How to use it
Turn on Auto-Tool before sending your request.
Upload the file or files you want Hatz to work with, if the task uses attachments.
Tell Hatz exactly what to produce and what filename or file type you want.
Download the result from the Generated file card when the output is ready.
If your workspace shows manual tool selection, you can also select Code Execution directly.
How downloadable outputs work
When Hatz successfully saves a generated file, the output appears as a Generated file card in chat, an app response, or a workflow run. Use the download button on that card. Images may also preview inline.
A sandbox path points to the execution workspace. Ask Hatz to find the existing output at that exact path and return it as a downloadable file. Check that result before asking to generate it again.
Prompt examples
Use Code Execution on this spreadsheet. Clean duplicate rows, add a summary sheet, save the result as cleaned_data.xlsx, and return it as a downloadable file.Create a chart from this CSV, save it as revenue_chart.png, and return the generated file.Update this PowerPoint with the attached notes, save the updated deck as final_presentation.pptx, and return the downloadable file.If you create multiple files, put them into deliverables.zip and return the zip file.
Common output types
Documents:
.docx,.pdf,.txtSpreadsheets:
.xlsx,.csvPresentations:
.pptxImages and charts:
.png,.jpgBundles:
.zip
Important limitations
Code Execution creates new output files. It does not overwrite your original upload.
Password-protected or encrypted files must be unlocked before Hatz can process them.
Complex visual layouts, PDFs, and PowerPoint files may not convert or reflow perfectly.
Macro-enabled files are not supported for macro execution.
Formula recalculation should be requested explicitly when you need it.
Download useful outputs while they are available. If a result is missing, check the original chat and tool output first to establish whether it was saved and can be recovered.
Troubleshooting
If Hatz says it created a file but no file card appears, inspect the tool result for an execution or save error. Ask for the existing output to be returned before repeating the work.
If Hatz returns a sandbox path, ask it to create a downloadable file for that exact path.
If generated files could not be saved, preserve any available outputs and follow the file-count-limit guide. Saving, execution and downloading are separate stages.
If a download fails, see Can't Access File Generated In Chat.
Choose recovery from the actual error
An unavailable execution environment, a timeout and an uncertain execution outcome need different next steps. For a timeout, identify completed work and reduce only the remaining task. If execution is reported as uncertain, effects may already have occurred: check outputs and external state before repeating it. Contact Support when you cannot establish the result.
Keep the original input and inspect formatting, calculations and completeness in the returned file. For edits, use the latest verified output as the next input.
Check the result of a Python calculation
When Hatz uses Python for a calculation, expand the activity under the answer and open Ran Python to inspect the result. Compare the output with the numbers you supplied. In the project-hours example, 6 hours of planning, 4 of drafting and 2 of review add up to 12 hours.
