Observed since 20 Oct, 22:29 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A toolkit for building, managing, and extending Jupyter agent workflows, including kernel and notebook utilities.
A Python toolkit for building agent tools that interact with Jupyter kernels and the Jupyter protocol. This package provides high-level wrappers and abstractions around jupyter_client, jupyter_ydoc, and pycrdt, making it easy to manage kernels, execute code, and build agent-driven workflows for automation, orchestration, and integration with Model Context Protocol (MCP) servers.
NotebookWorkspace manages open sessions and a
default notebook from Python. Switching defaults preserves other live sessions.
See the workspace API.# Using pip
pip install agent-jupyter-toolkit
# Install optional DataFrame serialization support
pip install agent-jupyter-toolkit[dataframe]
# Include a managed local Python kernel
pip install agent-jupyter-toolkit[local]
# Include the nbclient batch executor
pip install agent-jupyter-toolkit[batch]
# Or using uv
uv pip install agent-jupyter-toolkit
The local extra installs ipykernel, batch installs nbclient, and dataframe
installs pandas/Arrow serialization support. The integration extra is for
maintainers running the real Jupyter Server and collaboration tests.
git clone https://github.com/Cyb3rWard0g/agent-jupyter-toolkit.git
cd agent-jupyter-toolkit
uv sync --all-packages --all-extras --dev
This installs both agent-jupyter-toolkit and mcp-jupyter-notebook in
editable mode into the .venv.
Local kernel execution does not require a Jupyter Server. The library starts a
local kernel process for you (via jupyter_client) and connects over ZMQ.
import asyncio
from agent_jupyter_toolkit.kernel import SessionConfig, create_session
async def main() -> None:
async with create_session(SessionConfig(mode="local", kernel_name="python3")) as session:
result = await session.execute(
"import os\n"
"from platform import node\n"
"user = os.environ.get('USER', 'friend')\n"
"print(f'Hello {user} from {node()}')\n"
)
print("status:", result.status)
print("stdout:", result.stdout.strip())
asyncio.run(main())
async with create_session() as session:
# Tab-completion
result = await session.complete("import os; os.path.jo", cursor_pos=21)
print(result.matches) # ["join"]
# Object inspection
info = await session.inspect("len", cursor_pos=3)
print(info.data.get("text/plain", ""))
# Code-completeness check
check = await session.is_complete("for i in range(10):")
print(check.status) # "incomplete"
print(check.indent) # " "
# Execution history
hist = await session.history(n=5)
for entry in hist.history:
print(f"[{entry.line_number}] {entry.input}")
# Kernel metadata
kinfo = await session.kernel_info()
print(f"{kinfo.language_info['name']} {kinfo.language_info['version']}")
# Interrupt a long-running cell
import asyncio
task = asyncio.create_task(session.execute("import time; time.sleep(999)"))
await asyncio.sleep(1)
await session.interrupt()
For server-backed and notebook scenarios, see the quickstarts/ directory.
| Method | Description |
|---|---|
execute(code, *, timeout, output_callback, ...) | Execute code with optional streaming callbacks |
debug(request) | Send a DAP request when the kernel advertises debugger support |
create_subshell() / list_subshells() / delete_subshell() | Manage advertised kernel subshells |
interrupt() | Send SIGINT to cancel running execution |
complete(code, cursor_pos) | Tab-completion suggestions |
inspect(code, cursor_pos, detail_level) | Object documentation/signature |
is_complete(code) | Syntax completeness check |
history(*, output, raw, hist_access_type, n) | Execution history retrieval |
kernel_info() | Kernel metadata (language, version, protocol) |
session_info() | Non-secret kernel/session IDs, ownership, generation, and encryption state |
is_alive() | Health check |
start() / shutdown() | Start and close; shutdown terminates only resources created by this client |
shutdown_kernel() | Explicitly terminate a kernel, including a borrowed one |
| Method | Description |
|---|---|
fetch() | Get notebook content as nbformat dict |
save(content) | Write notebook content |
append_code_cell(source, metadata, tags) | Append a code cell |
append_code_cell_with_id(source, metadata, tags) | Append and return its stable ID atomically |
insert_code_cell(index, source, metadata, tags) | Insert a code cell at index |
append_markdown_cell(source, tags) | Append a markdown cell |
insert_markdown_cell(index, source, tags) | Insert a markdown cell at index |
set_cell_source(index, source) | Update cell source text |
set_cell_source_by_id(id, source, expected_source) | Resolve, verify, and update source atomically |
update_cell_outputs(index, outputs, execution_count) | Replace cell outputs |
delete_cell(index) | Delete cell at index |
on_change(callback) | Register mutation observer |
agent_jupyter_toolkit
├── kernel/
│ ├── session.py # Session + create_session() factory
│ ├── transport.py # KernelTransport protocol
│ ├── types.py # Dataclasses (SessionConfig, ExecutionResult, ...)
│ ├── manager.py # KernelManager (lifecycle, channels)
│ ├── messages.py # Wire-protocol message builders
│ ├── variables.py # VariableManager (inspect/set kernel vars)
│ ├── hooks.py # Extensible execution hooks
│ ├── mimetypes.py # MIME-type serialization registry
│ ├── serialization.py # High-level serialize/deserialize API
│ └── transports/
│ ├── local.py # LocalTransport (ZMQ)
│ └── server.py # ServerTransport (HTTP+WS)
├── notebook/
│ ├── session.py # NotebookSession (kernel + document orchestration)
│ ├── workspace.py # Multi-notebook registry, default selection, lifecycle
│ ├── _workspace_files.py # Private local and Contents API file operations
│ ├── transport.py # NotebookDocumentTransport protocol
│ ├── factory.py # make_document_transport() factory
│ ├── buffer.py # In-memory NotebookBuffer
│ ├── cells.py # Cell creation helpers (code, markdown)
│ ├── config.py # Environment-based Config (allowlist, timeout)
│ ├── utils.py # Path validation, output normalization
│ └── transports/
│ ├── local_file.py # LocalFileDocumentTransport (+ autosave)
│ ├── contents.py # ContentsApiDocumentTransport
│ └── collab/ # CollabYjsDocumentTransport (Yjs/CRDT)
└── utils/ # High-level helpers (factories, execution, packages)
| Package | Purpose |
|---|---|
| jupyter-client | Kernel protocol, ZMQ channels, kernel management |
| jupyter-ydoc | YNotebook schema for collaborative editing |
| pycrdt | CRDT types (Doc, Array, Map, Text, Awareness) |
| nbformat | Notebook file format handling |
| packaging | PEP 508 requirement and version checks |
| aiohttp | Async HTTP/WS for server transport |
| pandas + pyarrow | Optional dataframe extra for DataFrame variable inspection |
See the API reference for execution result fields and optional APIs, and configuration for collaboration modes and local launch options.
See CONTRIBUTING.md for dev setup, testing, and the release process.
Contributions and feedback are welcome!
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.8.0 | 13 Sept 2026 | 20 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 22:29 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:1ad094a506ded6283f4029a8df6e9621748efb2e00d9f26a8d56969e936f86c7