Skip to main content

Jupyter Kernel Agent

PyPI version
Python Version
License: MIT

Jupyter Kernel Agent lets you run Jupyter code remotely by forwarding code to an HTTP endpoint and streaming results back in Jupyter’s native format.
Connect your Jupyter environment to clusters, GPU servers, or any backend that implements the Kernel Agent API.


Features

  • 📡 Remote code execution over HTTP
  • 🔑 Bearer token authentication
  • 🖥️ Multiple backends (one kernel per endpoint)
  • 🔄 Built-in magics for session management:
    • %reset — clear remote namespace / start new session
    • %shutdown — shut down remote session
    • %welcome — show kernel info
    • %reconnect — reconnect after disconnect
  • 🛑 Disconnection handling: hold (default) or exit

Installation

pip install jupyter-kernel-agent

This provides two CLI tools:

  • agent-server — run the FastAPI backend for code execution
  • kernel_agent — manage Jupyter kernelspecs (install/list/delete)

Running the Server

Start the server with an API key:

agent-server --host 0.0.0.0 --port 8000 --api_key SECRET123

Test with curl:

curl -sX POST http://127.0.0.1:8000/kernel \
  -H "Authorization: Bearer SECRET123" \
  -H "Content-Type: application/json" \
  -d '{"action":"execute","session_id":"s1","code":"1+1","execution_count":1}'

Expected response:

{"ok":true,"outputs":[{"type":"execute_result","data":{"text/plain":"2"},"execution_count":1,"metadata":{}}]}

Installing a Jupyter Kernel

Install a kernel that connects to your server:

kernel_agent install \
  --endpoint http://127.0.0.1:8000/kernel \
  --name local \
  --api_key SECRET123 --user

List installed kernels:

kernel_agent list

You should see your new kernel listed and available in Jupyter.


System-wide Installation

To install for all users (e.g., JupyterHub):

sudo kernel_agent install \
  --endpoint http://127.0.0.1:8000/kernel \
  --name cluster \
  --api_key SECRET123 \
  --sys-prefix

Or specify a custom prefix:

sudo kernel_agent install \
  --endpoint http://127.0.0.1:8000/kernel \
  --name cluster \
  --api_key SECRET123 \
  --prefix /usr/local

Verify with:

jupyter kernelspec list

Usage in Notebooks

After installation, select your kernel (e.g., local or cluster) in Jupyter and run code as usual:

1+1
!uname -a
%reset

Outputs will be returned from the remote server.


License

Apache-2.0

Metadata

Release files for jupyter-kernel-agent 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyter-kernel-agent 1.2.2
File Size Uploaded
jupyter_kernel_agent-1.2.2.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-kernel-agent 1.2.2
File Interpreter ABI Platform
jupyter_kernel_agent-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / jupyter_kernel_agent-1.2.2.tar.gz

Download URL jupyter_kernel_agent-1.2.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
02c2eba0438c80934e429b61b5812c9d385ca0eb6d3e19289448d981daebce92
BLAKE2b-256 checksum
How to use checksums
9f190de843a0c7a4b172dc2c1b522ecb4128b1064c1fa43d44b724da348189a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / jupyter_kernel_agent-1.2.2-py3-none-any.whl

Download URL jupyter_kernel_agent-1.2.2-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce3105a24a6d676d4604e447ef0fff93f9bc0e9b1921f3bf5c34a794e3824849
BLAKE2b-256 checksum
How to use checksums
e8cafba4d77c94d3b613f90b05173a76e5852b0eecf77405c28388623538467e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page