Jupyter Ai Agents logo

Jupyter Ai Agents

Organization
datalayer

🪐 🤖 AI Agents with 🔧 MCP tools and 🧰 Skills for JupyterLab — Chat with your Notebook and execute code.

Publisherdatalayer
Repositoryjupyter-ai-agents
LanguageJupyter Notebook
Forks
21
Stars
163
Available tools
0
Transport typestdio
LicenseBSD-3-Clause
Links
  • Connect tools to AI workflows

    Jupyter Ai Agents exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    163 stars and 21 forks from the linked repository.

Datalayer

Become a Sponsor

🪐 🤖 Jupyter AI Agents

Github Actions Status PyPI - Version

🪐 ✨ AI Agents for JupyterLab with 🛠️ MCP tools - Chat interface for intelligent notebook interaction, code execution, and workspace management.

💬 Chat Interface

Experience seamless AI-powered assistance directly within JupyterLab through our intuitive chat interface:

Jupyter AI Agents Chat 1

The chat interface is built using Pydantic AI for robust AI agent orchestration and Vercel AI Elements for the user interface components.

MCP Server Integration

By default, the Jupyter MCP Server is started as a Jupyter server extension, providing access to all Jupyter MCP server tools directly through the chat interface. This enables the AI agent to interact with notebooks, execute code, manage files, and perform various Jupyter operations seamlessly.

Jupyter AI Agents Chat 2

Getting Started with Chat

Currently, we support Anthropic Claude Sonnet 4.0 as the AI model. To get started:

  1. Set up your environment:

    bash
    export ANTHROPIC_API_KEY='your-api-key-here'
  2. Install Jupyter AI Agents:

    bash
    pip install jupyter_ai_agents
    pip uninstall -y pycrdt datalayer_pycrdt
    pip install datalayer_pycrdt==0.12.17
  3. Launch JupyterLab with the required configuration:

    bash
    jupyter lab
  4. Access the chat interface through the right panel in JupyterLab.

What's Coming Next

We're actively working on expanding the capabilities of Jupyter AI Agents:

  • 🚀 More LLM Providers: Integration with additional AI model providers
  • ⚙️ MCP Configuration: Enhanced MCP server configuration options
  • 🔧 Extended Tool Access: Chat access to tools from other MCP servers
  • 🛠️ Enhanced Features: And much more!

Check out our GitHub Issues to see what we're working on. Contributions are welcome!

Note: The documentation at https://jupyter-ai-agents.datalayer.tech will be updated soon to reflect the new chat features and capabilities.

CLI Usage

You can also use Jupyter AI Agents through the command line interface for automated notebook operations.

Jupyter AI Agents CLI

Basic Installation

To install Jupyter AI Agents, run the following command:

bash
pip install jupyter_ai_agents
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt==0.12.17

Or clone this repository and install it from source:

bash
git clone https://github.com/datalayer/jupyter-ai-agents
cd jupyter-ai-agents
pip install -e .

JupyterLab Setup

The Jupyter AI Agents can directly interact with JupyterLab. The modifications made by the Jupyter AI Agents can be seen in real-time thanks to Jupyter Real Time Collaboration. Make sure you have JupyterLab installed with the Collaboration extension:

bash
pip install jupyterlab==4.4.1 jupyter-collaboration==4.0.2

We ask you to take additional actions to overcome limitations and bugs of the pycrdt library. Ensure you create a new shell after running the following commands:

bash
pip uninstall -y pycrdt datalayer_pycrdt
pip install datalayer_pycrdt==0.12.17

Examples

Jupyter AI Agents provides CLI commands to help your JupyterLab session using Pydantic AI agents with Model Context Protocol (MCP) for tool integration.

Start JupyterLab, setting a port and a token to be reused by the agent, and create a notebook notebook.ipynb.

bash
# make jupyterlab
jupyter lab --port 8888 --IdentityProvider.token MY_TOKEN

Jupyter AI Agents supports multiple AI model providers (more information can be found on this documentation page).

API Keys Configuration

Set the appropriate API key for your chosen provider:

OpenAI:

bash
export OPENAI_API_KEY='your-api-key-here'

Anthropic:

bash
export ANTHROPIC_API_KEY='your-api-key-here'

Azure OpenAI:

bash
export AZURE_OPENAI_API_KEY='your-api-key-here'
export AZURE_OPENAI_ENDPOINT='https://your-resource.openai.azure.com'
export AZURE_OPENAI_API_VERSION='2024-08-01-preview'  # optional

