Install

Up and running in two minutes.

Rgent is an R package. Paste these lines into the RStudio console. It opens in the Viewer pane.

Need an access code first? Start the free trial.

# 1. Install (once) install.packages("rstudioai", repos = c("https://nathanbresette.r-universe.dev", "https://cloud.r-project.org")) # 2. Start Rgent library(rstudioai) run_rgent()

Then paste the access code from your email into the pane. Rgent remembers it on this computer.

What happens next

  1. It signs in by itself

    After the first time, Rgent starts with your saved code. Type /logout in the message box to use a different code.

  2. It starts with RStudio

    After the first start, Rgent opens by itself whenever you open RStudio. Nothing to set up.

  3. It updates itself

    Once a day, a few seconds after it opens, Rgent checks GitHub for a new version and installs it. Restart R to load it.

Requirements

  • R 4.0 or newer
  • RStudio Desktop or RStudio Server (Rgent uses the Viewer pane)
  • An internet connection for replies
  • Works with R scripts, R Markdown and Quarto documents

Troubleshooting

Still stuck?

install.packages() can't find rstudioai
Check that R can reach nathanbresette.r-universe.dev (some campus or company networks block unfamiliar sites), then run the install again. If it's blocked, install from GitHub instead: install.packages("remotes"), then remotes::install_github("NathanBresette/Rgent-AI", upgrade = "never").
could not find function "run_rgent"
Load the package first with library(rstudioai). Note the package name: it's rstudioai, not Rgent.
Nothing appears in the Viewer pane
Open the Viewer tab (bottom-right pane by default) and run run_rgent() again. Update RStudio if it's very old. If another R session already uses port 8888, close it or restart R.
"HTML file not found" or odd errors after an update
The package was updated while R had it loaded. Restart R (Session → Restart R) and run library(rstudioai) again.
"Invalid access code"
Copy the code again from your email, with no spaces around it. Check your usage on the Account page, or recover the code by email.
How do I uninstall?
Run remove.packages("rstudioai"). If you set up auto-start, delete the Rgent lines from your ~/.Rprofile. Saved chats and your saved code live in tools::R_user_dir("rstudioai"); delete that folder to remove them.