Skip to main content

marimo-lens

PyPI License: Apache 2.0

Let your notebook agent see what you see.

Point to a notebook result and say what should change. Lens gives your agent the producing cell, related notebook context, and an annotated image to ground its work in the result you marked.

While the agent works, Lens can show which cell it is changing or checking, bring the result into view for review, and keep completed requests in History for another pass.

Read the user guide for the agent workflow.

Quick start

Open a local marimo notebook with Lens available:

uvx --with marimo-lens marimo edit notebook.py

Mount Lens in one notebook cell:

from marimo_lens import Lens

lens = Lens()
lens

Keep the cell mounted. Press Select, then click a point or drag a region inside a rendered output. Add a note with what you want the agent to inspect or change.

Select additional page regions

Pass one CSS selector for page regions that should also receive feedback:

lens = Lens(
    dom_selector="#app-shell :is(header, section, article)",
)

Notebook outputs remain selectable. Each additional selection keeps the document path, an exact DOM locator, producer IDs inferred from generic runtime metadata, and the marked PNG. Host integrations own the selector they pass to Lens.

Connect an agent

The marimo-lens package carries the Agent Skill that matches its Python API. An agent that already executes code in the live notebook kernel can continue directly with Lens.

To give the agent live kernel execution, install marimo Pair:

npx skills add https://github.com/marimo-team/marimo-pair --skill marimo-pair

Use $marimo-pair to connect to or start the notebook, then resume $marimo-lens. Inside code mode, Marimo advertises marimo_lens.agent as the lens capability, and the module exposes the installed skill path:

import marimo_lens.agent as lens_agent

print(lens_agent.agent_skill() / "SKILL.md")

After selecting an output and adding a note, ask the agent:

Resolve my Lens request.

See Agent workflow to start with existing code-mode access or enter code mode through Pair.

Python API

The package exports CellReference, Lens, LensContext, LensError, LensReferences, NotebookReference, SelectionReference, SelectionTargetReference, and __version__. The version string comes from the installed marimo-lens distribution metadata.

Agent integrations use five methods:

Method Behavior
lens.context() Returns detached selection context with lazy notebook text
lens.start_activity(cell_id, *, duration_ms=None, label=None, message=None) Marks current work until stopped or its optional hold ends
lens.stop_activity(cell_id) Stops activity attached to that exact cell
lens.reveal(cell_id, *, duration_ms, label=None, message=None) Brings one verified or explanatory cell into view
lens.resolve(selection_ids, *, expected_revision, summary=None) Moves one or more selections to History in one guarded operation

The Python API reference documents return values, errors, limits, and lifecycle behavior.

Project

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marimo_lens-0.0.7.tar.gz (179.0 kB view details)

Uploaded Source

Built Distribution

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

marimo_lens-0.0.7-py3-none-any.whl (191.7 kB view details)

Uploaded Python 3

File details

Details for the file marimo_lens-0.0.7.tar.gz.

File metadata

  • Download URL: marimo_lens-0.0.7.tar.gz
  • Upload date:
  • Size: 179.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for marimo_lens-0.0.7.tar.gz
Algorithm Hash digest
SHA256 41810f9c40a8cdbb0b4e7156008773c1d16f311c8415bade93b5a9ec1bc7099e
MD5 034b5879554f956395e229323df82634
BLAKE2b-256 175c84b59fcf7375d2c2da34c69e55a810c7ba8a802311c78d61f10875a61c85

See more details on using hashes here.

File details

Details for the file marimo_lens-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: marimo_lens-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 191.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for marimo_lens-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b8ca3d02822e69f6ab442f91cff8d7928602b8125e064899b73091e7879dc03f
MD5 5343681e67618b771d05ffb0699eb5b4
BLAKE2b-256 c798a2391a370a50326f1b8217a7e0bab1176b5be79f64c77dd1ed8afc3a3c6f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.9

2 files

0.0.8

2 files

This release

0.0.7 This release

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 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