Pair Programming with AI in Your Python Notebook — with Dr. Trevor Manz

Dr. Trevor Manz from Marimo introduces Marimo Pair, an open-source agent skill that enables coding agents like Claude Code to interact with and drive reactive Python notebooks. He discusses the mechanics of agent skills, the power of recursive language models for agentic reasoning, and his work on the AnyWidget project, which bridges the gap between Python's data ecosystem and interactive web technologies.

4 min read
Pair Programming with AI in Your Python Notebook — with Dr. Trevor Manz
source: https://www.youtube.com/watch?v=K791Yk7noyo

Marimo Pair is an agent skill designed to teach a coding agent how to use a notebook as a tool, specifically a Marimo notebook. This allows an agent to perform any action a human can within the notebook environment, effectively creating a collaborative coding partner for data science and machine learning tasks. The goal is to move beyond the “babysitting” dynamic, where a user constantly has to correct an agent, to a more autonomous workflow where the agent can iterate, self-correct, and understand the notebook’s state—not just the code, but the values of variables in memory.

The Agent-Notebook Interaction

The relationship between a human and an AI agent in Marimo Pair functions like a new kind of contract. Instead of a rigid API between programs, it’s a more flexible interaction between a model and a runtime. The notebook becomes a shared working memory for the agent.

  • Driving the Notebook: A user can work from their agentic coding tool (e.g., Claude Code in the terminal) and instruct the agent to start or connect to a Marimo session. The agent then executes Python code, loads data, and performs analysis within the Marimo runtime.
  • Collaborative Experience: The user can see the notebook update in real-time in a browser. They can also manually edit cells in the Marimo UI. The agent has access to this updated state, can read cell contents, and can even take screenshots of visual outputs to understand the context, allowing for a seamless two-way collaboration.

The Mechanics of Agent Skills

Marimo Pair is implemented as a “skill,” which is essentially a folder of markdown files that teaches an agent how to use a specific tool. This approach has several implications for software development:

  • Declarative vs. Imperative: Early attempts at writing the skill were very prescriptive and imperative (“do this, then this, then this”). This proved to be too rigid. The skill has evolved to be more declarative, teaching the model what the tools are and the nuances of using them, but trusting the model’s general reasoning to figure out how to combine them to fulfill a user’s request.
  • Flexible Contracts: Unlike traditional APIs that require strict semantic versioning, skills allow for a looser contract. The agent discovers the available tools within the Marimo runtime. As Marimo is updated with more capabilities, the agent can automatically take advantage of them without needing a new, strictly-defined API. The skill simply points the agent to where the tools live.

Recursive Language Models and Agentic Reasoning

The underlying paradigm that makes these advanced workflows possible is the concept of a recursive language model. This is a system where a model can offload its context to an external environment rather than holding everything in its prompt.

  • Combating Context Rot: Large language models can “forget” or lose track of information when their context window becomes too large—a phenomenon known as “context rot.”
  • The Notebook as Memory: Recursive agents solve this by using an environment as working memory. For a standard coding agent, this environment is the file system. Marimo Pair extends this paradigm by making the Python runtime and the notebook itself part of that environment. The agent can store data in memory, inspect variables, and use the notebook’s cells as a structured representation of the steps it took to arrive at an answer.

AnyWidget: Bridging Python and the Web

Trevor’s journey to Marimo began with his open-source project, AnyWidget. It’s a toolkit and unified standard for bringing custom, interactive widgets into notebook environments (like Jupyter, Colab, and Marimo).

  • Lowering Activation Energy: The project’s philosophy is to lower the “activation energy” required to use powerful tools. While the Python ecosystem is rich with data manipulation libraries, bringing in interactive, web-based visualizations often requires a high overhead (e.g., downloading a separate app, exporting data).
  • Progressive Software Design: AnyWidget is designed to allow developers to move from a simple prototype (e.g., writing JavaScript for a widget directly in a notebook) to a full-fledged, modular, and reusable library. This encourages playfulness and rapid iteration. Widgets make it possible to interact with data more naturally, such as clicking on an outlier in a plot to select the corresponding data point, which then becomes a reactive variable that can trigger downstream cells in a Marimo notebook.

Career Advice: Go Deep and Stay Curious

Throughout his journey from a small town in Wisconsin to Harvard and founding-engineer life, a key theme has been the value of going deep on a topic out of pure curiosity. In an era of instant answers from AI, it’s crucial to actively cultivate the ability to learn something thoroughly. This practice of becoming a domain expert will always be valuable, regardless of how technology and AI evolve.

Share post

Stay In The Loop! Subscribe to Our Newsletter.

Get updates straight to your inbox. No spam, just useful content.

Recommended for You

Anthropic's Boris Cherny: Why Coding Is Solved, and What Comes Next

Anthropic's Boris Cherny: Why Coding Is Solved, and What Comes Next

Boris Cherny, creator of Claude Code, discusses the future of software development at AI Ascent 2026. He argues that coding is effectively a solved problem, detailing his personal workflow of shipping dozens of PRs daily from his phone. Cherny explores the shift from typeahead to autonomous agents, the rise of cross-disciplinary generalist teams, and uses the printing press as an analogy for the coming democratization of software creation for all.

Skill Issue: How We Used AI to Make Agents Actually Good at Supabase — Pedro Rodrigues, Supabase

Skill Issue: How We Used AI to Make Agents Actually Good at Supabase — Pedro Rodrigues, Supabase

A deep dive into building, testing, and iterating on Agent Skills to improve AI agent performance. This workshop covers the core concepts of progressive disclosure, eval-driven development, and practical application using a real-world Supabase and PostgreSQL security scenario.