Skip to main content

jupyter-ai-hermes-magics

%%hermes cell magic — talk to Hermes Agent directly inside Jupyter notebooks.

Features

  • Two-phase button: Shift+Enter shows a ▶ button; click to send. No auto-send on run.
  • Stop mid-stream: Click ⏹ to stop Hermes. No transcript cell created if stopped.
  • Dynamic cell type: Code responses → code cell. Explanations → markdown cell.
  • No ipywidgets: Uses IPython comms — no widget-state-saving issues.
  • Notebook context: Hermes sees cells above the %%hermes cell (not below).
  • Session tree: Dot-notation labels (main.debug.fix) for branching conversations.
  • Always new transcript: Each response creates a fresh cell below — no fragile update logic.
  • Full agent: Hermes has tools, memory, skills, and can edit notebook cells via MCP.

Installation

pip install jupyter-ai-hermes-magics

Then load in a notebook:

%load_ext jupyter_ai_hermes_magics

Or add to ipython_config.py for auto-load:

c.InteractiveShellApp.extensions = ["jupyter_ai_hermes_magics"]

Usage

Basic chat

%%hermes
Explain what the code in the cell above does

→ A ▶ button appears. Click it to send to Hermes. Response goes to a new cell below.

Branching sessions

%%hermes --label main
Write a function to sort a list

%%hermes --label main.debug
Why does this throw an error?

%%hermes --label main.debug.fix
Fix the error and show the corrected code

Skip context

%%hermes --no-context
What is the capital of France?

Subcommands

%hermes list     # Show session tree
%hermes reset    # Clear all sessions
%hermes version  # Show version

How it works

Two-phase flow

Phase 1 (Shift+Enter): The cell output displays a ▶ button and a tip. No request is sent. The cell's execution_count is captured to identify the magic cell later.

Phase 2 (Click ▶): Hermes starts via hermes chat -q "..." -Q. The button toggles to ⏹ with a live timer. The user can:

  • Wait for completion → response goes to a new transcript cell below.
  • Click ⏹ → process killed, no transcript cell created.

Cell type detection

After Hermes completes, the response is analyzed:

  • Single fenced code block (no prose) → code cell (fences stripped)
  • Raw code (starts with def/class/import) → code cell
  • Prose or mixedmarkdown cell (code blocks render inline)

State consistency

  • ▶ only when idle/done/stopped — never during streaming
  • ⏹ only during streaming — never when idle
  • Transcript always targets the cell below the magic cell (identified by execution_count)
  • On kernel restart, button becomes a static snapshot (no comm target registered)

Requirements

  • Hermes Agent installed and configured (hermes on PATH)
  • IPython ≥ 8.0
  • Jupyter MCP server (auto-started by jupyter-ai in JupyterLab)

License

MIT

Release files for jupyter-ai-hermes-magics 0.5.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-hermes-magics 0.5.0
File Size Uploaded
jupyter_ai_hermes_magics-0.5.0.tar.gz 104.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-ai-hermes-magics 0.5.0
File Interpreter ABI Platform
jupyter_ai_hermes_magics-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 134.9 kB

Release files / jupyter_ai_hermes_magics-0.5.0.tar.gz

Download URL jupyter_ai_hermes_magics-0.5.0.tar.gz
Size 104.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b9907b4feb7cda969762a22fbd72767e6bc429377a714006eee403ea3a5f1f21
BLAKE2b-256 checksum
How to use checksums
171666ccc518e9cb012e6d9bc63b86b45d593978439d14b4c9dbdbe017c8f222
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / jupyter_ai_hermes_magics-0.5.0-py3-none-any.whl

Download URL jupyter_ai_hermes_magics-0.5.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddc71418a9f7f186cd417a88f75babe81836ef4076a03ec17bfd813256c76f37
BLAKE2b-256 checksum
How to use checksums
bbe4942369a48abb0b80bf48a49c346a20ed66ec5bcd9427265f9b1c93f9ac49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

0.5.2

2 release files

This release

0.5.0 This release

2 release files

0.4.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