Week 3 · From building agents to choosing & scoping them
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.
What you'll walk away with
Part 1 · Theory (30 min)
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.
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.
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.
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.
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.
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.
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.
A flashcard maker, an essay-feedback coach, or a "explain this like I'm 12" tutor over your class notes.
An agent that reads a stats table and answers "who had the best 3rd-quarter shooting?" or charts a team's season.
A homework planner, a habit tracker that nudges you, or an inbox summarizer for your club emails.
Say your idea in one sentence and hit all five letters. Can't? It's too big — cut it down until you can.
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)
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.
Load the Titanic table with pandas, then give the agent a describe_dataset() tool so it can learn the columns before it reasons.
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}"
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?"
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%}"
Finally a plot_chart() tool using matplotlib/seaborn, so a question can be answered with a picture, not just a number.
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"
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
Time to turn your idea into a plan you'll build next week.
Checkpoint
Your task is "convert 200 files to uppercase." Every step is fixed and the input is tidy. Script or agent — and why?
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.
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
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).
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.