Running Python code with the code interpreter
Give a Mate the code interpreter to analyze data, draw charts and build files with Python, without writing code yourself.
Last updated About 13 hours ago
The Code Interpreter tool lets a Mate write and run Python code. The Mate uses it for work that needs real computation: analyze a spreadsheet, clean data, draw a chart, build an Excel, Word or PowerPoint file. You do not need to code: you state the goal and attach your data. This article shows how to give a Mate the code interpreter, what to ask, and how files move between you and the Mate.
Give a Mate the code interpreter
Installing a tool needs tool-management rights: the Expert plan by default; your organization's plans may differ.
- In the sidebar, open Mates & tools, then Tools Store.
- Search for Code Interpreter and open it. Its Overview tab lists what it can do.
- Click Install.
- In the Attach {name} to Mates dialog, click the Mates that should run code, then click Save access.
To attach it later, open the Mate, then its Tools tab, then Add a tool.
What you can ask
- Data analysis: "Analyze the attached customer feedback CSV and list the most common issues."
- Data cleaning: "Remove the duplicate rows from this file and compute the average of the Sales column."
- Charts: "Draw a scatter plot of advertising spend against revenue from this dataset, as a PNG image."
- Calculations and models: "Build a simple revenue projection for the next four quarters from this Excel file."
- Documents: "Create an Excel report with one sheet per department and a chart on each."
- Your own scripts: attach a
.pyfile and ask "Run this script."
The Mate writes the code, lists the Python libraries it needs, runs it, and explains the result.
Files in and out
- Your files go in. Attach your files (CSV, Excel, Python...) to your message. The Mate passes them to the code interpreter.
- Created files come back. Every file that the code creates or changes comes back as an attachment of the Mate's reply. Open it or download it from there.
- You can see the code. Click Tools called under the Mate's message to read the code it ran and the output.
Continue in the same conversation
When you continue earlier work in the same conversation, for example "Now add a column with the margin to the file you just created", the Mate can reuse the files it created.
- The session belongs to one conversation. Another conversation starts from scratch.
- To start clean, ask the Mate to reset the code interpreter session.
Good to know
- The code does not run on your computer. When you ask, the Mate can call a public API from the code.
- Ask for the output format you want: a CSV, an Excel file, a PNG chart, a Word document.
- Check the result. The Mate explains what the code did; ask it to show intermediate figures when the numbers matter.
- Long runs can stop before the end. Split a heavy task into smaller steps.