Skip to main content
A run is an asynchronous canvas-generation task. You submit a prompt, optionally constrain the templates or block types, and poll until the run reaches a terminal state. See Canvases and runs for the conceptual model.

Creating a run

All arguments except prompt are keyword-only. runs.create returns a RunHandle (or AsyncRunHandle) that holds run_id, canvas_id, and a reference back to the client.

Uploading files

The SDK normalises several shapes so you can mix them freely:
Content types are inferred from the filename if you don’t pass one. Paths opened by the SDK are closed automatically after the request. Supported file types and size limits are documented on File uploads.

Waiting for completion

handle.wait() polls the server with exponential backoff until the run reaches a terminal state, then returns the RunResult:
wait raises SpineAPIError if the run terminates with status failed. Partial successes (some blocks failed, some succeeded) return normally — inspect handle.refresh().errors afterwards.

Streaming progress

Drive a progress bar with handle.stream_progress(). It yields a RunProgress snapshot on each poll and exits silently when the run terminates — call wait() or refresh() afterwards to get the result.
Async version:

Manual polling

If you want full control, call client.runs.get() directly:
See Polling and status for the server-side semantics (typical run durations, recommended intervals).