Skip to main content

jupyter_ai_tools

Github Actions Status

jupyter_ai_tools is a Jupyter Server extension that exposes a collection of powerful, agent-friendly tools for interacting with notebooks and Git repositories. It is designed for use by AI personas (like those in Jupyter AI) to programmatically modify notebooks, manage code cells, and interact with version control systems.


✨ Features

This extension provides runtime-discoverable tools compatible with OpenAI-style function calling or MCP tool schemas. These tools can be invoked by agents to:

🧠 Notebook Tools (nb_toolkit)

  • read_notebook: Read entire notebook contents as markdown
  • read_cell: Read a specific notebook cell by index
  • add_cell: Add a new cell to a notebook
  • insert_cell: Insert a cell at a specific index in the notebook
  • delete_cell: Remove a cell from the notebook
  • edit_cell: Modify a cell's content
  • get_cell_id_from_index: Get cell ID from its index position
  • create_notebook: Create a new Jupyter notebook

🌀 Git Tools (git_toolkit)

  • git_clone: Clone a Git repository to a specified path
  • git_status: Get the current working tree status
  • git_log: View recent commit history
  • git_pull: Pull changes from remote repository
  • git_push: Push local changes to remote branch
  • git_commit: Commit staged changes with a message
  • git_add: Stage files for commit (individually or all)
  • git_get_repo_root: Get the root directory of the Git repository

These tools are ideal for agents that assist users with code editing, version control, or dynamic notebook interaction.


🔧 Creating Collaborative Tools

For developers building AI tools that need collaborative awareness, jupyter_ai_tools provides a collaborative_tool decorator that automatically enables real-time collaboration features.

This decorator enables other users in the same Jupyter environment to see when your AI tool is actively working on shared notebooks, improving the collaborative experience.

from jupyter_ai_tools.utils import collaborative_tool

# Define user information
user_info = {
    "name": "Alice",
    "color": "var(--jp-collaborator-color1)",
    "display_name": "Alice Smith"
}

# Apply collaborative awareness to your tool
@collaborative_tool(user=user_info)
async def my_notebook_tool(file_path: str, content: str):
    """Your tool implementation here"""
    # Tool automatically sets user awareness for:
    # - Global awareness system (all users can see Alice is active)
    # - Notebook-specific awareness (for .ipynb files)
    return f"Processed {file_path}"

Requirements

  • Jupyter Server

Install

To install the extension, execute:

pip install jupyter_ai_tools

Uninstall

To remove the extension, execute:

pip uninstall jupyter_ai_tools

Troubleshoot

If you are seeing the frontend extension, but it is not working, check that the server extension is enabled:

jupyter server extension list

Contributing

Development install

# Clone the repo to your local environment
# Change directory to the jupyter_ai_tools directory
# Install package in development mode - will automatically enable
# The server extension.
pip install -e .

You can watch the source directory and run your Jupyter Server-based application at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension. For example, when running JupyterLab:

jupyter lab --autoreload

If your extension does not depend a particular frontend, you can run the server directly:

jupyter server --autoreload

Running Tests

Install dependencies:

pip install -e ".[test]"

Development uninstall

pip uninstall jupyter_ai_tools

Packaging the extension

See RELEASE

Release files for jupyter-ai-tools 0.7.0

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-ai-tools 0.7.0
File Size Uploaded
jupyter_ai_tools-0.7.0.tar.gz 110.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-ai-tools 0.7.0
File Interpreter ABI Platform
jupyter_ai_tools-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 135.9 kB

Release files / jupyter_ai_tools-0.7.0.tar.gz

Download URL jupyter_ai_tools-0.7.0.tar.gz
Size 110.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d23c5b60722c4b68909141ab5bd792bbca3843203dd193f59c1a40c077a213b1
BLAKE2b-256 checksum
How to use checksums
cad919f49f377f2fa5047ce01106c534735cb137acd0781f686bcf1b95927457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / jupyter_ai_tools-0.7.0-py3-none-any.whl

Download URL jupyter_ai_tools-0.7.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6a7f93a3d360a6dc553c7361c5c2544ef7465c9334d05fa0a394bdd1fab1391
BLAKE2b-256 checksum
How to use checksums
736a50bada9997cc7bbeaab2f35a9a931731efd5bf8ecf0126e4f6f368c31f3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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