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

# Your first SDK run

> Start a maintained Play from TypeScript, save its identity, and inspect the same execution.

Start the funded-company starter from a TypeScript script. You will save its
run ID and read its status. This lesson uses a maintained Play, so you do not
need to author or publish one.

## Before you start

Complete [Start with your agent](https://deepline.com/docs/quickstart.md) through its connection and Play
inspection steps. This lesson starts a new provider-backed run and can incur
usage, even if you already completed the agent lesson.

Use Node.js 24.12 or later and npm. This example uses Node's built-in
[TypeScript support](https://nodejs.org/docs/latest-v24.x/api/typescript.html).
The `.mts` extension makes the script an ES module.

## 1. Prepare a project

In your terminal, create a new folder and install the SDK:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
mkdir deepline-first-run
cd deepline-first-run
npm init -y
npm install deepline@latest
```

Check the effective workspace from this folder:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline auth status --json
deepline describe prebuilt/starter-funded-ai-founders --json
```

> [!TIP]
>
> Authentication reports `connected: true` for the intended workspace. The
> maintained Play accepts `target_count: 3` and `days: 30`.

If this folder does not resolve the intended authorization, complete
[workspace setup](https://deepline.com/docs/sdk-v2/multi-org.md) before continuing.

## 2. Save the script

Create `first-run.mts` in that folder:

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

const deepline = await Deepline.connect();
const receiptPath = 'first-run-receipt.json';

writeFileSync(receiptPath, JSON.stringify({ runId: null }), { flag: 'wx' });

const job = await deepline.play('prebuilt/starter-funded-ai-founders').run({
  target_count: 3,
  days: 30,
});

writeFileSync(receiptPath, JSON.stringify({ runId: job.id }, null, 2));
console.log('Run ID:', job.id);
console.log('Status:', (await job.status()).status);
```

`Deepline.connect()` uses SDK configuration, including supported CLI credentials.
It constructs the client. It does not by itself prove that a request is authorized.

The script creates a receipt before submission. The exclusive `wx` flag prevents
another launch when that file already exists. After submission, the script saves
`job.id` before reading status.

## 3. Start the run once

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
node first-run.mts
```

You should see a **Run ID** and a **Status**. The status is a snapshot. It can
still be `queued` or `running` when the script exits.

> [!TIP]
>
> `first-run-receipt.json` contains the same run ID printed in your terminal.
> You now have the identity needed to inspect this execution.

If the script fails, inspect the receipt before doing anything else.
A saved `runId` means you can inspect that run. A null `runId` means this script
has no confirmed execution identity. Investigate the submission before starting
new work. Do not delete the receipt merely to bypass the guard.

## 4. Inspect the same execution

Replace `<run-id>` with the value in your receipt:

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

Repeat this inspection command while the run is processing. Do not rerun the
launch script to check progress. Exiting the local script does not cancel the
remote execution.

When the run completes, ask your agent to show its result dataset. Review the
funding evidence, founder identity, and email verification as in the
[first lesson](https://deepline.com/docs/quickstart.md#4-review-the-recorded-result). Compare `count` with
`requested_count` and `shortfall_count`. Completion does not guarantee three
accepted rows. A failure needs diagnosis rather than an invented result.

You started a maintained Play from the SDK, saved `job.id`, and used that ID
to observe the same work.

## Check your understanding

The script printed `running` and exited. Should you launch it again to get the result?

> **Show the answer**
>
> No. The remote run can continue after the script exits. Inspect the ID saved
> in the receipt. Starting another run creates separate work and can incur
> usage.

In your next session, locate the receipt and explain how you would resume
inspection. Ask your agent to check your reasoning before another submission.

## Continue

* [Call Plays](https://deepline.com/docs/sdk-v2/calling-plays.md) covers other supported callers.
* [Production integration](https://deepline.com/docs/sdk-v2/production-integration.md) covers durable submission and recovery.
* [Write Plays](https://deepline.com/docs/sdk-v2/plays.md) covers your own workflow logic.


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