Skip to main content
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

The checked example is docs-examples/sdk-v2/http-python/run_prebuilt.py. It reads DEEPLINE_HOST_URL and DEEPLINE_API_KEY from environment variables or an uncommitted .env.deepline file.
Use a workspace API key from a trusted backend environment. Do not put it in a notebook output, client-side application, repository, or Play input.

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 until the status is completed, failed, or cancelled.
  4. Write the final response to JSON before you turn it into a CSV or update a destination.
If the caller restarts or its local wait expires, resume with the stored run ID; do not create a replacement run just because local polling ended. For durable destination writes and callbacks, use Production Play integration.

When to use each caller

Use Call Plays for the CLI, TypeScript, and raw HTTP entrypoints. Use Runtime API reference for exact request and response fields.