liveBook · Manning

Code interpretation capability

As explained in AI Agents in Action

Code Interpreter is an assistant capability that executes code to analyze data and generate computational outputs such as plots.

Code interpretation capability lets an assistant accept files, run code, analyze data, and produce computational outputs such as plots. In practice, it turns a GPT assistant into a practical data-analysis agent. section 3.2 section 3.7

A typical setup follows this workflow:

  • Design the assistant’s role and instructions, often by iterating through prompts that define its data-science workflow. section 3.2
  • Enable the Code Interpreter skill in the assistant’s Configure panel; enabling it also permits file uploads. section 3.2
  • Upload a CSV and request a focused analysis, such as filtering records by country and identifying significant trends. section 3.2
  • Add usage guidance when frequent coding or file uploads could consume account resources or temporarily block users. section 3.5.1

Data Scout analyzes a CSV

Configure an assistant named Data Scout to analyze uploaded CSV files. Upload netflix_titles.csv and ask: “Analyze the attached CSV and filter the results to the country Canada and output any significant discoveries in trends.” The assistant can inspect the data and return findings based on the requested filter. section 3.2

Generate a task schedule plot

A task-organizing assistant can use Code Interpreter to create a plot after retrieving daily tasks through a custom action. Instructions can require the assistant to organize tasks first and then show when and how they will be completed. section 3.3.2

Listing 3.3 Prompting for a data science assistant
FIRST PROMPT:    
what is a good basic and interesting data science 
experiment you can task someone with a single 
csv file that contains interesting data?     #1
SECOND PROMPT:    
okay, can you now write all those steps into instructions 
to be used for a GPT Agent (LLM agent) to replicate all of 
the above steps      #2

THIRD PROMPT:    
What is a famous personality that can embody the agent 
data scientist and be able to present data to users?      #3

Review the staged prompts used to develop a data-science assistant’s experiment, workflow, and persona. section 3.2

How AI Agents in Action covers it

How deep it goes
Explains configuration, prompting, file upload, analysis, plotting, and resource guidance without detailing execution internals.
Examples
Demonstrates CSV trend analysis with Netflix data and task-schedule plotting after custom-service retrieval.
What it assumes
Requires an assistant configured through the GPT interface and, for data analysis, a user-provided CSV file.
What you can do after
Build it from scratch by configuring an assistant that analyzes uploaded CSV files and generates plots.
How it connects
Connects data analysis, file uploads, custom actions, API endpoints, and GPT assistants.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action. The section links point to the parts of the book it draws on.