# Sandbox VMs

## Create Agent Sandbox

`client.sandboxVMs.create(SandboxVMCreateParamsbody, RequestOptionsoptions?): Operation`

**post** `/v1/sandbox_vms`

Create an Agent Sandbox to run sandboxes on. An Agent Sandbox can be paused and resumed, and is billed for compute only while it is running.

### Parameters

- `body: SandboxVMCreateParams`

  - `name: string`

    Name of the Agent Sandbox. Unique within its project.

  - `project_id: string`

    ID of the project to create the Agent Sandbox in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `instance_type?: string`

    Instance type of the Agent Sandbox. Defaults to n1-highcpu-2 (2 vCPU, 4 GiB), the only size available.

  - `tags?: Array<string>`

    Tags to attach to the Agent Sandbox.

  - `vpc_id?: string`

    ID of the VPC to place the Agent Sandbox in. It must be a ready VPC in the Agent Sandbox's project and region.
    Omit it to use the project's oldest ready VPC in the region, or a new VPC when there is none.

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.sandboxVMs.create({
  name: 'my-sandboxes',
  project_id: '123e4567-e89b-12d3-a456-426614174000',
  region: 'us-sva-2',
});

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Get Agent Sandbox

`client.sandboxVMs.get(stringsandboxVMID, RequestOptionsoptions?): SandboxVM`

**get** `/v1/sandbox_vms/{sandbox_vm_id}`

Get an Agent Sandbox

### Parameters

- `sandboxVMID: string`

### Returns

- `SandboxVM`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string | null`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string | null`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string | null`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string | null`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" | "paused" | "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string | null`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: Array<string>`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string | null`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const sandboxVM = await client.sandboxVMs.get('sandbox_vm_id');

console.log(sandboxVM.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint_hostname": "0123456789ab.sandboxes.example.com",
  "image_version": "2026.11.1",
  "instance_type": "n1-highcpu-2",
  "name": "my-sandboxes",
  "opensandbox_version": "1.2.0",
  "paused_at": "2025-01-01T00:00:00Z",
  "power_state": "running",
  "powers_off_at": "2025-01-01T01:00:00Z",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "region": "us-sva-2",
  "status": "ready",
  "tags": [
    "production",
    "agents"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

## Update Agent Sandbox

`client.sandboxVMs.update(stringsandboxVMID, SandboxVMUpdateParamsbody, RequestOptionsoptions?): SandboxVM`

**patch** `/v1/sandbox_vms/{sandbox_vm_id}`

Update an Agent Sandbox's name and tags

### Parameters

- `sandboxVMID: string`

- `body: SandboxVMUpdateParams`

  - `name?: string`

    Name of the Agent Sandbox. Unique within its project.

  - `tags?: Array<string>`

    Tags to attach to the Agent Sandbox.

### Returns

- `SandboxVM`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string | null`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string | null`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string | null`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string | null`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" | "paused" | "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string | null`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: Array<string>`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string | null`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const sandboxVM = await client.sandboxVMs.update('sandbox_vm_id');

