Shared REPL sessions for coding agents
agent-repl lets you and your coding agents work in the same running Python, Julia, R or other session (see the list below). Agents can use the variables and functions you define, and you can inspect or change theirs as you work.
In this one-minute example, Pi integrates a Lorenz trajectory and stores it as a. The operator adds b from a nearby starting point, then Claude Code uses both arrays to plot their separation.
Open video Python example Browser preview
Details of the demo
The imports and Lorenz function are loaded before filming. The Python example includes that setup. The typing is automated. The agents’ replies and the code they run are real, recorded in real time.
- Pi integrates a Lorenz trajectory, stores it as
aand plots the attractor. - The operator sends
b = odeint(lorenz, [1.0001, 1, 1], t)with!agent-repl-py, from Pi’s shell mode. - Claude Code uses
aandbto plot how their separation grows. Both plots appear inline on the REPL page.
Fortran
Here is the same demo in Fortran, using LFortran’s interactive kernel. You send cells with agent-repl-f90, the agents send theirs through their tools, and they all run in the same kernel. This is experimental while LFortran’s REPL matures.
Pi integrates an orbit and plots it with fplotlib. The operator adds a second orbit from a nearby start, then Claude Code plots how far apart they get.
Open video Fortran example LFortran notes
Details of the Fortran demo
A setup cell, sent before filming, loads fplotlib and defines a Runge–Kutta step and an orbit subroutine. fplotlib is built with the same LFortran, and its module files sit in the session’s folder. The step is written in scalars, because LFortran’s REPL can’t yet link some array temporaries from one cell to the next. The Fortran example includes the setup. The typing is automated. The agents’ replies and the code they run are real, recorded in real time.
- Pi runs
call orbit(1d0, x, y, z)and plots the attractor with fplotlib’sscatter. - The operator declares
x2,y2andz2and runscall orbit(1.0001d0, x2, y2, z2), in one line with!agent-repl-f90, from Pi’s shell mode. - Claude Code computes the separation as one array expression and plots it with
semilogy. Both plots appear inline on the REPL page.
Installation
agent-repl supports Python or IPython, Julia, R, Haskell (GHCi), Clojure, Ruby (irb), Java (jshell), C++ (cling), Octave, MATLAB, gnuplot and, experimentally, Fortran (LFortran). Each has a shortcut for sending code, such as agent-repl-py or agent-repl-f90.
You need Node.js 22 or later, tmux and the runtime you want to use. To install agent-repl and start Python:
npm install -g agent-repl
agent-repl python -d
Add the tools to Claude Code:
claude mcp add --scope user agent-repl -- agent-repl mcp
Ask Claude Code to use the shared Python REPL. To work at the same prompt yourself, run agent-repl attach python in another terminal. The Lorenz example also needs NumPy, SciPy and Matplotlib.
The setup guide covers Codex, OpenCode and other MCP clients.
Pi and the browser preview
agent-repl uses pi-repl’s session handling outside Pi. Inside Pi, use pi-repl to connect to the same sessions.
For a browser view of submitted code and saved plots, use agent-markdown-preview with --repl, as shown in the video.
Code runs with the REPL’s permissions. See the privacy and safety notes before connecting an agent.