Important for Azure OpenAI:

  • The AZURE_OPENAI_ENDPOINT should be just the base URL (e.g., https://your-resource.openai.azure.com)
  • Do NOT include /openai/deployments/... or query parameters in the endpoint
  • The deployment name is specified via the --model-name parameter
  • See .env.azure.example for a complete configuration template

Other providers:

bash
export GOOGLE_API_KEY='your-api-key-here'        # For Google/Gemini
export COHERE_API_KEY='your-api-key-here'        # For Cohere
export GROQ_API_KEY='your-api-key-here'          # For Groq
export MISTRAL_API_KEY='your-api-key-here'       # For Mistral
# AWS credentials for Bedrock
export AWS_ACCESS_KEY_ID='your-key'
export AWS_SECRET_ACCESS_KEY='your-secret'
export AWS_REGION='us-east-1'

Model Specification

You can specify the model in two ways:

  1. Using --model with full string (recommended):

    bash
    --model "openai:gpt-4o"
    --model "anthropic:claude-sonnet-4-0"
    --model "azure-openai:deployment-name"
  2. Using --model-provider and --model-name:

    bash
    --model-provider openai --model-name gpt-4o
    --model-provider anthropic --model-name claude-sonnet-4-0

Supported providers: openai, anthropic, azure-openai, github-copilot, google, bedrock, groq, mistral, cohere

Prompt Agent

Create and execute code based on user instructions:

bash
# Using full model string (recommended)
jupyter-ai-agents prompt \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0" \
  --path notebook.ipynb \
  --input "Create a matplotlib example"

# Using provider and model name
jupyter-ai-agents prompt \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model-provider anthropic \
  --model-name claude-sonnet-4-0 \
  --path notebook.ipynb \
  --input "Create a pandas dataframe with sample data and plot it"

Jupyter AI Agents - Prompt

Explain Error Agent

Analyze and fix notebook errors:

bash
jupyter-ai-agents explain-error \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0" \
  --path notebook.ipynb \
  --current-cell-index 5

Jupyter AI Agents - Explain Error

REPL Mode (Interactive)

For an interactive experience with direct access to all Jupyter MCP tools, use the REPL mode:

bash
jupyter-ai-agents repl \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0"

In REPL mode, you can directly ask the AI to:

  • List notebooks in directories
  • Read and analyze notebook contents
  • Execute code in cells
  • Insert new cells
  • Modify existing cells
  • Install Python packages

Example REPL interactions:

> List all notebooks in the current directory
> Create a new notebook called analysis.ipynb
> In analysis.ipynb, create a cell that imports pandas and loads data.csv
> Execute the cell and show me the first 5 rows
> Add a matplotlib plot showing the distribution of the 'age' column

The REPL provides special commands:

  • /exit: Exit the session
  • /markdown: Show last response in markdown format
  • /multiline: Toggle multiline input mode (use Ctrl+D to submit)
  • /cp: Copy last response to clipboard

You can also use a custom system prompt:

bash
jupyter-ai-agents repl \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0" \
  --system-prompt "You are a data science expert specializing in pandas and matplotlib."

Prompt Agent

Create and execute code based on user instructions:

bash
# Using full model string (recommended)
jupyter-ai-agents prompt \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0" \
  --path notebook.ipynb \
  --input "Create a matplotlib example"

# Using provider and model name
jupyter-ai-agents prompt \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model-provider anthropic \
  --model-name claude-sonnet-4-0 \
  --path notebook.ipynb \
  --input "Create a pandas dataframe with sample data and plot it"

Explain Error Agent

Analyze and fix notebook errors:

bash
jupyter-ai-agents explain-error \
  --url http://localhost:8888 \
  --token MY_TOKEN \
  --model "anthropic:claude-sonnet-4-0" \
  --path notebook.ipynb \
  --current-cell-index 5

Uninstall

About the Technology

Jupyter AI Agents empowers AI models to interact with and modify Jupyter Notebooks. The agent is equipped with tools such as adding code cells, inserting markdown cells, executing code, enabling it to modify the notebook comprehensively based on user instructions or by reacting to the Jupyter notebook events.

This Agent is innovative as it is designed to operate on the entire Notebook, not just at the cell level, enabling more comprehensive and seamless modifications.

The Agent can also run separately from the Jupyter server as the communication is achieved through RTC via the Jupyter NbModel Client and the Jupyter Kernel Client.

Jupyter AI Agents <---> JupyterLab
       |
       | RTC (Real Time Collaboration)
       |
Jupyter Clients

Contributing

Development install

bash
# Clone the repo to your local environment
# Change directory to the jupyter_ai_agents directory
# Install package in development mode - will automatically enable
# The server extension.
pip install -e ".[test,lint,typing]"

Running Tests

Install dependencies:

bash
pip install -e ".[test]"

To run the python tests, use:

bash
pytest

Development uninstall

bash
pip uninstall jupyter_ai_agents

Packaging the library

See RELEASE.

Use Jupyter Ai Agents MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Jupyter Ai Agents is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Jupyter Ai Agents as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Jupyter Ai Agents MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "jupyter-ai-agents": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Jupyter Ai Agents MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Jupyter Ai Agents MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Jupyter Ai Agents to help me with this task?
Jupyter Ai Agents
Sure. I read it.
Here is what I found using Jupyter Ai Agents.

Frequently asked questions

What is the Jupyter Ai Agents MCP server used for?

Jupyter Ai Agents is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Jupyter Ai Agents MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Jupyter Ai Agents with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Jupyter Ai Agents MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Jupyter Ai Agents connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Jupyter Ai Agents MCP to TypingMind?

Jupyter Ai Agents runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Jupyter Ai Agents MCP provide in TypingMind?

Jupyter Ai Agents exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Jupyter Ai Agents MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Jupyter Ai Agents requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