1 Get Started with AI Coding Tools
Large language models are impressive conversationalists, but without the ability to run code they can only describe how to analyze your data. They can outline the steps, suggest the formulas, and draft the chart specifications — but you still have to do the work. When you attach a code-execution tool, the dynamic changes completely. The AI loads your data into a Python dataframe, writes and runs the analysis, renders the charts, and synthesizes the findings into a memo. You provide the questions; the AI provides the answers. The result is not a plan for an analysis but the analysis itself — complete with numbers, visualizations, and narrative.
This chapter introduces the three major coding agents, explains how to install and configure each one, and maps out the differences that matter for choosing between them.
1.1 Code execution environments
AI can write and run code in three different environments, each with different strengths.
A cloud sandbox is a temporary computing environment hosted by the AI provider. Claude Chat and ChatGPT both offer this: you upload a file, the AI processes it on a remote server, and you download the results. Cloud sandboxes are convenient for quick, ad-hoc analysis, but your data leaves your machine and the session is ephemeral.
A virtual machine is a sandboxed environment that runs on your own computer. Claude Cowork is an example: it spins up a VM locally, giving AI a full computing environment with file access and persistence across sessions. Virtual machines are good for longer batch work, and because they run on your machine, your data stays local.
A local environment runs directly in your terminal. Claude Code, Gemini CLI, and OpenAI Codex are examples. The AI writes code that executes right on your machine, with full access to your files, databases, and network. Nothing is uploaded. This is what we use throughout this book.
The key takeaway is that AI does not need a special platform to analyze your data. It runs where you already work — in the terminal, on your laptop, with your files. The rest of this chapter shows how to set that up.
1.2 Setting up Claude Code
Claude Code is Anthropic’s terminal-based coding agent. It requires Node.js version 18 or higher. To install it, open a terminal and run:
npm install -g @anthropic-ai/claude-codeThe first time you launch it by typing claude, the tool opens a browser window for OAuth authentication with your Anthropic account. Claude Code requires either a Pro subscription at $20 per month (which includes a generous usage allowance) or an Anthropic API key with credits. Once authenticated, the agent is ready to use in any folder on your machine.
Claude Code reads a file called CLAUDE.md in the project directory for persistent instructions. This is where you store context about your data, preferred output formats, and any domain-specific guidance the agent should follow every session. You can also enable verbose output by pressing Ctrl+O during a conversation, which shows every step the agent takes: reading files, writing Python, running code, and interpreting results.
1.3 Setting up Gemini CLI
Gemini CLI is Google’s terminal-based coding agent. It also requires Node.js 18 or higher. Install it with:
npm install -g @google/gemini-cliLaunch it by typing gemini. On first run, it opens a browser window for Google account authentication. Gemini CLI offers a free tier with 60 requests per minute and 1,000 requests per day — enough for an entire working day of analysis without spending anything. Paid tiers are available through the Google AI API for heavier usage.
Gemini CLI reads a GEMINI.md file for project-level instructions, serving the same purpose as Claude Code’s CLAUDE.md. Verbose output is available by launching with --verbosity=verbose, which displays the agent’s internal reasoning and every tool call in real time.
1.4 Setting up OpenAI Codex
OpenAI Codex is an open-source terminal agent that connects to OpenAI’s models. Install it with:
npm install -g @openai/codexLaunch it by typing codex. Codex requires either a ChatGPT Plus subscription or an OpenAI API key. Set your API key as an environment variable (OPENAI_API_KEY) before launching, or the tool will prompt you to authenticate.
Codex displays its reasoning by default — you can see the agent’s thought process without enabling any special mode. It reads project instructions from a AGENTS.md file in the working directory.
1.5 Installing Python
The coding agents write Python behind the scenes, but the demo apps in later chapters need Python installed on your machine so you can run them yourself.
Download Python 3.10 or later from python.org. On Windows, check “Add Python to PATH” during installation. On Mac, you can also install via Homebrew with brew install python. After installing, verify by opening a terminal and running:
python --versionYou should see something like Python 3.12.4. If the command is not found, restart your terminal or check that Python was added to your PATH.
1.6 Installing libraries
Two Python packages are needed for the demo apps in later chapters:
pip install streamlit openaiStreamlit builds simple web apps from Python scripts — you write a short script and Streamlit turns it into an interactive page. The openai package is a Python client for OpenAI-compatible APIs, which includes OpenRouter (described next). Later chapters mention additional packages as needed.
1.7 Setting up OpenRouter
Later chapters include demo apps that call a large language model via API. OpenRouter provides free access to open-source models — no credit card required.
Sign up at openrouter.ai using a Google or GitHub account.
Create an API key at openrouter.ai/keys.
Set the key as an environment variable so the demo apps can find it:
Mac / Linux — add to your shell profile (
.bashrcor.zshrc) to persist:export OPENROUTER_API_KEY="sk-or-..."Windows — run once in a terminal, then restart the terminal:
setx OPENROUTER_API_KEY "sk-or-..."
The free tier allows roughly 20 requests per minute and 200 per day — more than enough for the exercises. To verify your key works, save this as test_openrouter.py and run it with python test_openrouter.py:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
)
response = client.chat.completions.create(
model="google/gemini-2.0-flash-exp:free",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(response.choices[0].message.content)If you see a greeting, the key is working and you are ready for the demo apps in Chapters 4 and beyond.
1.8 Significant differences
All three agents read local files, write Python, and return results in the conversation. The workflows in this book apply to all of them, and you should pick whichever fits your budget and preferences. That said, several differences are worth noting.
Sandboxing is the most visible difference. Codex runs generated code in an OS-level sandbox by default, isolating it from the rest of your system even during development. Claude Code and Gemini CLI rely on permission prompts instead — they ask before executing potentially destructive operations, but the code runs directly in your environment. For production deployment, all three benefit from container-based isolation (covered in Chapter 5).
Context windows determine how much text the agent can process in a single session. Gemini CLI supports up to one million tokens (roughly 3,000 pages of text). Claude Code ranges from 200,000 to over one million tokens depending on the model. Codex supports 192,000 tokens. For most business datasets and documents, any of these is more than sufficient.
Instruction files differ in name but serve the same purpose: CLAUDE.md for Claude Code, GEMINI.md for Gemini CLI, and AGENTS.md for Codex. Each file stores project-level context that persists across sessions.
Cost varies. Claude Code requires a $20/month subscription or API credits. Gemini CLI’s free tier covers most individual use. Codex is open source and free to run, but the OpenAI API calls it makes are billed per token.
1.9 Other interfaces
The terminal agents are not the only way to work with AI on code and data. Several other interfaces are worth knowing about, even though this book focuses on the terminal workflow.
Claude Desktop is a GUI chat application from Anthropic. It supports file attachments, image analysis, and recently added an agentic mode that can execute multi-step tasks. It is convenient for one-off conversations and for users who prefer a graphical interface to a terminal.
Google Antigravity is an agent-first IDE — a fork of VS Code designed around AI collaboration. It is currently in free preview. Rather than adding AI to an existing editor, it was built from the ground up for agent-driven workflows, with the AI able to navigate files, run code, and iterate on changes directly in the editor.
VS Code with AI extensions is the most common setup for developers who already use VS Code. Extensions like GitHub Copilot, Cline, and Roo Code add AI assistance ranging from autocomplete to full agentic coding. The experience is less unified than a purpose-built tool but integrates into an existing workflow.
Install one of the three coding agents (Claude Code, Gemini CLI, or Codex) on your machine. Launch it, authenticate, and confirm it is working by asking it to print “Hello, world” in Python.
Then ask it to create a simple CSV file with five rows of sample sales data (date, product, revenue, profit) and describe the data back to you. Verify that the file was created in your folder and that the description is accurate.
Install a second coding agent. Give both agents the same prompt: “Create a bar chart showing monthly revenue from this data” using the sample CSV from Exercise 1.
Compare the experience. Which agent was faster? Did the charts differ in style or quality? Did one ask for clarification while the other just ran? Write two sentences summarizing the most notable difference.
Create a project instruction file (CLAUDE.md, GEMINI.md, or AGENTS.md depending on your agent) in a folder containing the sample CSV from Exercise 1. Add two instructions: a preferred chart style (for example, “use a dark background with white text for all charts”) and a default analysis behavior (for example, “always show the code you run”).
Ask the agent to create a chart. Does it follow your instructions? Modify the instruction file and ask again.