AI Trailblazers · Week 3 of 5

Data-analysis
agents

Deterministic vs agentic · SMART scoping · build a DataExplainer that queries and charts real data.

Shape: 30 min theory + 90 min practical  ·  You'll need: the Week 3 Colab notebook + a free Gemini key

The shape of today

Decide, scope, then build

2 halves
  • Theory (30 min): when to use a plain script vs a real agent + how to scope a project.
  • Practical (90 min): build a DataExplainer agent, then design your own project.

Plus a ~12 min energizer where teams argue script or agent? for real tasks.

1
Part 1 · Theory

When do you even need an agent?

Concept · Two ways to solve a task

Deterministic vs agentic

📜 Script / deterministic

Same input → same output

Cheap, fast, predictable. No LLM cost. You wrote every step, so it can't wander.

🤖 Agent / agentic

Reasons its own steps

Flexible, handles messy or open-ended asks. Pricier + slower, and can make mistakes.

🔑 Rule of thumb

If you can spell out the exact steps, write a script. If the steps depend on what the data or user says, reach for an agent.

Concept · Scoping

Make it SMART

🎯 Specific

One clear job, not "do everything."

📏 Measurable

You can tell when it worked.

✅ Achievable

Buildable with today's tools + data.

💡 Relevant

Solves a problem you actually care about.

⏳ Time-bound

Scoped to fit the hackathon window — a demo you can finish, not a dream you can't.

Concept · Where to aim

Project domains to steal from

📚 Education assistants

Quiz-score explainer, study-plan builder, reading-level checker.

🏀 Sports analyzers

Team-stats Q&A, "who's on a hot streak?", box-score charts.

⚡ Productivity agents

Habit-tracker insights, spending summarizer, to-do prioritizer.

🌱 Your world

A dataset from a hobby, club, or cause you already love.

🔑 Best projects start from data you can get

Kaggle, a Google Sheet you keep, or a public CSV. No data → no demo.

⚡ Energizer · ~12 min · on your feet

Script or Agent? — The Sorting Showdown

  • Each team gets a SCRIPT paddle and an AGENT paddle.
  • Coach reads a task card → teams raise a paddle and defend it using cost, reliability, or flexibility.
Task cards + paddles in Coach HQ → Week 3 energizer
2
Part 2 · Practical

Build the DataExplainer

Build · The plan

An agent with 3 data tools

  • 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

def describe_dataset():          # shape + columns
    return df.describe(include="all")

def run_query(expr):             # e.g. "Sex=='female' and Pclass==1"
    return df.query(expr)["Survived"].mean()

def plot_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 tools

print(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