Skip to main content

JupyterLab extension with chat interface for DeepAgents

Project description

DeepAgent Lab

Bring LangChain agents into your JupyterLab workflow



A JupyterLab extension to allow your LangChain agents access to JuputerLab notebooks and files, enabling natural language interactions with your data science projects directly from JupyterLab.

DeepAgent Lab Demo

Watch the full demo video here: https://www.youtube.com/watch?v=vGA2vzMSQzo

Features

  • Chat Interface: Sidebar for natural conversations with your agent
  • Notebook Manipulation: Built-in tools for creating, editing, and executing Jupyter notebooks
  • Human-in-the-Loop: Review and approve agent actions before execution
  • Context Awareness: Automatically sends workspace and file context to your agent
  • Custom Agents: Use your own langgraph-compatible agents seamlessly
  • Auto-Configuration: Zero-config setup with automatic Jupyter server detection

Installation

pip install deepagent-lab

Quick Start

Recommended: Using the Launcher (Zero Configuration)

Instead of jupyter lab, use deepagent-lab command for automatic setup.

The easiest way to get started is using the deepagent-lab launcher command, which automatically configures everything for you:

# Set your API key (if using the default agent)
export ANTHROPIC_API_KEY=your-api-key-here

# Start JupyterLab with auto-configuration
deepagent-lab

That's it! The launcher will:

  • Auto-detect an available port (starting from 8888)
  • Generate a secure authentication token
  • Set the required environment variables
  • Launch JupyterLab with the proper configuration

Using custom arguments:

# All jupyter lab arguments are supported
deepagent-lab --no-browser
deepagent-lab --port 8889

Alternative: Manual Configuration

If you prefer manual control or need to use jupyter lab directly, you can set the environment variables yourself:

  1. Configure environment variables (create a .env file or export):
# Required: Jupyter server configuration
export DEEPAGENT_JUPYTER_SERVER_URL=http://localhost:8888
export DEEPAGENT_JUPYTER_TOKEN=$(python3 -c "import secrets; print(secrets.token_urlsafe(32))")

# If using the default agent, set your API key
export ANTHROPIC_API_KEY=your-api-key-here
  1. Start JupyterLab with matching configuration:
jupyter lab --port 8888 --IdentityProvider.token=$DEEPAGENT_JUPYTER_TOKEN

Important: The server URL and token must match between your environment variables and JupyterLab's startup parameters.

Using Custom Agents

Deepagent-lab is designed to work with any langgraph-compatible agent. You can easily use your own langgraph-compatible agents instead of the default agent.

Creating a Custom Agent

Create a file with your agent (e.g., my_agent.py):

from deepagents import create_deep_agent
from deepagents.backends import FilesystemBackend
from langgraph.checkpoint.memory import MemorySaver
import os

# The agent automatically discovers the workspace
workspace = os.getenv('DEEPAGENT_WORKSPACE_ROOT', '.')

# Create your custom agent
agent = create_deep_agent(
    name="my-custom-agent",  # Optional: name shown in chat interface
    model="anthropic:claude-sonnet-4-20250514",
    backend=FilesystemBackend(root_dir=workspace, virtual_mode=True),
    checkpointer=MemorySaver(),
    tools=[...your_custom_tools...]
)

Configuring the Extension to Use Your Agent

Set the DEEPAGENT_AGENT_SPEC environment variable to point to your agent:

# Format: path/to/file.py:variable_name
export DEEPAGENT_AGENT_SPEC=./my_agent.py:agent

Then launch as normal:

# With the launcher (recommended)
deepagent-lab

# Or manually
jupyter lab --port 8888 --IdentityProvider.token=$DEEPAGENT_JUPYTER_TOKEN

The chat interface will automatically display your custom agent's name (if you set the name attribute).

Agent Portability

Agents configured for deepagent-lab work seamlessly with deepagent-dash:

# Same configuration works for both tools!
export DEEPAGENT_AGENT_SPEC=./my_agent.py:agent
export DEEPAGENT_WORKSPACE_ROOT=/path/to/project

# Run in JupyterLab
deepagent-lab

# Or run in Dash
deepagent-dash run

All environment variables use the DEEPAGENT_ prefix for compatibility.

Environment Variables

All configuration uses the DEEPAGENT_ prefix:

Variable Purpose Default When to Set
DEEPAGENT_AGENT_SPEC Custom agent location (path:variable) Uses default agent Optional: for custom agents
DEEPAGENT_WORKSPACE_ROOT Working directory for agent JupyterLab root Optional
DEEPAGENT_JUPYTER_SERVER_URL Jupyter server URL Auto-detected Manual config only
DEEPAGENT_JUPYTER_TOKEN Jupyter auth token Auto-generated Manual config only
ANTHROPIC_API_KEY Anthropic API key None Required for default agent

When using the deepagent-lab launcher, DEEPAGENT_JUPYTER_SERVER_URL and DEEPAGENT_JUPYTER_TOKEN are automatically configured and don't need to be set.

See .env.example for a complete configuration template.

Interface Controls

  • ⟳ Reload: Reload your agent without restarting JupyterLab (useful during agent development)
  • Clear: Start a new conversation thread
  • Status Indicator:
    • 🟢 Green: Agent ready
    • 🟠 Orange: Agent loading
    • 🔴 Red: Agent error

Development

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

deepagent_lab-0.2.0.tar.gz (636.2 kB view details)

Uploaded Source

Built Distribution

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

deepagent_lab-0.2.0-py3-none-any.whl (229.4 kB view details)

Uploaded Python 3

File details

Details for the file deepagent_lab-0.2.0.tar.gz.

File metadata

  • Download URL: deepagent_lab-0.2.0.tar.gz
  • Upload date:
  • Size: 636.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepagent_lab-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ebc80fa316e685d913839864d25c2831ccc7b7fd62c8e8eecd302c935afb2b89
MD5 d2f539ff54da613dda9dc519df069086
BLAKE2b-256 922d0b573b85c1b3f5021f42103aae1888058e585ebbe3eba996a48bfcb75fb4

See more details on using hashes here.

File details

Details for the file deepagent_lab-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deepagent_lab-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 229.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepagent_lab-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 112c295dd50c0925a2ce313528354c2c972d2e1f62fd4001de1b6b2ec4e9343f
MD5 4f0b9e239d8432a65bbe2d949fb5eea7
BLAKE2b-256 d001d93ce49dc45764ebf1d47ea6d7f40e46d9e636e1d634c05d2d6690d02d18

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