Skip to main content

JupyterLab extension with chat interface for DeepAgents

Project description

deepagent-lab

A JupyterLab extension providing an AI agent chat interface with notebook manipulation capabilities and human-in-the-loop controls.

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
  • Agent Portability: Use any other langgraph-compatible agent seamlessly

Installation

pip install deepagent-lab

Quick Start

  1. Set up your environment (copy .env.example to .env and configure):
# Required: Jupyter server configuration (must match your JupyterLab startup)
DEEPAGENT_JUPYTER_SERVER_URL=http://localhost:8889
DEEPAGENT_JUPYTER_TOKEN=8e2121e58cd3f9e13fc05fc020955c6e # Generate with python3 -c "import secrets; print(secrets.token_hex(16))"

# If using the default agent, Anthropic API key is required
ANTHROPIC_API_KEY=your-api-key-here

# Or if you want to use your agent, specify the location here
DEEPAGENT_AGENT_SPEC=./my_agent.py:agent
  1. Start JupyterLab with matching server URL and token:
# Start JupyterLab with values matching your .env file
jupyter lab --port=8889 --IdentityProvider.token=8e2121e58cd3f9e13fc05fc020955c6e

Important: The Jupyter server URL and token in your .env file must match the values JupyterLab uses when starting up. This allows the agent to connect to notebook kernels for code execution.

  1. Open the chat interface by clicking the chat icon in the right sidebar

  2. Start chatting with your agent!

Agent Configuration

The extension uses the DEEPAGENT_ prefix for all environment variables, enabling full compatibility with deepagent-dash.

Quick Configuration

Option 1: Use the default agent

  • The extension includes a built-in agent for notebook manipulation
  • No configuration needed - just start chatting!

Option 2: Use a custom agent

Create a custom agent and point to it using environment variables:

# Agent spec in format "module_or_file:variable"
DEEPAGENT_AGENT_SPEC=./my_agent.py:agent

Environment Variables

All configuration uses the DEEPAGENT_ prefix for compatibility with deepagent-dash:

Variable Purpose Default
DEEPAGENT_AGENT_SPEC Agent location (path:variable) Uses default agent
DEEPAGENT_WORKSPACE_ROOT Working directory for agent JupyterLab root
DEEPAGENT_MODEL_NAME Model identifier anthropic:claude-sonnet-4-20250514
DEEPAGENT_MODEL_TEMPERATURE Model temperature (0.0-1.0) 0.0
DEEPAGENT_JUPYTER_SERVER_URL Jupyter server URL http://localhost:8889
DEEPAGENT_JUPYTER_TOKEN Jupyter auth token 12345
DEEPAGENT_VIRTUAL_MODE Safe mode for filesystem true
DEEPAGENT_DEBUG Enable debug logging false

See .env.example for complete configuration options.

Creating Custom Agents

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

# Agent discovers workspace automatically
workspace = os.getenv('DEEPAGENT_WORKSPACE_ROOT', '.')

agent = create_deep_agent(
    model="anthropic:claude-sonnet-4-20250514",
    backend=FilesystemBackend(root_dir=workspace, virtual_mode=True),
    checkpointer=MemorySaver(),
    tools=[...your_tools...]
)

Save this as my_agent.py and configure:

DEEPAGENT_AGENT_SPEC=./my_agent.py:agent

Agent Portability

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

# Same .env file works for both!
DEEPAGENT_AGENT_SPEC=./my_agent.py:agent
DEEPAGENT_WORKSPACE_ROOT=/path/to/project

# Run in JupyterLab
jupyter lab

# Or run in Dash
deepagent-dash run

Interface Controls

  • ⟳ Reload: Reload your agent without restarting JupyterLab
  • 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.1.2.tar.gz (6.1 MB 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.1.2-py3-none-any.whl (129.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deepagent_lab-0.1.2.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for deepagent_lab-0.1.2.tar.gz
Algorithm Hash digest
SHA256 01eb4e8d1c0f52e66909ab4db8e18d0295abcfd75d14e2d8598a18ee388ec1c9
MD5 5dead7ecc7e3746218a27b9eea950f55
BLAKE2b-256 6e5c7e3da19d7dc65c3cb20dd0e1bc545779c3dccb8be51114f6603fad2d0b7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deepagent_lab-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 129.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for deepagent_lab-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ced245572ec01bf2c49120b0baa3774511f5330feb2b7d2e1b7eb93ff149e24d
MD5 81c82be7f2f3953e1013a6c8493460ec
BLAKE2b-256 bace6d1768d76e5117f2031f723feb689ccf4c76f611d1ca612fc5d80bfb631e

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