- A run is a durable document. It persists across many calls and retains what the agent “knows” about what it built.
- A task is one execution against a run — the act of submitting a prompt, running the agent, and producing output.
run_id) resume it.
Why separate them
In the web app, agents work on a document over many chat turns. The API mirrors that: turn 1 creates the scaffold, turn 2 adds a section, turn 3 changes the branding — and each turn should cost a fraction of turn 1 because the agent remembers what it built. Without run-level durability, every turn would re-inspect the document from scratch. With it, bookmark IDs, sheet names, chart references — everything the agent learned in turn 1 — are still in context for turn 5.Creating a run (implicit)
Every generation endpoint creates a run if you don’t passrun_id:
run_id is yours to keep. Store it with whatever record in your
system represents this document.
Resuming a run
Pass the samerun_id on the next call and add a new prompt:
- The agent’s conversation state is restored from our durable store,
keyed on
run_id. - The last saved document bytes are reloaded into the same run context the agent was using.
- The new prompt is appended as a fresh user message.
- The agent continues, using everything it already built.
download_urlpoints to the new saved state after this turn.
Tasks
Each invocation produces a task. In sync mode the task shape is hidden — you get the finished result back directly. In async mode you get atask_id to poll:
Listing runs
next_cursor field.
Downloading
Two options per run:<a href> — no extra round-trip.
Exporting to other formats
Convert a run’s output to PDF, PNG, etc. via POST /runs//export:| Source | Targets |
|---|---|
xlsx | pdf, csv, png, html |
docx | pdf, html, txt, odt |
pptx | pdf, png, odp |
/export?format=pdf twice for the same run
only runs the conversion once.
Retention
Runs are retained for 30 days after their last task. After that:- The
run_idstill resolves viaGET /runs/{run_id}for audit, but its state is markedexpired. - Resuming an expired run returns
410 gone. Start a fresh run instead. - The saved document bytes are removed from storage 30 days after expiry.
