Agentic Research Workflows: AI Coding, Validation, and Research Responsibility

Plans, CLI agents, and a four-layer validation stack

This lesson introduces researchers to working with AI (artificial intelligence) coding agents without giving up the learning, feedback, checking and research judgement that make code trustworthy. AI changes what you need to practise. You spend less time recalling syntax and more time understanding intent, dependencies, assumptions, tests and failure modes.

The lesson does not replace research thinking, and it does not aim to code faster. It teaches you to judge whether AI-generated code is correct for your data and your research question, and to document that judgement so the work can be reproduced.

From vibes to research judgement


“Vibe coding” is an informal term for guiding AI with natural-language prompts and intuition. Intuition is where people start, but research demands evidence as well as output. This lesson teaches a workflow built around recorded requirements, a validation stack and an explicit approval gate.

Throughout, “orchestration” means active review and not passive delegation. You stay the reviewer, tester and domain judge.

What the workflow asks of you

  • You read the code, question its assumptions and decide whether it is correct. A short instruction file (CLAUDE.md) records the constraints it must follow.
  • You define what the data should look like, and why, before generation. Then you can tell when the generated code drifts from your intent.
  • A result is not done because it runs. It is done when you can explain it and show evidence that it is correct.

What it does not do

  • It does not validate your research question or choose your methods.
  • It does not detect subtle statistical or causal errors by default.
  • It does not reduce your responsibility for the final output.

Using AI to generate code is research-adjacent work. It becomes research when it sits inside a process of validation, documentation and justification.

Three ways of working with AI


You practise three methods on one synthetic dataset:

  1. Ask AI to help you understand. Predict what a script does, ask for an explanation, and compare it with the data.
  2. Delegate one small change. Read the plan, the action and the diff, and compare the result with an expectation you chose yourself.
  3. Test and hand off a result. Write a check, show that it fails on bad data, and have another person rerun your work without AI.

Two ways to use this lesson


  • A four-hour pilot route for researchers who use basic Python and tabular data. The instructor notes give the timed agenda.
  • The full eight-episode course, about nine and a half hours of material before breaks and installation.
Prerequisite

Prerequisites

  • Basic familiarity with the command line.
  • Python with pandas. You have cleaned a CSV and can read a short script that selects columns, filters rows, handles missing values and parses dates.
  • No prior experience with AI coding agents is needed.
  • No account? A saved-output route lets you follow the same tasks and checks.

Learning objectives


At the end of this lesson, you will be able to:

  • Tell code generation, code understanding and code validation apart, and explain why AI-generated code can raise a novice’s cognitive load.
  • Use a CLI agent with a short instruction file (CLAUDE.md) to plan and generate research code, reviewing each step instead of accepting it wholesale.
  • Validate an AI-generated result with runnable checks (invariants and domain plausibility), show that a check fails on bad data, and decide whether to approve, revise or reject.
  • Document an AI-assisted workflow (requirements, checks, environment, commands and provenance) so another researcher can rerun and judge the result.

Acknowledgements


This lesson is adapted from the workshop “Vibe Coding for Research” developed by Bruno Smaniotto and Tom van Nuenen at the UC Berkeley D-Lab.

The original materials are at dlab-berkeley/Vibe-Coding-for-Research.

To follow this lesson you need Claude Code and Python on your machine. Claude Code is Anthropic’s terminal-based AI coding agent. The steps below set up a direct local install.

If you cannot use Claude Code, for example because you have no supported account, you can still follow the lesson. Ask your instructor for the saved-output route. It uses the same terminal and Python files, with saved plans, diffs and command transcripts. You make the same approval decisions and run the same checks.

Allow 20 to 30 minutes before the workshop for this setup. Your instructor may run a separate setup clinic.

1. Install Python and two Python packages


  • Python: use the workshop’s tested environment and the exact versions your instructor gives you. Current Matplotlib needs Python 3.11 or newer. Check with python --version.
  • Python packages: the lesson scripts use pandas for data and matplotlib for the plot. Install both in a project environment and not globally. A venv, pixi or uv environment all work:

BASH

python -m pip install pandas matplotlib

A bare, unpinned install is not an environment record. Your instructor will give you the tested versions to record.

2. Install Claude Code


Use the native installer first:

BASH

curl -fsSL https://claude.ai/install.sh | bash

On Windows, use irm https://claude.ai/install.ps1 | iex in PowerShell. The shell examples in the lesson use Unix commands, so ask your instructor which route they have tested on Windows. If your institution requires npm, that works too and needs Node.js 22 or newer:

BASH

npm install -g @anthropic-ai/claude-code

3. Authenticate


Confirm a supported account before the workshop. Claude Code can sign in with a Claude subscription or an Anthropic API key, and your organisation may offer other routes. These are not the only options. Subscription usage and API billing differ. A plan name does not promise that you can complete the workshop. Your instructor provides a fallback if access or quota fails.

BASH

claude

On first launch, Claude Code walks you through signing in. It stores your credentials locally.

4. Get the project folder


The lesson works in one project: a small, messy, synthetic water quality dataset. The data describe no real study. Download the coastal-water-quality folder from the lesson repository under learners/files/coastal-water-quality, or use the copy your instructor provides. Then move into it:

