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

> ## Agent Instructions
> These docs cover learner integrations through Hosted Lab Pages, the SDK, and the REST API. Content management is outside this integration scope.
> Read the setup page for the chosen approach before implementing it. Keep organization API keys and hosted mint secrets on the server.
> The public SDK is coming soon. Check the SDK quickstart for current availability. Do not invent installation commands or direct readers to a private package.
> Cybr provides completion tracking and CTF verification. The integrating platform decides whether to award points.

# Lab lifecycle

> Understand readiness, deployment runs, expiration, and teardown.

## Deployment states

A launch creates a deployment ID before the environment is ready. `getStatus()` returns one of three states:

| Status | Meaning |
| - | - |
| `loading` | The environment is not ready |
| `complete` | The environment is ready and `outputs` is present |
| `failed` | Deployment failed or the environment ended |

The word `complete` describes deployment readiness. It does not describe learner completion.

## Wait for readiness

```ts theme={null}
const ready = await deployment.waitUntilReady({
  pollIntervalMs: 5000,
  timeoutMs: 15 * 60_000,
  onProgress: (status) => console.log(status.status)
})
```

The default interval is five seconds. The default deadline is 15 minutes, checked between status requests.

A pending status request is not canceled by the wait deadline or signal. It can still return readiness after either occurs.

Cancellation stops later polls and the sleep between polls. It does not end the environment. Provisioning duration depends on the lab.

The [polling reference](/reference/labs-and-deployments#readiness-polling) explains request timeouts and cancellation.

## Expiration

A lab has a `timeLimit` in minutes. Your organization can customize that value within its permitted range.

Cybr ends the environment at its deadline. A browser countdown does not control that deadline.

The public status response does not supply an authoritative expiration timestamp. A timer based on observed readiness is an estimate.

Before telling a learner that an environment remains active, read its current status.

## End a lab

```ts theme={null}
await deployment.destroy()
```

The request starts teardown. Ending the lab does not record learner completion.

If the request returns `conflict`, read the status before another end request. Do not retry in a tight loop.

## Deployment runs

Runs describe the individual build and teardown operations:

```ts theme={null}
const runs = await deployment.getRuns()
// Or: await cybr.deployments.getRuns(deployment.id)
```

Each run has an `action`, `status`, `exitCode`, `outputs`, `error`, and timestamps. These fields help with diagnostics.

Run output can contain secrets. Keep it out of public logs.

See [launching labs](/guides/launching-labs) for learner-facing output handling.
