STAT 133
  1. Tools
  2. Posit Assistant
  • Home
  • Syllabus
  • Office Hours

  • Projects
    • Sampson’s Monks
    • Zero Emission Vehicles
    • Your Life in Data
    • Gerrymandering
    • Build a Package
    • Second Opinion

  • Problem Sets
    • PS 1
    • PS 2
    • PS 3
    • PS 4
    • PS 5
    • PS 6
    • PS 7

  • Tools
    • DataHub
    • Shell
    • R
    • R App
    • Git
    • Positron
    • OpenRouter
    • Code Completion
    • Posit Assistant
  1. Tools
  2. Posit Assistant

Posit Assistant

Posit Assistant logo

Posit Assistant is an AI agent built into Positron. You chat with it in a panel beside your code, and, unlike a plain chat window, it can act: it reads the files in your folder, looks at the objects in your R session, runs R code and shell commands, and edits files. You decide how much of that it may do without asking.

Posit Assistant needs a language model to work with. While you can pay for an API key from a commercial provider like OpenAI or Anthropic, you can get access to models for free through two methods.

  • NRP (recommended). The National Research Platform hosts open-weight models on computers at UCSD and gives them to the class for free, with no monthly limit. You join the class on NRP with a link that was emailed to you, and get an API key.
  • GitHub Copilot. The models that come with your GitHub Copilot plan. Copilot Free allows about 50 chat requests a month.

1. Before you start

  • Update Positron to 2026.11 or later with Positron → Check for Updates… (macOS) or Help → Check for Updates… (Windows). Older versions don’t have the menus used below.
  • Open a project folder in Positron (File → Open Folder). Posit Assistant works inside the open folder.
  • If Positron shows a Restricted Mode bar at the top of the window, click Manage, then Trust, so the assistant can run code in this folder. Only trust folders you created or cloned yourself.

2. Connect a model

  • NRP
  • GitHub Copilot

You need the join link from the course email. It isn’t posted on this site. The same email has a video that walks through these steps.

Get your API key

  1. Open the join link in your web browser.
  2. Log in to NRP. On the CILogon page, choose University of California, Berkeley and sign in with CalNet.
  3. The first time you log in, NRP asks you to accept its Acceptable Use Policy. Read it and accept.
  4. The Join a Training page says you’ve joined the class’s NRP group, ucb-stat133, and shows your API key. Copy the key, and leave the page open until you’ve pasted it into Positron.
Warning

Treat the key like a password. Anyone who has it can send requests as you. Never paste it into a script, a .qmd file, or a repository, and never post it on Ed.

If you lose the key, or it ends up somewhere public, open the join link again. You get a new key, which replaces the old one.

Your access through the join link ends on December 19, 2026, and the key stops working then.

Add the key to Posit Assistant

  1. Open the Command Palette (⌘ + Shift + P on macOS, Ctrl + Shift + P on Windows) and run Posit Assistant: Configure AI Providers.
  2. Under Custom providers, click Add custom provider.
  3. Fill in the form:
    • Provider name: NRP (you can’t rename it later)
    • Provider type: OpenAI Compatible
    • Base URL: https://ellm.nrp-nautilus.io/v1
    • API key: paste your key
  4. Click Add provider. NRP now appears in the list of providers. You can close the AI Providers screen.

Copilot doesn’t use an API key. Instead, Positron signs in to your GitHub account.

  1. Follow the Code Completion guide through step 3, so that Copilot is on for your GitHub account and connected to Positron. That connection is all Posit Assistant needs.
  2. If no Copilot models appear when you choose a model (step 4 below), open the Command Palette, run Posit Assistant: Configure AI Providers, and check that the GitHub Copilot row is connected.

3. Open the chat

Open the Command Palette (⌘ + Shift + P on macOS, Ctrl + Shift + P on Windows) and run Posit Assistant: Focus on Posit Assistant View.

The chat panel opens with a text box at the bottom.

4. Choose a model

Click the model picker in the bottom right of the chat box.

  • NRP
  • GitHub Copilot

Choose qwen3 under NRP. It’s NRP’s main model, and it handles the steps an agent takes, such as running code, well. If it stops partway through a task or never offers to run code, try gpt-oss.

NRP changes its lineup of models from time to time. If qwen3 isn’t in the list, see https://nrp.ai/llms for the current models.

NRP doesn’t limit how many messages you send, but each key can only generate so much text per minute. If you get an error with the code 429, wait a minute and try again.

Choose one of the models under GitHub Copilot.

Each chat message can use several model requests, because the agent works in steps. With Copilot Free you get about 50 chat requests a month, so pick a smaller, cheaper model while you learn. With Copilot Pro (through GitHub Education) you have more room. GitHub lists which models each plan includes and how many requests each one costs at https://docs.github.com/en/copilot/concepts/billing/copilot-requests.

5. Choose a mode

The mode picker in the status bar, at the bottom of the window, sets how much the assistant may do on its own:

Mode What it does Type
Ask Reads and searches only. It can’t edit files or run code; it shows you code to run yourself. /ask
Normal Asks for your approval before it runs code or edits a file. /normal
Auto A second model approves or rejects each action, and asks you only some of the time. This is the default. /auto
Plan Writes a plan for a larger change for you to approve before it starts. /plan
Cleaning Audits a data set and asks you about each cleaning decision before making it. picker

In this class, use Ask or Normal while you learn, so that you see every action before it happens. You can type the command in the chat box or use the picker, and you can switch at any point in a conversation.

6. Have a first conversation

Type a message and press Return. A good first message checks that the model can run code. In Normal mode, send:

How many rows does the mtcars data set have? Run R code to check.

The assistant shows you the R code it wants to run. Approve it, and it should answer 32. Then try something about your own work. For example, with a script from a problem set open:

What does each pipeline in this file do?

Along with your message, the assistant sends the model context:

  • Your R session. It sees the names and types of the objects in your environment, not their values. Click the eye icon in the status bar to turn this off.
  • Files you mention. Type @ in the chat box to pick a file or folder from your project. Click the paperclip to attach a file from elsewhere, or paste an image.
  • What it looks up. As it works, it may read more files or run code to inspect your data. Each step shows in the chat.

When it wants to run code or change a file (in Normal mode), it shows you exactly what, with buttons to approve or reject. Read it first. You can also run something yourself without involving the model: start a message with !r for R code (!r summary(penguins)) or ! for a shell command (! git status), and the result joins the conversation.

7. Manage the conversation

  • New chat. Run Posit Assistant: New Chat to start fresh. A new chat starts with empty context, which often works better than a long one that has wandered.
  • Token counter. The counter in the status bar shows how much of the model’s context window the conversation is using. Click it for a breakdown. When the conversation gets close to the limit, the assistant summarizes the earlier messages to make room.

Tips

  • Commit before you let it edit. With your work committed in Git, you can see exactly what the assistant changed (git diff) and undo it.
  • Check its work with code you understand. The assistant’s answers are predictions, like every other model output. Run the code, look at the result, and ask yourself whether it’s right.
  • Give context, not just a question. Name the data, the columns, and what you’ve already tried.
  • Keep private data out of the chat. What you send, and what the assistant reads from your files and R session, goes to NRP or GitHub. NRP doesn’t allow protected data, such as health or student records, on its machines.
  • Posit Assistant changes quickly. If a button or command here has a different name in your version, see the Posit Assistant docs.
 
  • License