BASH

cd coastal-water-quality
ls data/

You should see site_A.csv, site_B.csv and site_C.csv. Start Claude Code from inside this folder throughout the lesson.

5. Setup check


A version number confirms that the program is installed. It does not confirm that you can use it. Run these from inside the coastal-water-quality folder:

BASH

pwd                       # the folder you are working in
claude --version          # prints a version number
python --version          # prints Python 3.11 or newer
python -c "import pandas, matplotlib; print('packages ok')"   # prints: packages ok
ls data/                  # site_A.csv  site_B.csv  site_C.csv

Then confirm account access with one read-only agent action:

BASH

claude -p "List the files in data/. Do not change anything."

If the files come back, you are ready. If any step fails, see the troubleshooting notes below, or tell your instructor so you can use the saved-output route.

Callout

Troubleshooting

  • claude: command not found: the install did not finish, or your PATH is not updated. Re-run the install command and restart your terminal, or run claude doctor for a diagnostic.
  • ModuleNotFoundError: No module named 'pandas': the packages went to a different Python than the one you run. Use the same interpreter: python -m pip install pandas matplotlib.
  • Claude Code asks you to sign in again: that is normal on a new machine. Sign in once.
  • The agent writes different code than the lesson shows: that is expected. AI output varies. The lesson teaches you to check it and not to match it. If you fall behind, your instructor can share a known-good script from instructors/files/.
Callout

Use the same model, and record it

Inside a Claude Code session, the /model command sets the model. Select the same available model as the rest of the class so outputs are comparable. Then record the resolved model name, the Claude Code version and the relevant settings, which /status shows. An alias or an identical selection does not guarantee identical output.

Caution

Security and working directory

Claude Code runs in your terminal and works with the files in your current folder. Starting in a project folder sets its working context. It does not by itself create a security boundary. Check what the agent can read, write and reach on the network, and which integrations are on. Some habits:

  1. Start from a dedicated project folder, not your home folder.
  2. Keep files under version control (Git) so you can revert a change.
  3. Do not start it in a folder with credentials, private data or sensitive system files.
Callout

Running in a sandbox (optional, and untested)

Some researchers isolate the agent from their personal files. The repository’s Dockerfile and .devcontainer/ are a starting point, but they have not been rebuilt and smoke-tested with the current Claude Code. Do not rely on them for a workshop. The devcontainer uses its own image and does not use the Dockerfile.

Claude Code’s Bash sandbox does not cover every file tool, MCP server or hook, and native Windows and WSL2 differ. Test the exact route you plan to offer. Options to know about:

UCLA published no guidance on agent sandboxes when we checked in October 2026. If your research needs one, ask grc@ucla.edu, and do not assume that a sandbox you build yourself is approved for sensitive data.

You do not need any of these for this workshop.

Institutional context and access


Read this section before you use these tools with real research data. Your institution decides which AI tools are approved for which kinds of data.

In this workshop, use only the supplied synthetic data. Do not read permission for institutional research data into a personal subscription or into the name of a campus-approved product.

At UCLA, consult the current campus tool comparison for eligibility, price and data classifications. Approved access is tied to a UCLA account and a specific service. The campus tools listed there are not terminal agents, so they cannot run this lesson. When we checked in October 2026, UCLA listed its Anthropic products as “coming soon” and published no guidance on terminal coding agents or on sandboxes for agents. Check the page again before you rely on this.

UCLA’s footnote on that page says P1 to P3 data are allowed in a UCLA account, and P4 data need approval from the Unit Head and the Chief Information Security Officer (CISO). The protection levels come from the UC Protection Level Classification Guide. For example, it lists student education records (FERPA) at P3 and protected health information at P4.

UCLA’s AI use and recommendation guide says some data must not go into AI tools “unless explicitly approved in a secure environment”: FERPA-protected student information, HIPAA-protected health data, employee personnel data, unpublished research, intellectual property and grant proposals, and export-controlled data. Send questions about these to grc@ucla.edu, the intake address that guide names.

To use a backend with sensitive data, first get confirmation from the responsible campus or unit authority for the specific account, configuration and data category. UCLA’s guide lists Amazon Bedrock models, including Claude, among its tools but gives no data tier for them. A tool that can run on a given cloud service, such as Amazon Bedrock, is not thereby approved for sensitive data.

The campus comparison excludes protected health information from the listed campus AI tools and points eligible UCLA Health users to nebulaOne. Check current policy for other restricted categories.

Callout

Consumer accounts, retention and local transcripts

Retention and data use depend on the account type, the provider and your settings. Check the current policy and do not assume.

  • On consumer accounts, a training preference affects how long Anthropic keeps data. Consult Claude Code’s current data usage policy for the present figures, because they change.
  • Claude Code also keeps local transcripts of your sessions on your machine.
  • Commands that share feedback or transcripts are a separate control from your training preference.
  • First-party API terms, third-party hosting terms such as those of a cloud provider, and your organisation’s settings all differ. Check the arrangement that applies to your backend. Do not apply one retention period to all backends. Cloud providers also describe the customer’s own configuration duties, for example in AWS data protection.