console.log(sandboxVM.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint_hostname": "0123456789ab.sandboxes.example.com",
  "image_version": "2026.11.1",
  "instance_type": "n1-highcpu-2",
  "name": "my-sandboxes",
  "opensandbox_version": "1.2.0",
  "paused_at": "2025-01-01T00:00:00Z",
  "power_state": "running",
  "powers_off_at": "2025-01-01T01:00:00Z",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "region": "us-sva-2",
  "status": "ready",
  "tags": [
    "production",
    "agents"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

## Delete Agent Sandbox

`client.sandboxVMs.delete(stringsandboxVMID, RequestOptionsoptions?): Operation`

**delete** `/v1/sandbox_vms/{sandbox_vm_id}`

Delete an Agent Sandbox, with its sandboxes and its disk. An Agent Sandbox can be deleted when it is ready or failed, whether it is running, paused or powered off.

### Parameters

- `sandboxVMID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.sandboxVMs.delete('sandbox_vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## List Agent Sandboxes

`client.sandboxVMs.list(SandboxVMListParamsquery, RequestOptionsoptions?): Cursor<SandboxVM>`

**get** `/v1/sandbox_vms`

List the Agent Sandboxes in a project

### Parameters

- `query: SandboxVMListParams`

  - `project_id: string`

    Project ID of resources to request

  - `cursor?: string`

    Pagination cursor returned by a previous request. Only valid for the same sort order.

  - `limit?: number`

    Maximum number of items to return

  - `name?: string`

    Filter by a case-insensitive substring of the Agent Sandbox name

  - `region?: string`

    Filter by region

  - `sort?: string`

    Comma-separated sort terms in precedence order, each field:asc or field:desc. Fields: created_at, updated_at

  - `tags?: Array<string>`

    Filter by tags. Repeat the parameter to require several tags; an Agent Sandbox must carry all of them.

### Returns

- `SandboxVM`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string | null`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string | null`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string | null`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string | null`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" | "paused" | "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string | null`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: Array<string>`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string | null`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const sandboxVM of client.sandboxVMs.list({ project_id: 'project_id' })) {
  console.log(sandboxVM.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2025-01-01T00:00:00Z",
      "endpoint_hostname": "0123456789ab.sandboxes.example.com",
      "image_version": "2026.11.1",
      "instance_type": "n1-highcpu-2",
      "name": "my-sandboxes",
      "opensandbox_version": "1.2.0",
      "paused_at": "2025-01-01T00:00:00Z",
      "power_state": "running",
      "powers_off_at": "2025-01-01T01:00:00Z",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "region": "us-sva-2",
      "status": "ready",
      "tags": [
        "production",
        "agents"
      ],
      "updated_at": "2025-01-01T00:00:00Z",
      "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Pause Agent Sandbox

`client.sandboxVMs.pause(stringsandboxVMID, RequestOptionsoptions?): Operation`

**post** `/v1/sandbox_vms/{sandbox_vm_id}/pause`

Pause an Agent Sandbox. Its sandboxes stop, keeping their files and installed packages but not their
running processes or memory, and compute billing stops. After an hour paused the Agent Sandbox is
powered off. A pause sent while another change runs waits for it, and pausing a paused Agent Sandbox
changes nothing.

### Parameters

- `sandboxVMID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.sandboxVMs.pause('sandbox_vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Resume Agent Sandbox

`client.sandboxVMs.resume(stringsandboxVMID, RequestOptionsoptions?): Operation`

**post** `/v1/sandbox_vms/{sandbox_vm_id}/resume`

Resume a paused or powered-off Agent Sandbox, restarting its sandboxes. A resume sent while another
change runs waits for it, and resuming a running Agent Sandbox changes nothing. Pausing doesn't free
quota and resuming doesn't use any: a paused Agent Sandbox still counts toward the sandbox quota's vms,
and Agent Sandboxes don't count toward its vcpu or memory_gb. A billing block returns 402.

### Parameters

- `sandboxVMID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.sandboxVMs.resume('sandbox_vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Restart Agent Sandbox

`client.sandboxVMs.restart(stringsandboxVMID, RequestOptionsoptions?): Operation`

**post** `/v1/sandbox_vms/{sandbox_vm_id}/restart`

Restart an Agent Sandbox's VM. Its sandboxes keep their files and installed packages but not their running
processes or memory. A restart sent while another change runs waits for it.
A billing block returns 402.

### Parameters

- `sandboxVMID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.sandboxVMs.restart('sandbox_vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Domain Types

### Sandbox VM

- `SandboxVM`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string | null`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string | null`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string | null`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string | null`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" | "paused" | "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string | null`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: Array<string>`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string | null`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Sandbox VM List

- `SandboxVMList`

  - `items: Array<SandboxVM>`

    - `id: string`

      Unique identifier for the Agent Sandbox.

    - `created_at: string`

      When the Agent Sandbox was created.

    - `endpoint_hostname: string | null`

      Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

    - `image_version: string | null`

      Version of the image the Agent Sandbox runs. Null until it is running.

    - `instance_type: string`

      Instance type of the Agent Sandbox.

    - `name: string`

      Name of the Agent Sandbox.

    - `opensandbox_version: string | null`

      Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

    - `paused_at: string | null`

      When the Agent Sandbox was paused. Null while it is running.

    - `power_state: "running" | "paused" | "powered_off"`

      Whether the Agent Sandbox's sandboxes can run.

      - `"running"`

      - `"paused"`

      - `"powered_off"`

    - `powers_off_at: string | null`

      When the paused Agent Sandbox is, or was, powered off. Null while it is running.

    - `project_id: string`

      ID of the project the Agent Sandbox is in.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

      - `"us-wdc-1"`

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

      - `"suspended"`

    - `tags: Array<string>`

      Tags attached to the Agent Sandbox.

    - `updated_at: string`

      When the Agent Sandbox was last updated.

    - `vpc_id: string | null`

      ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string | null`

    - `previous_cursor: string | null`

    - `total_count: number`

# Cost

## Estimate Agent Sandbox Create Cost

`client.sandboxVMs.cost.create(CostCreateParamsbody, RequestOptionsoptions?): CostQuote`

**post** `/v1/sandbox_vms/cost`

Return a priced cost quote for the proposed Agent Sandbox while it runs. A paused or powered-off Agent Sandbox is billed for its disk only.

### Parameters

- `body: CostCreateParams`

  - `name: string`

    Name of the Agent Sandbox. Unique within its project.

  - `project_id: string`

    ID of the project to create the Agent Sandbox in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `instance_type?: string`

    Instance type of the Agent Sandbox. Defaults to n1-highcpu-2 (2 vCPU, 4 GiB), the only size available.

  - `tags?: Array<string>`

    Tags to attach to the Agent Sandbox.

  - `vpc_id?: string`

    ID of the VPC to place the Agent Sandbox in. It must be a ready VPC in the Agent Sandbox's project and region.
    Omit it to use the project's oldest ready VPC in the region, or a new VPC when there is none.

### Returns

- `CostQuote`

  Cost quote returned by POST /cost. current_summary and updated_summary hold the org billing summary now and with this resource; omitted when the caller cannot view billing.

  - `currency: string`

    Currency the quote is denominated in. Always "USD" in v1.

  - `monthly_total: string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `priced_at: string`

    Timestamp the quote was priced at.

  - `usage_dimensions: Array<UsageDimension>`

    Priced rows, one per usage dimension emitted by the resource.

    - `dimension: string`

      Usage dimension being priced (e.g. compute_vcpu, storage_abs_gb).

    - `dimension_display_name: string`

      User-facing label for the dimension (e.g. "vCPU (hours)").

    - `monthly_amount: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `quantity: number`

      Quantity of the dimension being priced.

    - `unit_price: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `current_summary?: OrganizationBillingSummary`

    Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

    - `daily_cost: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `effective_balance: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `monthly_cost: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `promotional_credits: Array<PromotionalCredit>`

      Credits the organization earns automatically through the startup credits program, one per step. Empty when the organization is not part of the program.

      - `amount: string`

        Arbitrary-precision decimal serialized as a string (e.g. "58.40").

      - `kind: "organization_created" | "payment_method_added"`

        Step that earns the credit: creating the organization, or saving a payment method on it.

        - `"organization_created"`

        - `"payment_method_added"`

      - `status: "available" | "pending" | "granted"`

        Whether the credit can still be earned ("available"), was earned and is being issued ("pending"), or was issued ("granted"). A granted credit reaches the balance shortly after it is issued.

        - `"available"`

        - `"pending"`

        - `"granted"`

    - `recharge_threshold_days: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `estimated_next_charge_at?: string | null`

      Projected date the balance reaches the recharge threshold at the current run-rate. Null when there is no active usage (never charges).

    - `runway_months?: string | null`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `updated_summary?: OrganizationBillingSummary`

    Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const costQuote = await client.sandboxVMs.cost.create({
  name: 'my-sandboxes',
  project_id: '123e4567-e89b-12d3-a456-426614174000',
  region: 'us-sva-2',
});

console.log(costQuote.currency);
```

#### Response

```json
{
  "currency": "USD",
  "monthly_total": "-69125",
  "priced_at": "2025-01-01T00:00:00Z",
  "usage_dimensions": [
    {
      "dimension": "compute_vcpu",
      "dimension_display_name": "vCPU (hours)",
      "monthly_amount": "-69125",
      "quantity": 4,
      "unit_price": "-69125"
    }
  ],
  "current_summary": {
    "daily_cost": "-69125",
    "effective_balance": "-69125",
    "monthly_cost": "-69125",
    "promotional_credits": [
      {
        "amount": "-69125",
        "kind": "payment_method_added",
        "status": "available"
      }
    ],
    "recharge_threshold_days": "-69125",
    "estimated_next_charge_at": "2025-01-01T00:00:00Z",
    "runway_months": "-69125"
  },
  "updated_summary": {
    "daily_cost": "-69125",
    "effective_balance": "-69125",
    "monthly_cost": "-69125",
    "promotional_credits": [
      {
        "amount": "-69125",
        "kind": "payment_method_added",
        "status": "available"
      }
    ],
    "recharge_threshold_days": "-69125",
    "estimated_next_charge_at": "2025-01-01T00:00:00Z",
    "runway_months": "-69125"
  }
}
```
