ComputerAgent
ComputerAgent copied to clipboard
Binary artifact output (pptx/pdf/xlsx/zip): a clearer first-class path
Context
Today, getting a binary artifact (.pptx, .pdf, .xlsx, .zip, .png, …) out of an agent works, but the path is ad-hoc:
- Tell the agent in the prompt to use
Bash+Writeto callpython-pptx/ Marp / pandoc / whatever. - Hope the agent picks the right library, installs it, and writes to the right path.
- Fetch the bytes via
GET /v1/sessions/:id/fs/file?path=….
This works (the FS API streams raw bytes for any content type), but the prompt is doing all the work. The agent re-derives the recipe every turn, install steps run cold, and there's no shared library of artifact generators across agents.
Three patterns we have today, ranked by control
| Pattern | What | Tradeoff |
|---|---|---|
| A. Agent writes a script + Bash-runs it | pip install python-pptx && python make.py inside the sandbox |
Most flexible. Cold install on every run. Prompt-engineering heavy. |
| B. Agent writes Markdown + invokes a CLI | marp deck.md -o deck.pptx, pandoc → pdf |
Fastest to prompt. Less design control. CLI must be in the substrate image. |
| C. Custom MCP tool we provide | Define make_pptx({title, slides[]}) once; tool handler runs in our process |
Cleanest. Reusable across agents. Requires building the tool. |
What I'd like to design
A first-class "artifacts" path that:
- Ships a small library of common generators as MCP tools the agent can opt into:
make_pptx(python-pptx or Marp under the hood)make_pdf(pandoc / weasyprint)make_xlsx(openpyxl)make_chart(matplotlib)make_zip(bundle workdir files)
- Lives in a new package, e.g.
@computeragent/artifacts— opt-in, not bundled by default. - Each generator is a thin MCP tool that writes into the harness workdir, so the existing
/v1/sessions/:id/fs/fileAPI is unchanged. No new transport. - Substrates that support it (E2B, VZVM) bake the deps into the image so the cold-install latency disappears.
LocalSubstrateeither skips (graceful no-op + clear error) or uses host deps. - The SDK exposes a typed helper:
await agent.fetchArtifact(\"deck.pptx\")returns a Buffer/Blob — no need to construct the FS URL by hand.
Open questions to resolve before building
- Tool packaging. Ship as MCP tools registered at
createHarnessServer({...})boot, or as a GAPtools/overlay an agent can declare? Probably both; MCP for ad-hoc, GAP overlay for agents that promise specific outputs. - Templates. Slides especially benefit from house style. Do we ship a default Marp/pptx theme? Allow agents to register custom themes?
- Sandbox image bloat.
python-pptx + pandoc + weasyprint + matplotlibis ~500MB. Worth a separate "artifacts-enabled" template (Wedge 3b.5 pattern), not bundled into the default harness image. - Error surface. Today a broken
Bashcall shows up as a tool error in the SSE stream. With a typed artifact tool we can emit a structuredca_artifact_failedevent with the diagnostic — clearer for UIs. - Streaming binaries. PPTX/PDF can be 1-50MB. Range requests are already supported by the FS route per PLAN.md, but verify with a 50MB binary.
Use cases driving this
- Marketing agents producing decks, one-pagers, ad-creative bundles
- Sales agents producing proposal PDFs
- Analytics agents producing Excel reports
- Data agents producing chart bundles
- Code-gen agents producing zipped scaffolds
Until then — the workaround
Pattern A works today against E2BSubstrate. Example sketch in the comment thread below — happy to ship a concrete examples/marketing-agent-deck.ts once we have an E2B_API_KEY to verify it end-to-end.
Definition of done for this issue
- A package proposal (name, surface, generator list)
- Decision on tool registration model (MCP at boot vs GAP overlay vs both)
- Decision on substrate image strategy (separate template vs bundle)
- A spike: one generator (
make_pptxvia Marp) end-to-end against E2B with a typedagent.fetchArtifact()helper