Agentic workflows

Programming with LLMs for Data Practitioners

Julia Silge | Posit PBC

Hello!

@juliasilge

@juliasilge.com

juliasilge.com

Day 2: Build with AI

  1. Intro to AI coding assistants
  2. Working in your editor
  3. Steering and extending
  4. Agentic workflows (this session!)

The top of the ladder

  • We climbed from web chat to an assistant that plans and uses tools
  • Now we hand it more rope and let it work more autonomously
  • And yesterday’s question comes back: how do you know it is doing the right thing?

The terminal agent

Same model, more hands-off

  • pa is Posit Assistant in the terminal
  • Interactive, or headless: give it a task and walk away
  • The most autonomous surface: no editor, just a goal and tools

Demo

pa

Watch the loop! It reads, acts, checks the result, and keeps going.

How much rope?

The autonomy dial

  • /restricted: confirm every tool call
  • default: ask before risky actions
  • /sandbox: isolate shell commands
  • /yolo: run without asking

Where should you sit?

  • Read tools are cheap to allow while write and shell actions are where to be careful
  • Match autonomy to the stakes: how reversible is a mistake?
  • High for throwaway exploration, low when it can overwrite or publish
  • This is the answer to yesterday’s question:
    • You choose how much it can do without you

Staying in control

Be the reviewer

  • An agent is only useful if it can act, but you decide if it acted right
  • Check its claims against the data
    • Do the counts add up? Does the map use the reprojection?
  • Tests and validation are guardrails
    • They catch the agent, and they catch you
    • Ask the agent to write them, and use them!
  • This is the antidote to “never really learn”
    • Stay in the loop, read the plan, review the code

Reproducible by default

  • /report turns the whole conversation into a Quarto document
  • Code is the most auditable way to explore data with AI
  • Your exploration is reproducible, not a black box

Let it build

Discover, then build

  • The payoff of the whole day! Give the agent a goal and let it deliver
  • Bring everything you set up: the plan, the memory, the codebook, the reprojection

Your turn

Activity

Build a crash safety report with the agent:

  • Give it a goal, like “a short report on when and where severe crashes happen in Utah”
  • Let it plan and work more autonomously than before
  • Review it: spot-check a claim against the data, and confirm any map used the reprojection
  • Save it with /report so your work is reproducible
20:00

Wrap-up

What we built today

  • From web chat to in-editor help to an agent that plans, uses tools, and builds
  • One crash dataset, one assistant, the whole climb from assisted to autonomous
  • The skill that matters most is staying in control
    • Use context, plans, tests, review

Sitting with the tension, still

  • We considered the promise and the harm at the same time on Day 1, and that has not changed
  • These tools are powerful, and you now have ways to use them on your terms
  • Keep learning by staying in the loop, not by handing it the wheel

Your turn

Activity

  • What is the first thing you will try when you get home?
  • What is one worry you still have?
  • Share with a neighbor, then we will hear a few
10:00

Keep building

Thank you for spending two days building on AI and with AI!

Thanks!

@juliasilge

@juliasilge.com

juliasilge.com