LearnAIAgent Track · Weeks 2–5 ← Roadmap

Week 3 · From building agents to choosing & scoping them

Data analysis agents & project scoping

Last week you built an agent. This week you learn when you shouldn't — sometimes a plain script wins — then you'll build a DataExplainer that reasons over real data, and scope your own project so Week 4's hackathon starts clean.

Week 3 of 5 · theory 30 min · practical 90 min

What you'll walk away with

Part 1 · Theory (30 min)

Deterministic vs. agentic systems

You now know how to build an agent — but the most senior move in engineering is knowing when not to. Some jobs want a plain, predictable script; others genuinely need a flexible agent. Picking wrong costs money or reliability.

Script

🧾 Deterministic

Same input → same output, every time. Cheap, fast, predictable. You wrote the exact steps, so you can trust and test them. But it only does the one thing you coded.

Agent

🤖 Agentic

Reasons about a goal and decides its own steps. Flexible — it handles fuzzy, open-ended tasks. But it's pricier (LLM calls), slower, and less predictable, so it needs guardrails and checking.

🔑 The rule of thumb

If you can write down every step and the input is tidy, use a script — it's cheaper and you can trust it. Reach for an agent only when the task is open-ended, the input is messy, or the steps depend on what it finds along the way. Use the simplest thing that works.

🚗 Analogy: a train vs. a car

A train is deterministic — fixed track, fixed stops, incredibly reliable and cheap per rider, but it only goes where the rails go. A car is agentic — it can reach any address and reroute around a closed road, but it costs more, needs a driver making decisions, and can take a wrong turn. You don't drive a car onto a train track, and you don't lay rails to visit one friend.

⚠️ The classic mistake

Wrapping an LLM around a job a five-line script could do — like "rename these files" or "add up a column." You pay per token, wait longer, and get a less reliable result than the boring script would have given you for free.

Scoping a project with SMART

Next week is a hackathon, so your idea has to fit the clock. A vague goal like "build an AI helper" sinks projects. The SMART checklist turns a wish into a plan you can actually finish.

Domain

🎓 Education assistants

A flashcard maker, an essay-feedback coach, or a "explain this like I'm 12" tutor over your class notes.

Domain

🏈 Sports analyzers

An agent that reads a stats table and answers "who had the best 3rd-quarter shooting?" or charts a team's season.

Domain

🗂️ Personal productivity

A homework planner, a habit tracker that nudges you, or an inbox summarizer for your club emails.

Test it

✅ The scope check

Say your idea in one sentence and hit all five letters. Can't? It's too big — cut it down until you can.

🔑 The one idea

A small project that ships beats a huge one that stays half-built. Scope so a working demo is guaranteed — then add extras if time allows.

Part 2 · Practical (90 min)

Build the "DataExplainer" agent

Now put an agent on top of structured data. The DataExplainer takes a plain-English question about the Titanic dataset, picks the right tool, and answers with a number or a chart. You'll give it three tools — the full, runnable version is in the Week 3 notebook.

Step 1 — Load the data & describe it

Load the Titanic table with pandas, then give the agent a describe_dataset() tool so it can learn the columns before it reasons.

describe_dataset.py
import pandas as pd
df = pd.read_csv("https://.../titanic.csv")

def describe_dataset() -> str:
    """Tell the agent what columns and types exist."""
    return f"Rows: {len(df)}\nColumns:\n{df.dtypes}"
why it mattersThe agent can't query a column it doesn't know exists. describe_dataset() is how it "reads the menu" before ordering.

Step 2 — Query the data

Give it a run_query() tool that filters and aggregates with pandas .query() and .groupby(). This is the tool it reaches for to answer "how many?" or "what's the average?"

run_query.py
def run_query(expr: str) -> str:
    """Filter/aggregate the dataframe and return the result."""
    result = df.query(expr)          # e.g. "Sex == 'female' and Pclass == 1"
    return f"{len(result)} rows · survival rate {result['Survived'].mean():.0%}"
the challengeAsk it: "What's the survival rate for women in first class?" Watch it call run_query("Sex == 'female' and Pclass == 1") and reason on the result.

Step 3 — Plot a chart

Finally a plot_chart() tool using matplotlib/seaborn, so a question can be answered with a picture, not just a number.

plot_chart.py
import seaborn as sns, matplotlib.pyplot as plt

def plot_chart(kind: str, x: str, y: str) -> str:
    """Draw a chart, e.g. kind='bar', x='Pclass', y='Survived'."""
    sns.barplot(data=df, x=x, y=y)
    plt.savefig("chart.png")
    return "chart saved"
the challengeAsk it: "Show survival by class as a bar chart." It should pick plot_chart("bar", "Pclass", "Survived") — the same ReAct loop, just choosing a different tool.
🔑 Same loop, richer tools

Nothing new in the agent — it's still Reason → Act → Observe from Week 2. What changed is the toolbox: describe, query, chart. Good tools are what make an agent genuinely useful.

Design sprint · 30 min · pairs then solo

The Project Design Sprint

Time to turn your idea into a plan you'll build next week.

  1. 1-minute peer pitch. Say your idea out loud to a partner in one minute. They ask one hard question: "Is that SMART? Could a script do it instead of an agent?" Swap.
  2. Write your project charter. Fill in four things — no more:
    • Name & objective — one SMART sentence.
    • 2–3 core agent tools — what functions it needs (e.g. search, run_query, summarize).
    • Data sources — a Kaggle dataset, an API, or pasted text.
    • Expected outputs — what a working demo shows (a number, a chart, a summary).

Checkpoint

Your task is "convert 200 files to uppercase." Every step is fixed and the input is tidy. Script or agent — and why?

An agent — LLMs are smarter, so always use one. A script — the steps are fixed and the input is tidy, so it's cheaper and fully reliable. An agent — so it can decide the steps itself.

When you can write down every step and the input is predictable, a deterministic script wins: same output every time, no per-token cost, instantly testable. Save the agent for open-ended, messy, or reasoning-heavy jobs. Use the simplest thing that works.

⚡ Energizer · Script or Agent? The Sorting Showdown

Before the build, spend 10–14 minutes making the deterministic-vs-agentic call fast and physical — teams race to classify real tasks and defend their choice on cost, reliability, and flexibility.

Run it · 10–14 min · teams with paddles

The Sorting Showdown

Coach reads task cards out loud — "convert 100 files to uppercase," "research 3 colleges and email me a comparison," "add two numbers," "monitor news and alert me when my topic trends." Teams race to hold up a SCRIPT or AGENT paddle and defend the choice using the trade-off. Round 1 is obvious cases; Round 2 is tricky hybrids built to spark debate. The point lands on its own: use the simplest thing that works.

Coach: open the printable card → Script or Agent? — The Sorting Showdown (green energizer sheet, ready to print).

Homework & deliverables


Recap. A script is cheap, predictable, and fixed; an agent is flexible but pricier and less predictable — so use the simplest thing that works. You built a DataExplainer with three tools (describe, query, chart) over the Titanic data, and scoped your own project with SMART into a finished charter. Next week: you build it for real.