Skip to content

Recipe needed: how should an agent *look* at a visual cell output? #57

Description

@shntnu

Problem

The skill's core mandate is to trust a result only after looking at the output - but that assumes human eyes. A live kernel returns text reprs; an altair/vega chart's repr carries no visual information. An agent has no sanctioned way to actually see a rendered chart, so it improvises. This bites even inside a proper marimo-pair session, not just headless flows.

Current behavior

marimo-pair returns text/repr from the kernel. There is no documented path to get a cell's rendered output back to the agent as an image.

Workaround used in practice

Render the chart to PNG and Read the file - which is how an agent caught two real bugs a text repr would have hidden (combo labels overflowing their wells; viability plates silently collapsing out empty rows/columns so they no longer matched the sibling plates):

import altair as alt  # chart object `ch`
ch.save("/tmp/out.png", ppi=120)   # needs vl-convert-python
# then Read /tmp/out.png

Considerations

  • Scope is a recipe, not a new _code_mode API. Likely home: reference/rich-representations.md.
  • Dependency question: bless vl-convert-python for altair, or reuse an existing mo screenshot/save mechanism?
  • Generality: matplotlib already rasterizes; altair needs the save step; interactive widgets do not rasterize at all - the recipe should state what is coverable and what is not.
  • A native "capture this output as an image" in _code_mode stays a possible future, explicitly out of scope here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions