Skip to main content

A toolkit for building, managing, and extending Jupyter agent workflows, including kernel and notebook utilities.

Project description

Agent Jupyter Toolkit

A Python toolkit for building agent tools that interact with Jupyter kernels and the Jupyter protocol. This package provides high-level wrappers and abstractions around jupyter_client, making it easy to manage kernels, execute code, and build agent-driven workflows for automation, orchestration, and integration with Model Context Protocol (MCP) servers.

Features

  • Async-first kernel and notebook orchestration with multiple transport options:
    • Local file transport for filesystem-backed notebooks
    • Contents API transport for Jupyter Server-managed notebooks
    • Collaboration transport for real-time, multi-client editing
  • Session, variables, and notebook editing utilities geared for agent workflows
  • In-memory notebook buffer for staged edits with explicit commit
  • Local notebook autosave with optional debounced writes
  • Extensible hooks and integration points for custom workflows

Use Cases

  • Build agent tools that execute code in Jupyter kernels
  • Integrate Jupyter kernel execution into MCP servers or other orchestration systems
  • Automate notebook and code execution for data science, ML, and automation pipelines

Installation

You can install the package and its dependencies from PyPI or set up a development environment using pip or uv.

Install from PyPI

# Using pip
pip install agent-jupyter-toolkit

# Or using uv
uv pip install agent-jupyter-toolkit

Environment Setup

Development Environment (contributors)

Option 1: Using pip

# Create a virtual environment (Python 3.10+ recommended)
python3 -m venv .venv

# Activate the virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate

# Install the package in editable mode with dev dependencies
pip install -e '.[dev]'

Option 2: Using uv

# Create and activate a virtual environment
uv venv .venv
source .venv/bin/activate

# Install the package in editable mode with dev dependencies
uv pip install '.[dev]'

Quickstart

Local kernel execution does not require a Jupyter Server. The library starts a local kernel process for you (via jupyter_client) and connects over ZMQ. The snippet below can be saved as a script and run with your preferred Python runner.

Example (same as quickstarts/01_local_kernel.py):

import asyncio

from agent_jupyter_toolkit.kernel import SessionConfig, create_session


async def main() -> None:
    session = create_session(SessionConfig(mode="local", kernel_name="python3"))
    async with session:
        result = await session.execute(
            "import os\n"
            "from platform import node\n"
            "user = os.environ.get('USER', 'friend')\n"
            "print(f'Hello {user} from {node()}')\n"
        )

    print("status:", result.status)
    print("execution_count:", result.execution_count)
    print("stdout:", result.stdout.strip())
    print("outputs:", result.outputs)


if __name__ == "__main__":
    asyncio.run(main())

For server-backed and notebook scenarios, see quickstarts/README.md and the other scripts under quickstarts/.

Reference: jupyter_client

jupyter_client is the reference implementation of the Jupyter protocol, providing client and kernel management APIs. This toolkit builds on top of jupyter_client to provide a more ergonomic, agent-oriented interface for automation and integration.

Release Process

See docs/RELEASE.md for the full release checklist.


Contributions and feedback are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_jupyter_toolkit-0.2.14.tar.gz (180.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_jupyter_toolkit-0.2.14-py3-none-any.whl (90.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_jupyter_toolkit-0.2.14.tar.gz.

File metadata

  • Download URL: agent_jupyter_toolkit-0.2.14.tar.gz
  • Upload date:
  • Size: 180.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for agent_jupyter_toolkit-0.2.14.tar.gz
Algorithm Hash digest
SHA256 0266eaf6ac91f654774bc97c9c5d737deccdf4aedebdb8847b40332079f91b6c
MD5 5f0d9cbf049f321296c7de3fafcfde13
BLAKE2b-256 32113ee2f958bdc515f680780dd14882825b87ba777edf3928d54f8fc7950d2d

See more details on using hashes here.

File details

Details for the file agent_jupyter_toolkit-0.2.14-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_jupyter_toolkit-0.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 63b795b53248b37107b93b2d949e14e6e469aba9e810daf0ba8547ed52db0fd3
MD5 d336811c45e0556898b35c6feef3477c
BLAKE2b-256 23ad4ac278f3d04e2a2d35a3a001475dd0520fe4150da8cc5f2bcd27853452b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page