A Jupyter Kernel for Zed's Agent Client Protocol (ACP) https://agentclientprotocol.com/ .
This kernel allows you to interact with external ACP agents directly from Jupyter notebooks. It acts as an ACP client that connects to coding agents like Codex, providing a seamless notebook interface for AI-powered coding assistance.
This deep link will create a new (free!) GitHub Codespace (it will ask you first) for running the Codex devcontainer:
QR to this GitHub Repo (https://github.com/wiki3-ai/agent-client-kernel)
This project implements a Jupyter kernel that serves as a client for coding agents via the Agent Client Protocol. The implementation uses MetaKernel as the base class, which provides built-in magics, shell commands, and other useful features.
The kernel spawns and communicates with external ACP agents (such as codex-acp) via stdio, allowing you to interact with AI coding assistants directly from your notebook.
- ACP Client Implementation: Full client-side ACP protocol support
- External Agent Integration: Connects to any ACP-compatible agent
- Multiple Agent Support: Pre-configured devcontainers for Codex, Gemini, Goose, Kimi, and Docker cagent
- Based on MetaKernel: Built-in magics (help, shell, file operations, etc.)
- Configurable: Easily switch between different agents via environment variables
- Compatible with JupyterLab and Jupyter Notebook
This project provides multiple devcontainer configurations for different ACP agents. Each devcontainer comes with JupyterLab and the agent-client-kernel pre-installed with the respective agent.
Available devcontainers:
.devcontainer/codex/- OpenAI Codex with ACP adapter.devcontainer/gemini/- Google Gemini CLI (Apache 2.0).devcontainer/goose/- Block's Goose agent (Apache 2.0).devcontainer/kimi/- MoonshotAI's Kimi CLI (Apache 2.0).devcontainer/cagent/- Docker's cagent (Apache 2.0)
To use a devcontainer:
- Open the repository in GitHub Codespaces or VS Code with Dev Containers extension
- When prompted, select the desired devcontainer (e.g., "Codex", "Gemini", etc.)
- Wait for the container to build and start
- JupyterLab will be available on port 8888
For Codex: After JupyterLab starts, open a Terminal and run codex. Follow prompts for API key and authorization then /quit.
Alternatively, install the project from source. We use uv
for reproducible installs against uv.lock:
pip install --upgrade uv
git submodule update --init --recursive
uv sync --locked --extra dev # or: uv pip install -e ".[dev]"
uv run python -m agent_client_kernel install --userThe kernel spawns a subprocess to run the agent which needs installation and ACP adapter.
-
Install the
codexandcodex-acpbinaries.The Codex devcontainer installs them as native binaries downloaded directly from the upstream GitHub releases with SHA-256 verification (no Node.js / npm involved). The pinned versions and checksums live in
scripts/agent-versions.json, and the install scriptscripts/install-acp-agents.shhandleslinux/amd64andlinux/arm64automatically. The devcontainer runs entirely as the non-rootjovyanuser and installs the binaries into~/.local/bin(already onPATH), so nosudoor root-owned files are involved.To install them outside a devcontainer:
# Linux only. Set TARGETARCH=amd64 or arm64. # Installs into ~/.local/bin (no sudo required). TARGETARCH=amd64 scripts/install-acp-agents.sh \ scripts/agent-versions.json "$HOME/.local"
To bump pinned versions for a release, run:
python scripts/update-agent-versions.py \ --set codex=<NEW_VERSION> --set codex-acp=<NEW_VERSION>This refetches the tarballs, recomputes SHA-256s, and rewrites the manifest. Use
--check(in CI) to verify pinned checksums still match upstream without modifying anything. -
Set your OpenAI API key. This can be omitted and
codexwill prompt for it.export OPENAI_API_KEY=sk-... -
Authorize Codex:
codex
It will prompt you through authentication and permission to run stuff.
Only API-key auth currently works in Codespaces because OAuth tries to redirect through localhost.
This is the error you get when trying to chat with the agent if you missed this step:
Error: Authentication required Make sure the ACP agent is configured correctly. Current agent: codex-acp -
Start Jupyter and use the "Agent Client Protocol" kernel:
jupyter lab
Set environment variables to configure a different agent:
export ACP_AGENT_COMMAND=path/to/your/agent
export ACP_AGENT_ARGS="--arg1 --arg2"Then start Jupyter normally. The kernel will use your configured agent.
After installation, create a new notebook and select "Agent Client Protocol" as the kernel.
Type your prompts in cells and execute them to interact with the agent:
Create a Python function to calculate fibonacci numbers
The agent will respond with code, explanations, and can help with:
- Writing code
- Debugging
- Code review
- Refactoring
- Documentation
- And more!
Adding a Jupyter MCP service for accessing and editing notebooks and cells. The Dockerfile installed the datalayer/jupyter-mcp-server https://github.com/datalayer/jupyter-mcp-server . To add it to the agent's MCP configuration:
%agent mcp add jupyter uvx jupyter-mcp-server@latest
See examples/jupyter-mcp.ipynb.
The kernel provides a unified %agent magic command for all configuration and session management:
MCP Server Configuration:
%agent mcp add NAME COMMAND [ARGS...]- Add an MCP server%agent mcp list- List configured MCP servers%agent mcp remove NAME- Remove an MCP server%agent mcp clear- Remove all MCP servers
Permission Configuration:
%agent permissions [auto|manual|deny]- Set permission mode%agent permissions list- View permission request history
Session Management:
%agent session new [CWD]- Create a new session%agent session info- Show current session information%agent session restart- Restart the current session
Agent Configuration:
%agent config [COMMAND [ARGS...]]- Configure the agent command%agent env [KEY=VALUE]- Set agent environment variables
Use %agent without arguments to see all available subcommands.
Use %agent? for detailed help on the magic command.
See the example notebooks in examples/ for demonstrations:
basic_usage.ipynb- Basic agent interactionconfiguration_demo.ipynb- Configuration and session management
- Python >= 3.10
- ipykernel >= 7.0
- jupyter-client >= 8.5
- agent-client-protocol (latest from
python-sdk; pinned in
uv.lock) - An ACP-compatible agent (e.g.,
codex-acp)
uv sync --locked --extra dev
uv run pytestThe CI workflow (.github/workflows/ci.yml) runs the test suite on
Python 3.10 / 3.11 / 3.12, verifies that the pinned ACP agent
checksums still match upstream, and builds the multi-arch Codex
devcontainer image.
jupyter kernelspec remove agentclient
pip uninstall agent_client_kernelBSD 3-Clause License
