Skip to main content

JupyterLab extension with chat interface for DeepAgents

Project description

jupyter-deepagents

A JupyterLab extension that provides an elegant chat interface for AI agents with human-in-the-loop capabilities.

Features

Core Functionality

  • Chat Interface: Clean, accessible sidebar interface for natural conversations with your agent
  • Streaming Responses: Real-time streaming of agent responses for immediate feedback
  • Thread-based History: Maintains conversation context across messages with persistent thread IDs
  • Context Awareness: Automatically sends current directory and focused widget information to the agent

Human-in-the-Loop

  • Tool Call Approvals: Review and approve/reject/edit tool calls before execution
  • Minimal Design: Simple gray UI with one-click approval buttons
  • Flexible Decisions: Approve, reject, or edit tool arguments inline
  • No Interruptions: Streamlined workflow without unnecessary prompts

Developer Experience

  • Tool Call Visibility: Expandable sections showing tool names and arguments
  • Markdown Rendering: Compact, elegant formatting for agent responses
  • Agent Health Status: Visual indicator showing agent connection status
  • Hot Reload: Reload agent configuration without restarting JupyterLab
  • Clear Chat: Start fresh conversations with a single click

Requirements

  • JupyterLab >= 4.0.0
  • Python >= 3.8

Installation

pip install jupyter-deepagents

Usage

Quick Start

  1. Create your agent in my_agent.py:
from deepagents import create_deep_agent
from langgraph.checkpoint.memory import MemorySaver

# Create agent with interrupt capability
agent = create_deep_agent(
    backend=FilesystemBackend(root_dir=".", virtual_mode=True),
    middleware=[
        HumanInTheLoopMiddleware(
            interrupt_on={
                "write_file": {"allowed_decisions": ["approve", "reject"]}
            },
            description_prefix="Tool execution pending approval",
        ),
    ],
    checkpointer=MemorySaver()
)
  1. Start JupyterLab:
jupyter lab
  1. Open the chat interface by clicking the chat icon in the right sidebar

  2. Start chatting with your agent!

Using the Interface

Basic Chat:

  • Type your message in the input field
  • Press Enter or click the send arrow (↑) to send
  • Watch as the agent streams its response in real-time

Human-in-the-Loop Approvals:

When your agent wants to execute a tool:

  1. An approval UI appears showing the tool name
  2. Click Approve to allow execution
  3. Click Reject to deny the action
  4. Click Edit to modify tool arguments before execution

No confirmation dialogs or reason prompts - just one click!

Interface Controls:

  • ⟳ Reload: Reload your agent without restarting JupyterLab
  • Clear: Start a new conversation thread
  • Status Indicator:
    • 🟢 Green: Agent loaded and ready
    • 🟠 Orange: Agent not found or loading
    • 🔴 Red: Agent error

Agent Configuration

Option 1: Default Location (Recommended)

Create my_agent.py in your working directory with an agent variable:

from langgraph.prebuilt import create_react_agent

agent = create_react_agent(
    model=your_model,
    tools=your_tools,
    checkpointer=MemorySaver()
)

Option 2: Custom Location

Set the JUPYTER_AGENT_PATH environment variable:

export JUPYTER_AGENT_PATH="path.to.module:variable_name"
jupyter lab

Examples:

# Agent in custom_agent.py as 'my_graph'
export JUPYTER_AGENT_PATH="custom_agent:my_graph"

# Agent in package: src/agents/main.py as 'agent'
export JUPYTER_AGENT_PATH="src.agents.main:agent"

Format: module_path:variable_name

  • module_path: Python import path (e.g., my_agent or package.module)
  • variable_name: Name of the agent variable in the module

See AGENT_CONFIGURATION.md for advanced configuration.

UI Design Philosophy

The interface follows a minimal, functional aesthetic:

  • Compact Markdown: Tight line spacing (1.2) and minimal margins for efficient reading
  • Minimal Color Scheme: Gray, black, and white palette without visual clutter
  • No Rounded Edges: Clean, professional design
  • One-Click Actions: Approval buttons submit immediately without confirmation dialogs
  • Elegant Send Button: Circular arrow button (↑) for a modern look
  • Expandable Tool Calls: Collapsible sections keep the interface clean

Contributing

Contributions are welcome! See CONTRIBUTING.md for development setup and guidelines.

License

MIT License - see LICENSE for details.

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

jupyter_deepagents-0.1.0.tar.gz (224.7 kB view details)

Uploaded Source

Built Distribution

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

jupyter_deepagents-0.1.0-py3-none-any.whl (119.7 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_deepagents-0.1.0.tar.gz.

File metadata

  • Download URL: jupyter_deepagents-0.1.0.tar.gz
  • Upload date:
  • Size: 224.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for jupyter_deepagents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74cf2ad1f6cd2217f8750a3b1adc6bed8e1acf62c10812f6bb611f972e1fa451
MD5 910fe37e705473da9285450bb0a8249e
BLAKE2b-256 a0f7227db9067b77ba666160fd4f52a6e92cbf2dc97e418bc5ca11765dbe4a73

See more details on using hashes here.

File details

Details for the file jupyter_deepagents-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_deepagents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 476fbe20eea282a2f9a8bdb3a7245239a05954a4aa7b8ac3f3a3e0c3c8883b08
MD5 66ccac2aa4530868359810142e95e1e4
BLAKE2b-256 d8a2fc73d528bd2c97e4c668e03b3e2069fafddac5f9288e69209f251eacd294

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