Skip to main content
Human guide: task steps and agent prompt → Build a custom Play for your own routing, provider order, acceptance rules, or destination writes. Existing Plays and tools can supply its building blocks. Choose a prebuilt Play when its contract already fits.

Before you start

Use an installed Deepline CLI and a project connected to the intended workspace. Installation and project setup cover those steps. This example accepts a CSV with lead_id and linkedin_url headers. It calls one scalar email Play per row. Inspect that child’s required input, output, access, and price before composing it:
For a provider action, search and inspect its contract before adding deepline.tools.execute. Keep credentials in workspace integrations or declared Play secrets.

The authoring contract

A Play is a .play.ts file that imports the deepline runtime and default-exports an async function. The file name is its default Play name; export const config = { name } can override it. The function’s input type defines the input contract, and its plain-object return is the result. Save this as enrich-lead-file.play.ts:
The optional config object holds the name, description, triggers, runtime, billing, and other supported settings. Declare it once at module scope with statically resolvable values. A description helps people understand the saved Play. The file exports only its Play function and optional config. Use deepline inside the Play file. Pass it to helpers as an argument typed DeeplinePlayRuntimeContext when they need runtime operations. email_result holds the child’s complete result, including its no-result or validation evidence. It is not an email-address string. Inspect the child contract before extracting individual fields. The returned rows dataset contains successful rows. Failed rows and their errors remain in the saved run. Current edition 11 CSV inputs retain every source-row occurrence, including repeated keys. Non-CSV datasets and earlier admitted editions retain their key-based deduplication behavior. Reconcile the expected input occurrences and failed rows before expanding the file. The SDK reference explains these policies.

Choose the runtime primitive

Use deepline.runPlay(...) for compatible scalar children. A child with its own dataset, CSV, event wait, or explicit timeout needs a separate top-level run. Import a local scalar child with import child from './child.play' and pass child instead of its name. The SDK reference owns the exact signatures and limits. For direct tool, step, or HTTP calls, choose staleAfterSeconds explicitly. Use 0 for fresh logical work. A positive integer permits reuse within that many seconds; null permits indefinite reuse. Recovery of the same operation is separate from this freshness choice.

Validate before deployment or spend

Check the saved source:
The check does not publish or start provider work. Fix its errors before running the file. For a short experiment, the CLI also accepts inline code with plays run -e. Prepare a representative CSV, then follow Run Plays and view results to run the file and inspect its saved dataset and errors. Compare accepted results with your business rule. The example sets billing.maxCreditsPerRun to 25 Deepline credits. Choose a cap for your actual sample before execution. It controls provider-call admission; already admitted work and compute can remain billable. Control costs explains this limit and the --max-credits override. Publish only after the sample passes review:
Verify the live version against the publication result. Publishing changes what callers of that Play name execute. For recurring work, continue with Schedule or trigger a Play.

Compose an Engine from Plays

Use the Engine pattern when business states must persist across runs. /deepline-engine guides its construction. Keep the orchestrator, transition Plays, shared types, and state diagram in a versioned project.
  1. Define the state matrix: current state, transition Play, allowed next states, terminal outcome, and input/output table roles.
  2. Inspect existing transition Plays before authoring another. Use only children compatible with scalar composition.
  3. Persist state through deepline.customerDb.query(...) in permitted, schema-qualified customer tables. Give each business record a stable key.
  4. Define deterministic transition and handoff keys. Use database constraints and supported conflict handling, such as INSERT ... ON CONFLICT.
  5. Recognize completed writes. Repair missing handoffs without duplicating completed outputs or next-state inputs.
  6. Record unknown states, forbidden moves, child failures, and invalid results. Failed transitions must not create a next-state handoff.
  7. Check every new Play. Publish compatible children before their callers, then verify their live versions.
Test terminal and unknown states, forbidden transitions, child failures, invalid results, repeated inputs, and interrupted handoffs. If concurrent runs can advance the same record, test the workflow’s conflict policy. Stable call labels alone do not prevent independent executions. Apply a provider-free test matrix before a provider-backed pilot. Set the pilot’s per-run credit cap. External writes need destination-supported idempotency or reconciliation; an Engine does not supply a cross-system transaction.

Next steps

Choose a prebuilt Play

Discover a maintained Play or compose a scalar child Play.

SDK reference

Read the exact deepline, dataset, and tool contracts.

Verify this task

Reconcile input rows, accepted results, explicit misses, and failed rows. Verify the live revision only after the checked sample meets your acceptance rules.