Author one bounded Play, check its contract, and inspect a representative run
before publication.
A Play is a function
A Play is a.play.ts file that default-exports an async function of its
input. The file name is the default play name;
export const config = { name } overrides it. deepline is the play runtime; every
call on it is recorded in run history.
enrich-lead-file.play.ts, then check and run it:
plays check validates without deploying or spending. -e runs code inline.
- The function’s one parameter is the input contract; destructuring it is fine.
- The plain object it returns is the result;
returnearly to end the play. export const config = { ... }, once at the top of the file, holds the description, triggers, and limits.- The file imports
deeplineand exports nothing but the play function and its optionalconfig.deeplineworks only in the play file; pass it to helper modules as an argument typedDeeplinePlayRuntimeContext.
lead_id under edition 10, so a failed
row is visible rather than silently dropped. Edition 11 CSV inputs retain each
source-row occurrence, including repeated keys. Non-CSV datasets and earlier
admitted editions keep their existing key-based deduplication behavior. Choose
the row policy from the admitted contract and reconcile every expected input
occurrence.
Discover a live contract before provider work
Do not copy a provider ID or payload from an old example. Search the current workspace, then read the schema:deepline describe <id> for both tool and Prebuilt Play contracts.
Choose the runtime primitive
Use
deepline.runPlay(...) for a Play, not deepline.tools.execute(...). A
child Play must be small enough to run inline. A child that owns a dataset,
CSV, event wait, or explicit timeout must run as a top-level Play instead.
Compose a local child with import child from './child.play' and pass child
in place of its name.
Validate before deployment or spend
Add operational guardrails
maxCreditsPerRun on every run. To replace it for one run,
pass --max-credits to deepline plays run; see
Cost control.
Use the smallest credit cap and schedule that fit the job. For a file pilot and
export review, use Batch CSV enrichment. For trigger
semantics, use Webhooks and schedules.
Compose an Engine from Plays
Use the Engine pattern when records need durable business states across executions. Keep the orchestrator and new transition Plays in a versioned project directory.- Define the state matrix: current state, transition Play, allowed next states, terminal outcome, and input/output table roles.
- Search for existing owned or prebuilt Plays for each transformation. Inspect the input and output contracts before choosing one.
- Use
deepline.runPlayonly for compatible scalar children. A child that owns a dataset, CSV, event wait, or explicit timeout needs a top-level lifecycle. - Implement state persistence 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, to recognize completed writes. Repair missing handoffs without inserting a second completed transition. - Record invalid states, forbidden moves, child failures, and invalid results. Do not hand a failed transition to the next state.
- Check each new child and the orchestrator, then publish compatible children before code that invokes them. Run a synthetic pilot before provider work.
Next steps
Prebuilt Plays
Discover a maintained Play or compose a scalar child Play.
SDK reference
Read the exact
deepline, dataset, and tool contracts.