Repository navigation
Agents
The agent panel puts a coding agent beside the notebook. The agent reads the cells, changes them, runs them on your kernel and looks at the variables. You see each change at once.
The agent panel is new. If gpython says that
:agentis not a command, your gpython is older than this page.gpython --updategets the newest release.
On this page:
- What you need
- Open the panel
- Keys in the panel
- Choose the agent
- Choose the model
- What stays in the conversation
- What the agent can do
- Add another agent
- An agent in another terminal
- Settings
- Limits
gpython starts the agent; it does not install it. The agent must be installed and logged in before you use it here.
| Name | Agent | What gpython runs | What you need |
|---|---|---|---|
claude |
Claude Code | npx -y @agentclientprotocol/claude-agent-acp |
claude and npx
|
codex |
Codex | npx -y @agentclientprotocol/codex-acp |
codex and npx
|
opencode |
OpenCode | opencode acp |
opencode |
gemini |
Gemini | gemini --acp |
gemini |
pi |
pi | npx -y pi-acp |
pi and npx
|
npx comes with Node.js. For Claude Code, Codex and pi it gets a small adapter program the first time, so the first start is slower.
To check an agent, run its own command in a terminal (claude, codex, opencode, gemini, pi) and make sure that it answers.
| Command | Result |
|---|---|
:agent |
Show the panel and go to it. The first time, this starts the agent. From the panel, :agent hides it |
space a |
The same, from the editor's normal mode and from cell mode |
:agent codex |
Start that agent in a new conversation |
:agent new |
Start a new conversation with the same agent |
:agent stop |
End the agent. The conversation stays on screen |
:agent hide |
Hide the panel. The agent and the conversation stay |
Type what you want in the line at the bottom and press enter. A line that you send while the agent starts is sent when the agent is ready.
With each line, gpython tells the agent which notebook is open, how many cells it has and which cell the cursor is in. You can say "this cell" or "c5".
| Key | Result |
|---|---|
enter |
Send the line |
ctrl+c |
Stop the agent's turn |
1 - 9
|
Answer the agent's question about permission with that choice |
escape or n
|
Refuse the permission |
pageup / pagedown
|
Scroll the conversation |
escape |
Go back to the notebook. The panel stays |
ctrl+w h |
Go back to the notebook |
ctrl+w l |
From the rightmost window: go to the panel |
/model then enter
|
Choose the agent's model. Refer to Choose the model |
To make the panel wider or narrower, drag its left edge with the mouse. gpython keeps the width.
While the cursor is in the panel, the notebook keys (ctrl+d, ctrl+n and the others) do nothing to the notebook.
:agent starts the default agent. With no setting, the default is the first agent in the table above that is installed.
| Command | Result |
|---|---|
:agent default codex |
:agent starts Codex from now on. gpython saves this |
:agent default |
Show the default agent and the names you can use |
In the config file:
[agent]
default = "codex"The title of the panel shows the model in use, at the right.
| Command | Result |
|---|---|
/model in the panel, or :agent model
|
Show the agent's models. j / k move, enter chooses, escape keeps the current model |
/model NAME in the panel, or :agent model NAME
|
Choose a model by its name or by a part of its name |
- The models are those that the agent offers. If an agent gives no list, gpython tells you, and you choose the model in the agent's own program.
- The choice is for this conversation. A new conversation starts with the agent's own default model.
An agent makes many tool calls and writes its thoughts while it works. By default gpython shows them while the agent works and removes them when the agent is done. One line, such as 5 tool calls, stays in their place.
| Mode | Result |
|---|---|
fold |
Shown while the agent works. Then one line tells you how many tool calls there were (the default) |
keep |
They stay in the conversation |
hide |
They never show |
| Command | Result |
|---|---|
:agent tools keep |
Set the mode for tool calls |
:agent thoughts hide |
Set the mode for the agent's thoughts |
:agent tools |
Show the mode |
gpython saves the mode. A change applies from the agent's next step.
A tool call is one line. A long shell command is cut at the edge of the panel. A question about permission always shows the full command.
The agent gets these tools for the open notebook:
| Tool | Result |
|---|---|
notebooks |
List the open notebooks |
cells_read |
Read cells: source, run state and output. A plot comes back as a picture |
cell_edit |
Change the text of a cell |
cell_insert |
Add a cell, and run it if asked |
cell_delete |
Remove a cell |
cells_run |
Run cells (numbers, all, or the out-of-date ones) and wait for the result |
variables |
List the variables in the kernel |
variable_value |
The full value of one variable |
python_eval |
Run code in the kernel without a cell, to look at values |
kernel |
Interrupt or restart the kernel |
notebook_save |
Save the notebook |
- A change by the agent is the same as a change by you:
utakes it back, and the cells that depend on it become out of date. - The agent uses your kernel. It sees the values that your cells made, and what it runs changes them.
- The agent can also use its own tools (read files, run shell commands). It asks for permission as it does in its own program.
Any program that speaks the Agent Client Protocol on its standard input and output can be an agent. Give it a name and a command in the config file:
[agents]
mine = "my-agent --acp"
claude = "claude-agent-acp":agent mine starts it. A built-in name with a command, such as claude above, uses your command.
An agent that runs in its own terminal can use the same notebook tools. gpython must be open.
-
In gpython, type
:agent link. -
In the agent's terminal, add gpython as an MCP server. Do this one time:
claude mcp add gpython -- gpython mcp codex mcp add gpython -- gpython mcp
gpython mcp finds the gpython that is open in the same folder, or the newest one. The link accepts connections from this computer only, and only with a secret that gpython writes to a file that only you can read (~/.gpython/links/).
| Config key | Values | Default | Command |
|---|---|---|---|
[agent] default |
An agent name | The first installed agent | :agent default NAME |
[agent] tools |
keep, fold, hide
|
fold |
:agent tools MODE |
[agent] thoughts |
keep, fold, hide
|
fold |
:agent thoughts MODE |
[agent] width |
The width of the panel in columns | 64 |
Drag the left edge of the panel |
[agents] NAME |
A command |
- If the agent changes the notebook's file on disk, the open window does not show the change. gpython tells the agent to use the notebook tools. If it happens,
:e! fileopens the file again and discards what the window has. - The line that you type is one line.
- gpython does not keep the model that you choose for the next conversation. It has no picker for the agent's mode.
- A new conversation does not remember the previous one.
Use the notebook
- Getting started
- Command line
- Running cells
- Keys
- Commands
- Vim
- Markdown cells
- Variables and the debugger
- Images
- Agents
Set up the workspace
Help and project