Classwork 7
Agentic AI Workflow for Research Projects
In Lecture 8, we practiced using a coding agent to inspect a synthetic wildfire dataset. Apply the same process to your own research project. Choose a small task that answers a specific question about your data or helps you decide what analysis is feasible.
Work in your own project folder with course-approved public data. Use a synthetic sample if your project data are still pending. Keep raw files intact and keep credentials, private feedback, and restricted data out of the agent’s workspace. If you lack access to a coding agent, use the prompts as a checklist and complete the R workflow yourself.
1. Choose one research task
Pick the row that matches the current state of your project. Use a small sample with a documented date range or geography so that you can inspect individual records.
| If you need to… | Produce one artifact | Check it independently |
|---|---|---|
| Understand a new data source | An intake audit with row counts, key coverage, and missingness for key fields | Look up the unit and missing value codes in the source documentation and recount one quantity for a small subset. |
| Combine two data sources | A joined sample with a report of unmatched keys and changes in row counts | Trace a matched key and an unmatched key back to the inputs, if both exist. Check whether any observation gained rows. |
| Describe a pattern | A figure or table with units, sample coverage, and a short caption | Recompute one plotted point or table cell from the input and check which rows were included. |
| Prepare a model | A table of sample coverage, missingness, and candidate predictors | Check the baseline sample against the proposed extension. For prediction, verify that a predictor is available when a prediction would be made and that the split respects the relevant time or geographic groups. |
Fill in this task card in project-plan.md or your existing project notes before you prompt the agent.
Research question and the decision this task will inform:
Input path(s), source(s), and version or download date:
Observation unit, expected key, and sample boundaries:
One output and its path:
Two checks and what each should show:
A definition or decision I need to make before implementation:
When to stop and ask me:
For example, if a transport dataset uses one row per airport and day, a task could audit one month of observations and count days with a reported cancellation measure. A missing record and a recorded zero have different meanings. Consult the source documentation before deciding how either enters the denominator.
2. Ask for a plan and review it
Give the agent only the project files needed for this task. Replace the brackets in the prompt with your paths and decisions.
Read [task card] and [source documentation]. Inspect [approved input paths] without editing them. Summarize what each row represents, how the key is stored, and how the inputs cover my sample. Propose one R script to create [output path] and report [two checks]. Identify any assumption about units, missing values, or matching that I need to resolve. Stop after the plan and wait for my decision.
Read the relevant source documentation yourself. Choose one substantive rule, such as the eligible dates, the definition of exposure, or the handling of unmatched observations. Write down the choice and the evidence supporting it before asking for implementation. If the source leaves the rule unclear, narrow the task to documenting the ambiguity.
3. Implement and run the script
Implement the reviewed plan in [R script path] using [my approved rule]. Read the raw inputs without editing them. Write the artifact to [output path] and save the checks to [check log path]. Run the script from the project root. Report the exact command and actual check results, including any failure. If the input conflicts with the approved rule, stop and report the conflict.
Use your project’s existing folder structure. For a new script, R/07_project_task.R and output/checks/week12.txt are suitable example paths. An example command to run from the project root is:
Rscript --vanilla R/07_project_task.R4. Check the work yourself
- Read the changes and check that the script uses your approved sample, units, and definitions. Explain what it does in your own words.
- Rerun the script yourself. Compare the saved artifact and check log with the criteria on your task card. Record failures or checks you could not run.
- Independently verify one number or matching decision from the input. Use a hand calculation or a short R expression separate from the new script. If it disagrees with the output, trace the difference before using the result.
- Record your decision in
lab-notebook.mdor your project notes. State whether you accept the artifact for its intended use, need a revision, or need more information. Keep the exact command, what you observed, one limitation, and your next step.
Bring to class discussion
- Your task card and the R script with the command that runs it.
- One artifact and the log of checks that actually ran. If a check blocked completion, bring the failing check and the evidence you have.
- A short notebook entry stating what the agent helped with, what you decided and verified yourself, and how the result informs your next research step.