Skip to content

btw Addin cannot access R Environment / session objects (unlike btw_app()) #179

@muuksi

Description

@muuksi

Summary

There is a functional discrepancy between launching the btw chat interface via the RStudio Addin vs. calling btw_app() directly: the Addin does not have access to the current R session environment, making env and session tools non-functional when used through the Addin.

Expected behavior

The btw RStudio Addin should behave equivalently to btw_app() with respect to tool availability, including access to the current R environment and session objects (e.g., loaded data frames, model objects, defined variables).

Actual behavior

When launching via the RStudio Addin:

  • The tool selection UI correctly reflects the btw.md configuration (e.g., tools: [docs, env, session])
  • However, the env and session tools appear to have no access to the live R GlobalEnvironment — objects present in the session are not visible to the LLM

When launching via btw_app() in the console:

  • Full access to the current R environment works as expected
  • However, btw_app() blocks the R session, making parallel work in RStudio impossible

This creates a forced trade-off with no good solution:

  • Addin → non-blocking, but no environment access
  • btw_app() → environment access, but session is blocked

Environment

R version: 4.5.2
Platform: macOS (Apple Silicon)
RStudio version: 2026.4.0.347
btw version: 1.1.0
ellmer version: 0.4.0

questions

  • Could the Addin be modified to run in the same R process (or share environment state) rather than as a separate process?
  • Alternatively, could btw_app() gain a background = TRUE argument that launches non-blocking (e.g., via rstudioapi::jobRunScript()) while retaining environment access?
  • Or could environment snapshots be serialized and passed to the Addin process at launch time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions