Your First Agent Task in 15 Minutes
Hands-on: hand an agent a real multi-step task, watch it plan, use tools, and verify its own work — then learn what just happened.
Enough theory. In the next 15 minutes you're going to hand an agent a real, multi-step job: generate a messy spreadsheet of expenses, write a program that cleans and summarizes it, prove the program is correct with a test, and write up the results. You won't type a line of code.
Along the way you'll watch the agent do the three things that make agents useful: plan before acting, use tools to read, write, and run things, and verify its own work. Then you'll check its work yourself, ask for a change, and learn exactly what happened behind the scenes. This is the core workflow you'll use for the rest of the course, whether the task is code, research, or a quarterly report.
Before you start
You need the coding agent you installed in Setting Up Your Agent Toolkit. The examples show Claude Code, but Codex, Cursor, and other agents work the same way; only the look of the screen differs.
Create a fresh folder for this task and turn on git, so every change the agent makes can be seen and undone:
cd agent-course
mkdir first-task
cd first-task
git initgit init tells git to start tracking this folder. It's empty for now, which is the point: anything that appears was made by the agent.
Now start your agent inside the folder:
claude(If you use Codex, run codex. In Cursor, open the first-task folder and the agent panel.)
Step 1: Give the agent the task
Copy this prompt exactly and paste it into the agent. You'll learn why it's written this way at the end of the lesson.
I'm practicing working with an AI agent. In this folder, please:
1. Create a realistic sample file, expenses.csv, with about 40 rows of
personal expenses for September and October 2026. Columns: date,
description, category, amount. Make it messy on purpose, like a real
bank export: some categories with inconsistent capitalization
("groceries" vs "Groceries"), two rows with a missing amount, one
exact duplicate row, and some amounts written with a dollar sign.
2. Write a script, summarize.mjs, that reads the CSV, cleans it up, and
prints total spending per category per month. It should also report
how many rows it skipped or merged, and why.
3. Write a test, summarize.test.mjs, using Node's built-in test runner.
It should check the totals against a small hand-written CSV where the
correct answer is known in advance.
4. Run the test and the script. If anything fails, fix it and run again.
5. Write report.md with the summary table, the three biggest spending
categories, and a short note on the data problems you found.
Use only Node.js built-ins, no npm packages. Before you start, show me
your plan in a few bullet points and wait for me to say "go".Step 2: Review the plan
The agent should reply with a short plan instead of diving in. It will look something like this:
Plan:
- Create expenses.csv with ~40 rows across Sep and Oct 2026, including
the requested messiness (mixed-case categories, 2 missing amounts,
1 duplicate, some "$" amounts)
- Write summarize.mjs: parse CSV, normalize category case, strip "$",
skip rows with no amount, drop exact duplicates, group by month and
category, print a table plus a list of skipped/merged rows
- Write summarize.test.mjs with a tiny fixture CSV and known totals,
using node:test and node:assert
- Run node --test, then node summarize.mjs; fix any failures
- Write report.md from the actual script outputRead it like a manager reading a colleague's plan. Does it cover every part of the request? Did it understand "messy on purpose"? Is it planning to write the report from real output rather than making numbers up? If anything is missing or wrong, say so now. Correcting a plan costs one sentence; correcting finished work costs much more.
When you're happy, reply:
Looks good. Go.
Step 3: Watch it work
Now the agent runs its loop. You'll see a stream of steps scroll by: messages about what it's doing, files being created, and commands being run. A typical run looks roughly like this:
● Write(expenses.csv) created 41 lines
● Write(summarize.mjs) created 74 lines
● Write(summarize.test.mjs) created 38 lines
● Bash(node --test)
✖ totals per category per month
Expected Groceries 2026-09: 54.25, got 0
● Read(summarize.mjs)
The test fixture uses "Sep 3, 2026" style dates but the parser
expects 2026-09-03. I'll handle both formats.
● Edit(summarize.mjs)
● Bash(node --test)
✔ totals per category per month
✔ skips rows with missing amounts
✔ removes exact duplicates
● Bash(node summarize.mjs)
...summary table...
● Write(report.md)Your run will differ in the details, and that's normal. Agents aren't scripts; they take slightly different paths each time. What matters is the shape.
Approving actions
Most agents ask your permission before they edit files or run commands, at least until you tell them otherwise. You'll see a prompt asking whether to allow an action, often with options to allow it once or to allow similar actions for the rest of the session.
For this task, it's safe to approve file edits in this folder and commands like node --test and node summarize.mjs. As a rule for now: read every command before approving it. If you see something you don't understand, especially anything that deletes files, touches folders outside your project, or installs software, decline and ask the agent what it's for. Module 4 covers permissions properly.
Step 4: Check the work yourself
The agent will finish with a summary: the files it created, that the tests pass, and what it found. That's a claim, not proof. Spend three minutes verifying it. This is the most important habit in the course.
Run the test yourself
Open a second terminal window in the first-task folder (or exit the agent) and run:
node --test
node summarize.mjsYou should see the tests pass and the summary table print. Now you've seen it with your own eyes.
Spot-check one number by hand
Open expenses.csv in your editor or a spreadsheet app. Pick one category in one month, say Groceries in September. Add up those rows yourself, ignoring any with a missing amount and counting the duplicate only once. Does your total match the script's output?
If it matches, great. If it doesn't, you've found something real, and you know exactly what to tell the agent.
Look at what changed
Ask git to show you every file the agent touched:
git statusYou should see the four files you asked for (plus, perhaps, a small fixture CSV for the test), and nothing else. An agent that quietly creates extra files, or edits files you didn't mention, is worth noticing. When you're satisfied, save a snapshot:
git add -A
git commit -m "First agent task: expense summary"Now, whatever happens next, you can get back to this exact state.
Step 5: Ask for a change
Real work is iterative. Go back to the agent and make a follow-up request:
Nice work. Two changes: 1. Add an "average per transaction" column to the summary table. 2. Make the script accept the CSV file path as a command-line argument, defaulting to expenses.csv. Update the tests to cover both changes, run them, and update report.md.
Watch how it handles this. A good agent reads the existing files first instead of rewriting from scratch, extends the tests, and re-runs everything. Afterward, run git diff to see exactly which lines changed since your snapshot. Reading a diff, a line-by-line comparison of before and after, is how you'll review agent work for the rest of the course.
Now that you've done the guided version, test the agent's verification habit.
- Open
expenses.csvand add a row with a new category written three different ways, for exampleDining,dining, andDINING, with a trailing space on the last one. - Ask the agent: "I added some rows to expenses.csv. Re-run the summary, make sure the categories still group correctly, and add a test for whatever edge case you find."
- Check whether it noticed the trailing space, added a test for it, and updated the report.
Success looks like: all three spellings are merged into one category, a new test covers the trailing-space case, the tests pass when you run node --test yourself, and git diff shows changes only to the files you'd expect.
What just happened
Step back and look at what you saw. Every piece maps to the definition from What Is an AI Agent, Really?.
| What you saw | What it was |
|---|---|
| The agent proposed a plan before acting | The model thinking before its first action, because you asked it to |
| Files appearing, commands running | Tools: a write-file tool, an edit tool, a shell tool |
| A failing test, then a fix, then passing tests | The loop: act, observe the result, think again |
| Permission prompts | The program around the model deciding which tool calls need a human |
| "All tests pass" in the final summary | The agent's claim, which you then verified |
The test was the hero of this run. It gave the agent a way to know, objectively, whether its code worked. Without it, the agent would have produced code that looked plausible and told you it was done. With it, the agent caught a real bug (in the sample run, a date format mismatch) and fixed it before you ever saw it.
Why the prompt worked
The prompt you pasted wasn't long, but it had four ingredients that you'll see again and again:
- A clear goal: a cleaned summary of expenses, with a report.
- Context: what the data looks like, including which kinds of mess to expect.
- Constraints: Node.js built-ins only, no packages; wait for approval before starting.
- A definition of done: tests pass, the script runs, and the report is written from real output.
Compare that to "make me an expense tracker". The agent would have had to guess what you wanted, how messy the data was, whether to install packages, and when to stop. Every guess is a chance to go wrong. Module 2's lesson on writing tasks an agent can finish turns these four ingredients into a repeatable template.
- The core workflow is: give a clear task, review the plan, let the agent work, verify, then iterate.
- Ask for a plan first; correcting a plan is far cheaper than correcting finished work.
- Read commands before approving them, especially anything that deletes, installs, or reaches outside your folder.
- Tests and other checks let agents verify their own work, which is what makes them reliable.
- Always verify the final claim yourself: run the checks, spot-check a number, and look at what changed with git.
- Next, learn the mindset that turns this one-off success into a habit.