> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Call Plays

> Start a local, named, or prebuilt Play from the CLI, TypeScript, another Play, or raw HTTP.

[Human guide: work with your agent →](https://deepline.com/docs/human/sdk-v2/calling-plays.md)

> [!NOTE]
>
> Start one supported Play and preserve the identity needed to observe that same
> execution.

Use the caller that already owns the work. A run started from outside Deepline
returns a durable run ID. persist it if the caller needs to resume observation.

## CLI

Use a local file while you are authoring it. Check it first, then run it.

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline plays check ./enrich-company.play.ts
deepline plays run ./enrich-company.play.ts \
  --input '{"domain":"stripe.com"}'
```

Use a named reference for a saved or Prebuilt Play:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline plays run prebuilt/person-linkedin-to-email \
  --input '{"linkedin_url":"https://www.linkedin.com/in/real-person/"}'
```

## TypeScript service or script

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

declare const runs: {
  insert(input: { runId: string; status: 'running' }): Promise<void>;
};

const deepline = await Deepline.connect();
const job = await deepline.play('prebuilt/person-linkedin-to-email').run({
  linkedin_url: 'https://www.linkedin.com/in/real-person/',
});

await runs.insert({ runId: job.id, status: 'running' });
const result = await job.get();
```

Persist `job.id` before you wait. A local timeout does not cancel the remote
run. [Production Play integration](https://deepline.com/docs/sdk-v2/production-integration.md) explains
how to resume the same run and write its result once.

## Inside another Play

Use `ctx.runPlay(...)` for a statically resolvable scalar child Play. Use
`ctx.tools.execute(...)` only for one provider-backed operation.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { definePlay } from 'deepline';

type Input = {
  linkedin_url: string;
};

export default definePlay(
  'resolve-lead-email',
  async (ctx, input: Input) => {
    const email = await ctx.runPlay(
      'person_email',
      'prebuilt/person-linkedin-to-email',
      { linkedin_url: input.linkedin_url },
      { description: "Resolve this lead's work email." },
    );

    return { email };
  },
  {
    description: 'Resolve one lead email through a scalar Prebuilt Play.',
  },
);
```

See [Prebuilt Plays](https://deepline.com/docs/sdk-v2/prebuilt-plays.md) for the child-play boundary.

## Inspect and export an existing run

Use the saved run ID to inspect existing work. Do not start another Play merely
to recover a result after your caller stops waiting.

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline runs list --play company-prospecting --json
deepline runs get <run-id> --full --json
```

Replace `company-prospecting` with your published Play's name. Select the
intended run from the list, then use its ID. Read the returned status and
available dataset paths before exporting rows:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline runs export <run-id> --dataset result.rows --out companies.csv
```

`result.rows` is an example path. Replace it with the path returned by your
run. Export reads retained rows. It does not execute the Play again.

Use [Run logs and events](https://deepline.com/docs/sdk-v2/run-events.md) for filtered execution evidence.
Use [Production integration](https://deepline.com/docs/sdk-v2/production-integration.md) to resume
application-owned observation and reconcile destination writes.

## Raw HTTP

Use HTTP for a non-TypeScript service, a notebook, or a scheduler that invokes
an already-saved or Prebuilt Play:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
curl -fsS -X POST "$DEEPLINE_HOST_URL/api/v2/plays/run" \
  -H "Authorization: Bearer $DEEPLINE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"name":"prebuilt/person-linkedin-to-email","input":{"linkedin_url":"https://www.linkedin.com/in/real-person/"}}'
```

For raw HTTP, the response's `run.id` is the run ID. The TypeScript SDK
normalizes that value to `job.id` (and its lower-level `workflowId` field).
[HTTP and Python](https://deepline.com/docs/sdk-v2/http-and-python.md) owns the polling example. [Runtime
API reference](https://deepline.com/docs/sdk-v2/api-reference.md) owns the generated endpoint contract.

## Verify this task

Persist the returned run identity before waiting. Inspect or export that run rather than starting another to recover its result.

Ask your agent to explain a failed check before repeating work or expanding the scope.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.