Skip to main content
A Deepline play is an asynchronous job. Starting one returns a public run ID before the work necessarily finishes. Persist that ID, then use it to observe the same run until Deepline reports a terminal state.
An application starts a play, persists its run ID, lets Deepline run asynchronously, then recovers the terminal result.

The run ID is the durable handoff between your application and Deepline.

A timeout in your HTTP client, request handler, worker lease, or polling loop does not stop the Deepline run. Do not start the enrichment again only because your local wait ended.

Choose where the result is written

The best integration depends on who should validate and persist the final result. Start with persisted polling. Move to a callback when polling is operationally awkward. Let the play write directly only when that ownership and credential boundary fit your system.

Persist and poll

Persist the run ID before waiting. If the process restarts or its local wait budget ends, a background worker can recover the same run.

Start the run

PlayJob.id is the public run ID. Save it before calling get(), tail(), or starting your own polling loop.

Resume the same run

Use DeeplineClient.getPlayStatus(runId) when a worker resumes from a stored run ID.
Only completed, failed, and cancelled are terminal. Treat queued, running, and waiting as active work that can be checked again.
Use the run ID as the idempotency key for the destination write. Repeated polls, worker restarts, or duplicate completion delivery then converge on one stored result.

Call your application when a custom play finishes

Use a custom play when you want Deepline to finish the enrichment and then make a durable outbound request to your application. The custom play owns the callback step; this is distinct from an inbound webhook that starts a play. Use ctx.runPlay(...) to call a prebuilt play and ctx.fetch(...) for the recorded callback. Keep callback credentials in declared play secrets, require HTTPS, and reject invalid tokens in your application. Pass a stable application request ID into the custom play, store its mapping to the Deepline run ID, and echo it in the callback payload. Source: docs-examples/sdk-v2/enrich-and-notify.play.ts
The application should acknowledge the callback only after it has validated the payload and committed an idempotent write.

Let the custom play write directly

A custom play can also enrich the record and write the result to the final destination through a Deepline integration or a recorded ctx.fetch(...) step. This removes the polling worker and callback service. It also moves final-write ownership into the play. Use narrowly scoped credentials and make the destination operation idempotent. Choose this pattern when:
  • the play owns the complete business transaction;
  • your application does not need to validate the result first;
  • the destination supports a safe upsert or idempotency key;
  • you are comfortable storing scoped destination credentials in Deepline.

Handle local timeouts

A local wait budget and a remote run state are separate. Keep the final status response when a run fails. Its run ID, progress, and error context make support and replay decisions much easier.

Stop a run intentionally

Ending a local request does not cancel a play. Stop the run explicitly when the user cancels the underlying job or the result is no longer useful.
From raw HTTP:
Stopping a run is a product decision. Do not use cancellation as the automatic response to a short polling window.

Design for a latency-sensitive request path

Prebuilt plays can use multiple providers, retries, and fallback paths to improve coverage and price-performance. That work can outlive an interactive request. For a tighter latency budget, choose one of these:
  • fork the prebuilt play and keep only the providers or branches that matter to the request path;
  • return a pending state to the user and finish enrichment in the background;
  • call synchronous provider endpoints and own their rate limits, transient errors, retries, caching, and observability in your application.
Do not force a broad enrichment waterfall into a synchronous UI deadline.

Production checklist

  • Persist the run ID before waiting.
  • Treat only completed, failed, and cancelled as terminal.
  • Resume the same run after timeouts and worker restarts.
  • Key final writes by run ID.
  • Validate and authenticate callback payloads.
  • Scope destination and callback credentials narrowly.
  • Stop runs only when cancellation is intentional.
  • Keep run IDs and terminal responses in logs and support records.
  • Pilot the integration with a small, representative input set before scaling.

Call Plays

Start plays from TypeScript, the CLI, another play, or raw HTTP.

Background Agents

Run Deepline safely from workers, scheduled jobs, and CI.

HTTP and Python

Start and poll plays from non-TypeScript systems.

API Reference

Inspect run status, streaming, output, and stop contracts.