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

# Maak je eerste Agent Sandbox

## Maak een account aan

Als je geen Novita-account hebt, <Link href="https://novita.ai/user/register" target="_blank">meld je dan eerst aan</Link>. Raadpleeg voor details de <Link href="/docs/nl/guides/quickstart">snelstartgids</Link>.

Nieuwe gebruikers kunnen een korte enquête voor accountconfiguratie invullen om \$100 aan gratis Sandbox-tegoed te claimen. Er is geen creditcard vereist.

## Maak een API-sleutel

Ga naar de Novita <Link href="https://novita.ai/settings/key-management" target="_blank">pagina voor sleutelbeheer</Link>, maak een API-sleutel aan en sla de waarde van de API-sleutel op voor gebruik in de volgende stappen.

## Installeer de SDK

Je kunt de Novita SDK installeren door de volgende opdrachten uit te voeren.

<CodeGroup isTerminalCommand>
  ```bash JavaScript & TypeScript SDK icon="terminal" theme={"system"}
  npm i novita-sandbox
  ```

  ```bash Python SDK icon="terminal" theme={"system"}
  pip install novita-sandbox
  ```
</CodeGroup>

## Configureer omgevingsvariabelen

Maak een `.env`-bestand aan in je projectmap als dit nog niet bestaat, en configureer je API-sleutel.

<Warning>
  Voor JavaScript- en TypeScript-projecten moet je het `dotenv/config`-pakket in je project importeren; voor Python-projecten moet je de `dotenv`-bibliotheek in je project importeren en de methode `load_dotenv` aanroepen om omgevingsvariabelen te laden.
  Raadpleeg voor details het [voorbeeld](#use-sdk-to-start-agent-sandbox).
</Warning>

```bash .env icon="terminal" highlight={2} theme={"system"}
NOVITA_API_KEY=sk_*** # Novita API key obtained from previous steps
```

Of je kunt de API-sleutel configureren door in je terminal een omgevingsvariabele in te stellen.

```bash Bash icon="terminal" highlight={2} theme={"system"}
export NOVITA_API_KEY=sk_*** # Novita API key obtained from previous steps
```

## Gebruik de SDK om Agent Sandbox te starten

Hieronder staat een eenvoudig voorbeeld dat laat zien hoe je een sandbox maakt, daarin code uitvoert en bestanden in het bestandssysteem van de sandbox opsomt.

<CodeGroup>
  ```js JavaScript & TypeScript icon="js" theme={"system"}
  // index.ts
  import 'dotenv/config'
  import { Sandbox } from 'novita-sandbox/code-interpreter'

  // The .env file should be located in the project root directory
  // dotenv/config will automatically look for .env in the current working directory
  // Or 
  // You can set the environment variable in the command line
  // export NOVITA_API_KEY=sk_***

  async function main() {
    const sandbox = await Sandbox.create()
    try {
      const execution = await sandbox.runCode('print("hello world")')
      console.log(execution.logs)

      const files = await sandbox.files.list('/tmp')
      console.log(files)
    } finally {
      // Close sandbox when no longer needed
      await sandbox.kill()
    }
  }
  main().catch((err) => {
    console.error(err)
    process.exit(1)
  })

  ```

  ```python Python icon="python" theme={"system"}
  # main.py
  from dotenv import load_dotenv
  from novita_sandbox.code_interpreter import Sandbox


  # The .env file should be located in the project root directory
  # dotenv will automatically look for .env in the current working directory
  load_dotenv()

  # Or 
  # You can set the environment variable in the command line
  # export NOVITA_API_KEY=sk_***

  sandbox = Sandbox.create()
  execution = sandbox.run_code("print('hello world')")
  print(execution.logs)

  files = sandbox.files.list("/")
  print(files)

  # Close sandbox when no longer needed
  sandbox.kill()
  ```
</CodeGroup>

Voer de volgende opdrachten uit om de code uit te voeren.

<CodeGroup isTerminalCommand>
  ```bash index.ts icon="terminal" theme={"system"}
  npx tsx ./index.ts
  ```

  ```bash main.py icon="terminal" theme={"system"}
  python main.py
  ```
</CodeGroup>
