What tools does an agent need to work with data? How can we give agents those tools safely?
Decades of effort have gone into building rich interactive environments for people who work with data in R, Python, and SQL. Which of the affordances of these environments are also useful to agents? What new affordances would be helpful, both to agents and to the people supervising them? And which of these tools will continue to make sense as models get smarter?
We’re pleased to introduce MCP Console, a new open-source project that explores these questions. Console gives agents a persistent, sandboxed environment for working with data in R, Python, and SQL.
MCP Console is a standalone binary written in Rust that runs on macOS, Linux, and Windows. It works with MCP-compatible clients such as Codex, Claude Code, and Pi, as well as libraries and SDKs for building AI-powered applications.
At Posit, we’re also exploring different ways for people to work with agents. Projects like Posit Assistant and the Positron MCP tools bring people and agents together to collaborate in shared interactive sessions.
MCP Console approaches the problem from a different direction: it gives agents dedicated interactive sessions of their own, with a runtime interface designed solely for agents, including agents working unattended.
An interactive session for your agent#
“Finding the question is often more important than finding the answer,” wrote John Tukey in 1980. An analyst rarely knows at the outset every step an analysis will involve: what they discover along the way informs what they do next.
This is why so many of the tools that analysts prefer, like REPLs and notebooks, are built around a stateful session. With data and intermediate results still in memory, asking another question is often trivial.
In contrast, asking another question can be much more involved for an agent working through a shell tool. Each time the agent wants to run a snippet of R or Python code, it has to start a fresh process. Even a simple follow-up can mean editing a script or resubmitting code from previous turns, reloading the data, and repeating preprocessing steps — wasting time, compute, tokens, and context redoing work every turn.
When asking questions is expensive, fewer questions get asked. Making it cheaper to ask questions doesn’t just make the analysis faster; it can also lead to a different and better analysis.
Power and safety#
To give agents the freedom to explore data, Console gives them access to full R and Python runtimes and the large ecosystems of packages built around them. Without constraints, these tools would let agents execute arbitrary native code, run shell commands, access the filesystem, and make network requests.
An agent might run code that overwrites source data, deletes files unrelated to the task, or exposes sensitive information. It might do so because the model misunderstood a request, was misled by something it read, or loaded a package containing malicious code.
If we want to leave an agent working unattended, instructions about what it should or shouldn’t do are not enough. We need firm limits on what its code can access and change outside the runtime.
Console runs the agent’s code in an operating-system sandbox. The boundaries it establishes are walls, not signposts for the model: the operating system enforces limits on file and network access for all code run in Console, including any subprocesses it starts. Within its session, the agent is free to explore and manipulate data; what its code can access and change outside the session remains up to you.
By default, Console uses a built-in sandbox policy named read_only.
Under this policy, code running in Console can read files accessible to your account and work in private temporary storage, but it cannot create, modify, or delete files elsewhere nor access the network.
The default policy makes Console a safe complement to an agent’s existing tools, granting it rich computational capabilities without expanding its write or network permissions.
In practice, agents with access to other tools can often work comfortably within these restrictions.
For example, an agent might download a dataset using curl through its shell tool, where network access may be permitted (perhaps after approval), then return to Console to load and explore the data.
Similarly, an agent can use its editing tools to modify the source files of an R or Python package while using Console to develop and test it.
For tasks where you want to grant agents broader permissions within Console, we also provide a built-in workspace policy that allows writes in the project directory, with exceptions for sensitive locations such as .git and agent configuration files.
These built-in policies are starting points for a configuration system that supports layering global and project-specific policies. You can grant write access to selected directories, deny reads from sensitive paths, and allow network access to selected domains through a proxy.
Sandbox and permissions · Configuration
Installing packages on demand#
It’s rarely possible to anticipate every package an analysis will need. An interesting question might come up halfway through that calls for a particular statistical method, visualization, or file reader. Agents, like analysts, benefit from being able to reach for these tools as the need arises.
Sandboxing complicates this. Installing packages typically requires network access and permission to write to package libraries. We want agents to be able to request packages as they work without granting those permissions to the session, modifying your own R or Python environments, or asking you to approve every installation.
Console handles package installation separately from code execution. An agent can declare package requirements, implicitly or explicitly, and Console prepares the dependencies in a separate sandbox with its own permissions.
Following a pattern used by uv, reticulate, and ir, Console assembles lightweight, ephemeral environments that are essentially views over persistent local package caches.
Console can resolve packages dynamically as the session’s requirements evolve, giving agents the freedom to pull in packages on demand without weakening the runtime sandbox, modifying the environments you use for other work, or requiring you to approve installations or manually manage dependencies.
Packages can be added to a running session without forcing a restart or losing the work already in memory.
An interface for agents#
R and Python already have a rich set of facilities for interactive sessions, built and refined over decades by and for people who work with data. These include help systems, debuggers, introspection tools, package management facilities, and ways of working with plots.
Many of these facilities are a natural fit for agents. Models already know how to use them: examples of their use are likely abundant in the training data. But there’s another reason: they’ve stood the test of time as tools for working with data through a largely text-based, turn-based interface. As it happens, that’s also how agents interact with their tools.
Simply giving an agent access to an interactive R or Python session through a terminal, however, falls short in a few ways. The agent or its tooling has to infer when a computation has finished, often by polling the terminal, parsing prompts, or waiting longer than necessary. Other facilities, such as tab completion, aren’t particularly useful to agents in their existing form.
Rather than interact with the runtimes through a terminal, Console embeds them directly, giving it access to their internal state. It can report whether a runtime is idle, busy, or waiting for input, and return results as soon as they’re available, without parsing prompts or waiting for terminal output to settle.
We’ve also adapted many of the runtimes’ interactive facilities to the way agents work. Agents can browse help pages and vignettes without the repeated text that comes from navigating a pager designed for humans. Custom hooks into the graphics systems capture plots and return them as images, so agents can see and refine the plots they produce. An agent can drive a debugger, step through code, and inspect live objects. To protect agents from inadvertently flooding their own context with large amounts of output, Console truncates oversized responses and makes the full output available in overflow files that agents can read selectively.
Long-running computations and parallel sessions#
Console lets an agent manage multiple sessions in parallel. An agent can start a long-running computation in one session and continue working in another. It can monitor the computation’s progress, interrupt it, or restart the session if it hangs. With separate sessions, an agent can also pursue several lines of inquiry concurrently.
Which language?#
R? Python? SQL?
It’s the same question analysts have faced for years, and one we’ve written about before.
For many tasks, any of these languages will do. But some things are simply easier to express in one language than another. Sometimes it’s because of the language itself, sometimes because of a package, and sometimes because of the idioms that have developed within a language’s community.
This idea has motivated much of our work on language interoperability over the years, from the introduction of reticulate in 2018 to our collaboration on Apache Arrow. The easier we make it to move between languages, the more freely we can draw on the strengths of each and the work of their respective communities.
With agents, we have an opportunity to take this idea further. For most people, how well they know a language and its ecosystem weighs heavily in their choice of language. Today’s models, however, can write perfectly adequate code in R, Python, SQL, and most other common languages. Just like a polyglot programmer who is equally proficient in several languages, an agent can base its choice more on the tools available for the task than on familiarity with a particular language.
How often an agent can make that choice depends on the cost of switching languages. If the switching cost is low enough, an agent can choose a language anew at each step of an analysis. There is a parallel in human languages: people who speak multiple languages often switch languages mid-sentence when what they want to say is easier to express in another language.
To make switching languages inexpensive, MCP Console embeds R, Python, and SQL runtimes in the same process. An agent can create a data frame in R, query it directly with SQL, and work with it in Python, without writing intermediate files or reloading the data. Native bridges make it efficient to pass data between languages, often without copying it, by sharing views of the same underlying buffers. An agent can switch to another language for a single operation and then switch back.
The SQL interface uses an in-memory DuckDB database by default, and can also use existing database connections from R or Python.
Of course, your own familiarity with a language still matters, especially if you intend to develop or maintain the resulting code. An instruction as simple as “All else being equal, prefer R because I’m more familiar with it” can guide the agent’s choices. Console makes it easy for agents to work across languages, but works equally well as a pure R, Python, or SQL REPL.
Keeping a journal#
A scientist’s notebook is as much a tool for doing science as it is a record of it. It’s a scratchpad for planning an investigation, a ledger for tracking progress and recording findings as the work unfolds, and a durable record once it’s complete. The scientist or their colleagues can return to it to retrace how a result was discovered, revisit earlier lines of inquiry, and develop the work further.
We think it makes sense for agents to have this kind of notebook too.
By default, Console records every session as it happens, capturing code, outputs, plots, timings, and runtime events. The agent can also add notes alongside or between code submissions, treating the recording as an append-only journal. It can jot down observations, hypotheses, tentative conclusions, and leads worth pursuing. By capturing prose alongside code and results, Console provides a readable account of the investigation, preserving the false starts and dead ends as well as the discoveries.
The journal also gives you a way to engage with the agent’s work. Rather than relying solely on the agent’s summary, you can examine how it prepared the data, inspect the code and intermediate results, and see what other approaches it tried.
Console makes session recordings available in several forms.
A structured JSONL event log lends itself to programmatic monitoring, tracing, debugging, and model evaluation.
A Markdown document brings together the code, notes, and results in a readable account of how the investigation unfolded.
A Quarto (.qmd) projection captures the analysis in a reproducible document with package requirements declared inline.
To prepare the session’s packages and render the document, you can use ir render session-transcript.qmd.
Either the Markdown or Quarto document can also serve as a starting point for a report that you and the agent can review, refine, and develop further.
Equip your own agent#
We’ve designed MCP Console to be easy to integrate into other AI-powered applications.
Console provides the data workbench for your agent. It manages persistent sessions, package environments, sandboxing, and session recordings, and gives agents access to the runtimes and their interactive facilities. You’re free to use whatever model, SDK, or framework suits your application and manage the conversation however you like.
You can also tailor the interface Console presents to the agent. You choose which languages and tool arguments to expose, and you can customize the accompanying tool descriptions and prompts. You can initialize sessions with preloaded datasets or database connections and configure the sandbox permissions to suit your application. A database assistant, for example, might expose only SQL over a read-only database connection.
Console works with any MCP client, and its R and Python packages make it easy to integrate with a variety of libraries, agent frameworks, and model provider SDKs, including Ellmer, Chatlas, the Anthropic SDK, and the Codex SDK.
General-purpose tools#
An open question in designing tools for agents is which tools will remain useful as models get smarter.
Part of the appeal of a general-purpose language runtime is that we don’t have to anticipate everything an agent might want to do with data. An agent with access to R and Python can draw on decades of work by their communities, combine existing tools in new ways, and write tools of its own.
As models get better at programming and working with data, they can make increasingly sophisticated use of the same environment. The range of things an agent can accomplish with Console can grow considerably while the interface stays the same.
Get started#
Install uv if you don’t already have it.
For Codex and Claude Code, we provide one-time setup commands that configure the client for you and make Console available across your projects.
For Codex:
uvx mcp-console configure-client codexFor Claude Code:
uvx mcp-console configure-client claudeFor other MCP-compatible clients, register uvx mcp-console serve as a stdio MCP server.
Restart your client and you’re ready to go. Python and SQL work out of the box. To use R, you’ll need to have R installed separately.
A good way to get a feel for Console is to try it with an analysis you’re already working on. Ask your agent to explore some data using Console, follow up on something you find interesting, and have a look at the session recording.



