Skip to main content
Human guide: task steps and agent prompt → Use this path when your work starts in Python, a notebook, a scheduler, or a backend that should not shell out to the CLI. For a direct provider tool instead of a Play, see tool execution recovery for the Idempotency-Key header and exact-key lookup endpoint. Python does not author .play.ts files. It calls a saved or Prebuilt Play over HTTP, receives a durable run ID, and observes that same run until terminal.

Run the maintained Python caller

Download the maintained Python caller and save it as run_prebuilt.py in your working folder. Replace its illustrative profile URL before starting provider-backed work. Before running, set DEEPLINE_HOST_URL and DEEPLINE_API_KEY in the trusted backend environment, or provide an existing uncommitted .env.deepline file. Use a workspace API key; keep it out of notebook output, client-side code, repositories and Play inputs. CLI auth status does not export a key to your shell. This caller does not read global CLI credentials.
In a repository checkout, the same source is docs-examples/sdk-v2/http-python/run_prebuilt.py; run it with python3 docs-examples/sdk-v2/http-python/run_prebuilt.py. The example saves person-email-run.json before polling. Keep that file with its original workspace authorization. A rerun observes the saved run rather than submitting another one. To start different work, use a separate working directory after reviewing the new input. The local wait lasts at most ten minutes, excluding individual request latency. A timeout preserves the run file and does not cancel remote work. Completed, failed, and cancelled outcomes are saved to person-email-result.json. If the launch response is lost before its run ID is saved, the file records an uncertain submission. The example stops rather than creating replacement work. Investigate that submission before clearing the record.

The caller contract

The example performs four deliberate actions:
  1. POST /api/v2/plays/run with a saved or Prebuilt Play name and JSON input.
  2. Persist run.id from the raw HTTP response before waiting.
  3. Poll GET /api/v2/runs/:runId and inspect run.status. Terminal states are completed, failed, and cancelled.
  4. Write the final response to JSON before you turn it into a CSV or update a destination.
Use Integrate a Play into your app for restart recovery, callbacks, destination writes and cancellation. The API reference owns exact HTTP request and response fields; Run Plays also covers CLI and TypeScript callers.