describe_dataset() — what columns and shape do we have?
run_query(expr) — ask a filtered/grouped question of the data.
plot_chart(col, kind) — turn an answer into a picture.
💡 Same loop as Week 2
Reason → Act → Observe. Only the tools changed — now they touch a pandas DataFrame instead of mock news.
Build · Step 1 — the tools
Three functions over one DataFrame
import pandas as pd, matplotlib.pyplot as plt
defdescribe_dataset(): # shape + columnsreturn df.describe(include="all")
defrun_query(expr): # e.g. "Sex=='female' and Pclass==1"return df.query(expr)["Survived"].mean()
defplot_chart(col, kind="bar"): # save a picture
df.groupby(col)["Survived"].mean().plot(kind=kind)
plt.savefig("chart.png")
Build · Step 2 — hand the tools over
Let Gemini drive them
from google import genai
from google.genai import types
client = genai.Client()
tools = [describe_dataset, run_query, plot_chart]
chat = client.chats.create(
model="gemini-2.5-flash",
config=types.GenerateContentConfig(tools=tools)) # auto-calls toolsprint(chat.send_message("What columns does this dataset have?").text)
🔑 The magic line
Passing tools= lets Gemini pick a function, run it, read the result, and answer — the ReAct loop, handled for you.
Build · Step 3 — your challenge
Ask it two real questions
🎯 Challenge 1 — a number
"What's the survival rate for women in first class?" → the agent should call run_query and report a decimal (~0.97).
📊 Challenge 2 — a chart
"Show survival by class as a bar chart." → the agent should call plot_chart("Pclass") and save chart.png.
Stretch: "Which port did most survivors board from?" — can it figure out the tools on its own?
Checkpoint
Everyone got a chart?
Before we design projects
Agent answered the survival-rate number ✔
Agent produced a bar chart image ✔
You saw it pick a tool from your question ✔
Stuck? Grab a coach or a buddy who's ✔ before we move on.
Design sprint
Scope your own agent
🗣️ 1-min peer pitch
Say your idea out loud to a partner. If they get it in one breath, it's scoped.
📄 Project charter
Fill the one-pager in the notebook — your blueprint for Week 4.
📄 Charter fields
Name + objective · 2–3 tools your agent needs · data source (CSV / Sheet / Kaggle) · outputs (a number? a chart? a summary?).
Week 3 · Wrap
You built a data analyst 🎉
Script vs agent: pick the cheapest tool that gets the job done.
You gave an agent tools that query and chart real data.
You SMART-scoped your own project and wrote a charter.
🏠 Homework
Find and load your dataset · confirm your 2–3 tools are buildable · bring the charter ready to build.
Next week → The hackathon: build your agent from the charter and demo it.
AI Trailblazers · Week 3 — Data Analysis Agents · press S for coach notes