> ## 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.

# Run Plays and view results | Agent guide

> Start your selected Play, preserve its run ID, and inspect or export the same execution.

[Human guide: task steps and agent prompt →](https://deepline.com/docs/human/sdk-v2/calling-plays.md)

A Play is reusable logic; a run is one execution with its own input and result.
Start with the [selected Play](https://deepline.com/docs/sdk-v2/prebuilt-plays.md) and
[prepared CSV](https://deepline.com/docs/sdk-v2/batch-csv.md). Review the sample and available usage estimate
before starting; a run can spend Deepline credits.

The dashboard, CLI, and SDK use the same run API. A run started by your agent
also appears in the dashboard, and you can inspect a dashboard run by its ID.

## In the web app

1. Open the selected Play from [Tools > Prebuilt plays](https://code.deepline.com/dashboard/tools),
   or find a saved Play in [All plays](https://code.deepline.com/dashboard/play-library).
   Check the org.
2. Open the start control above the steps, labeled **Run here** or **Start**
   when a trigger is configured. Choose **Run here** from its menu.
3. Fill in required fields or attach the sample CSV. Check the inputs, then
   select **Run**.
4. Inspect the selected run's status, results, and errors. Return through its
   run history or [Recent runs](https://code.deepline.com/dashboard/plays).

Open a run record to inspect its output. For datasets that run wrote, its
**Download … CSV** controls export that run's rows. The CLI below also exports
a specific saved run and dataset.

## Run with the CLI

Use the reference and column mappings you checked in the preceding guides.
For example, this batch Play accepts first name, last name, and company domain:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline plays run prebuilt/name-and-domain-to-email-waterfall-batch \
  --csv leads-pilot.csv \
  --columns.first_name first_name \
  --columns.last_name last_name \
  --columns.domain domain \
  --run-id-file ./leads-pilot-run.json
```

The CLI waits by default. `--run-id-file` saves the accepted run ID immediately,
before waiting finishes; its destination must not already exist. Preserve the
returned `run.id` and `dashboardUrl`. Use `--no-wait` if your caller needs to
return immediately and inspect the run later.

For single-record Plays, supply the described fields with `--input` instead.
For a local authored Play, check the file before running 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"}'
```

### Run a short snippet inline

`-e` accepts the body of a Play function. The CLI supplies the `deepline`
import, and `input` contains the object passed through `--input`:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline plays run -e "deepline.log('hello'); return { ok: true };"
```

This starts a remote run, rather than a local-only preview. The CLI temporarily
writes `.inline.play.ts` in the current folder, refuses to overwrite an existing
file, and removes its temporary file afterward. Relative imports and file paths
resolve from that folder. Use a saved `.play.ts` file when the logic needs review
or reuse; a snippet that calls providers can spend Deepline credits.

## Inspect and export an existing run

Use the saved run ID to resume inspection. If you lost it, use
`deepline runs list --play <play-name> --json` and select the intended execution.
Do not start another run merely to recover a result.

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

`result.rows` is an example path. Read the run's dataset paths and use the
matching command in `actions.exportDatasetCmds`. Dataset previews are samples;
export reads the full retained dataset without executing the Play again.
For a scalar result marked `available_in_full`, use `runs get --full`.
That option does not replace dataset export.

Review status, input identifiers, output, and errors against your acceptance
rule. A completed run can contain no matches or unresolved rows. An active
run's export is partial; inspect its status before treating counts as final.
Use [Run logs and events](https://deepline.com/docs/sdk-v2/run-events.md) to investigate execution failures.

> [accordion] Run from a 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();
> ```
>
> This single-record example persists `job.id` before waiting. 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 that run and reconcile destination writes.

> [accordion] Call a Play inside another Play
>
> Use `deepline.runPlay(...)` with a stable call key and a statically resolvable scalar
> child reference. Children that use CSV, datasets, event waits, or explicit
> runtime timeouts need a top-level run. Use `deepline.tools.execute(...)` for one
> provider-backed operation. [Build a Play](https://deepline.com/docs/sdk-v2/plays.md#choose-the-runtime-primitive)
> explains the boundary and provides authoring examples.

> [accordion] Start a saved Play over HTTP
>
> Use HTTP for a non-TypeScript service, notebook, or scheduler:
>
> ```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/"}}'
> ```
>
> Persist the response's `run.id`; the TypeScript SDK exposes it as `job.id`.
> [Call Plays from Python or HTTP](https://deepline.com/docs/sdk-v2/http-and-python.md) covers polling, and the
> [API reference](https://deepline.com/docs/api-reference.md) defines the endpoint contract.

> [!TIP]
>
> Keep the run ID and export together. If a response is lost or waiting stops,
> inspect that run before submitting another execution. Exporting saved rows
> does not repeat provider work.

Next, [Visualize a saved result](https://deepline.com/docs/sdk-v2/visualize-data.md) from this run's output.


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