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 withlead_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:
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:
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: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:
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.
- Define the state matrix: current state, transition Play, allowed next states, terminal outcome, and input/output table roles.
- Inspect existing transition Plays before authoring another. Use only children compatible with scalar composition.
- Persist state through
deepline.customerDb.query(...)in permitted, schema-qualified customer tables. Give each business record a stable key. - Define deterministic transition and handoff keys. Use database constraints
and supported conflict handling, such as
INSERT ... ON CONFLICT. - Recognize completed writes. Repair missing handoffs without duplicating completed outputs or next-state inputs.
- Record unknown states, forbidden moves, child failures, and invalid results. Failed transitions must not create a next-state handoff.
- Check every new Play. Publish compatible children before their callers, then verify their live versions.
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.