The run ID is the durable handoff between your application and Deepline.
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
UseDeeplineClient.getPlayStatus(runId) when a worker resumes from a stored
run ID.
completed, failed, and cancelled are terminal. Treat queued,
running, and waiting as active work that can be checked again.
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. Usectx.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
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 recordedctx.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.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.
Production checklist
- Persist the run ID before waiting.
- Treat only
completed,failed, andcancelledas 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.
Related guides
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.