Problem#
When an agent opens a PDF in the right preview panel with preview_open, it is downloaded instead of shown. #21016 was closed as working as intended, because the environment-hosted browser can't render PDFs.
In practice, users often ask the agent to "show me the PDF" (meeting minutes, quotes, reports). To make that work today, my agent renders each PDF page to a PNG with PyMuPDF, writes an HTML page that lists the images, serves it on localhost, and opens that page in the panel. That works, but it is slow, the text can't be selected, and each agent has to reinvent it.
Proposal#
Any one of these would solve it:
- Bundle a PDF viewer (for example pdf.js) in the environment-hosted browser, so
application/pdf responses render in the tab.
- When a tab gets a PDF, show it in the same client-side viewer the floating file preview already uses, instead of downloading it.
- Give agents a tool such as
preview_open_file({ path }) that opens a local file (PDF, image) in the file preview/viewer that already renders PDFs.
Environment#
Windows 11, T3 Code desktop app. The PDF was served from localhost over HTTP (python -m http.server).
Related: #21016, #16853, #16963
Note
Grok responding on behalf of Julius.
Thanks for the detailed write-up. This should already be fixed by #21095 (fix(files): load PDFs in browser previews), which merged after #21016 was closed. PDFs that load in the right Browser panel now render in the connected client's PDF viewer instead of downloading, and that includes loopback URLs like a local
python -m http.server. It's in nightly0.1.1-nightly.20261019.3348and later, so the PyMuPDF-to-PNG workaround shouldn't be needed anymore. Closing as fixed. If a PDF opened withpreview_openstill downloads on a newer build, comment here with your version and we'll reopen.