> For the complete documentation index, see [llms.txt](https://docs.ai.neevcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ai.neevcloud.com/tutorials/create-your-first-sandbox-in-neevcloud-agentic-studio-javascript-sdk.md).

# Create Your First Sandbox in NeevCloud Agentic Studio (JavaScript SDK)

NeevCloud Agentic Studio lets you create and manage isolated sandbox environments programmatically. A sandbox is a secure, independent workspace where you can run code, test applications, and experiment freely without affecting your local system or production environment.

Building and managing isolated environments usually requires infrastructure setup, configuration, and maintenance.

With NeevCloud Agentic Studio, you can create and manage fully isolated sandbox environments programmatically using simple SDKs- without worrying about infrastructure.

In this tutorial, you will create your first sandbox using the JavaScript SDK, execute code inside it, manage its lifecycle, and also explore how to monitor it using the NeevCloud Console.

## Prerequisites

Before you begin, make sure you have:

* A NeevCloud account
* Node.js 18+
* [API Key](https://docs.ai.neevcloud.com/tutorials/create-api-key), Organization ID, and Project ID from the NeevCloud Console

No infrastructure setup is required.

***

## Step 1: Log in to NeevCloud Console

1. Open your browser and go to the [NeevCloud Console](https://console.ai.neevcloud.com/).
2. Sign in with your credentials.

***

## Step 2: Generate API Key

1. Go to API Key
2. Click [**Create API Key**](https://docs.ai.neevcloud.com/tutorials/create-api-key)
3. Add name and select resource type as **Sandboxes**
4. Click create, copy and store it securely

***

## Step 3: Retrieve Organization and Project IDs

You'll also need your Organization ID and Project ID to authenticate SDK requests.

**Find Your Organization ID**

Go to **Organization** from the left navigation menu. Your Organization ID is listed under the Organization ID column.

Example: `org-xxxxxxxx`

**Find Your Project ID**

Navigate to **Projects** from the left navigation menu. Copy the Project ID associated with the project you want to use.

Example: `prj-xxxxxxxx`

These values will be used when configuring your environment variables.

***

## Step 4: Initialize Project

```
mkdir neev-sandbox-demo
cd neev-sandbox-demo
npm init -y
```

Enable ES Modules:

```
npm pkg set type="module"
```

***

## Step 5: Install SDK

```
npm install @neevcloud/sdk dotenv
```

`@neevcloud/sdk` → NeevCloud JavaScript SDK

`dotenv` → Manage environment variables

***

## Step 6: Configure Environment

Create a `.env` file:

```
NEEV_API_KEY=your-api-key
NEEV_ORG_ID=your-org-id
NEEV_PROJECT_ID=your-project-id
```

Add `.env` to `.gitignore`.

***

## Step 7: Initialize Neev Client

Create `index.js`:

```javascript
import 'dotenv/config';
import { Neev } from "@neevcloud/sdk";

const neev = new Neev({
  apiKey: process.env.NEEV_API_KEY,
  orgId: process.env.NEEV_ORG_ID,
  projectId: process.env.NEEV_PROJECT_ID,
});
```

***

## Step 8: Create Sandbox

```javascript
const sandbox = await neev.sandboxes.create({
  name: "my-agent",
  sandbox_template_id: "sb-ubuntu-26-04-minimal",
  region: "as-south-1",
});

await sandbox.waitUntilReady();
console.log("Sandbox Ready:", sandbox.id);
```

`name` - A user-defined name for your sandbox. This helps you identify it later in the console or via SDK.

`sandbox_template_id` - Specifies the base environment for the sandbox.

`region` - Defines the geographic region where the sandbox will be created.

Important: Always wait until the sandbox is in Ready state before using it.

***

## Step 9: Run Code Inside Sandbox

```javascript
await sandbox.files.write(
  "main.py",
  "print('Hello from NeevCloud!')"
);

const result = await sandbox.exec([
  "sh",
  "-c",
  "python3 main.py"
]);

console.log(result.stdout);
```

Expected output:

```
Hello from NeevCloud!
```

***

## Step 10: Create Snapshot

```javascript
const pending = await sandbox.snapshot({ name: "checkpoint" });
```

Wait until ready:

```javascript
let snap = await neev.sandboxes.getSnapshot(pending.id);
while (snap.status !== "Ready") {
  await new Promise(r => setTimeout(r, 2000));
  snap = await neev.sandboxes.getSnapshot(pending.id);
}
console.log("Snapshot Ready:", snap.id);
```

***

## Step 11: Pause & Resume

Pause sandbox:

```javascript
await sandbox.pause();
console.log("Sandbox paused");
```

Resume sandbox:

```javascript
await sandbox.resume();
await sandbox.waitUntilReady();
console.log("Sandbox resumed");
```

***

## Step 12: Delete Sandbox

```javascript
await sandbox.delete();
console.log("Sandbox deleted");
```

This action is permanent.

***

## Step 13: Run Application

```
node index.js
```

***

## Step 14: Manage via NeevCloud Console (UI)

You can also manage sandboxes visually from the NeevCloud Console.

**Navigate to Sandboxes**

Go to: **AI Agents → Sandboxes**

**What you can do in UI**

* View all sandboxes
* Check status (Ready, Paused, etc.)
* See configuration (region, template, resources)

**Actions available**

* Refresh
* Pause / Resume
* Delete

These directly match SDK methods:

* `sandbox.pause()`
* `sandbox.resume()`
* `sandbox.delete()`

**Snapshots in UI**

* Open a sandbox
* Go to Snapshots tab
* Create and manage snapshots

**Metrics**

In the Metrics tab, monitor:

* CPU usage
* Memory usage
* Disk usage

***

## Conclusion

You have successfully:

* Created a sandbox using NeevCloud SDK
* Executed code inside it
* Managed snapshots
* Controlled lifecycle (pause, resume, delete)
* Used the UI for monitoring and management

NeevCloud enables both programmatic and visual control, making development faster and simpler.

***

## Additional Resources

* [`@neevcloud/sdk` on npm](https://www.npmjs.com/package/@neevcloud/sdk)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ai.neevcloud.com/tutorials/create-your-first-sandbox-in-neevcloud-agentic-studio-javascript-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
