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

# Verouderd automatisch pauzeren en hervatten

export const SandboxBetaVersionWarning = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    return <Warning>The following legacy features require the legacy SDK and CLI versions listed in <Link href="/docs/nl/guides/sandbox-legacy-e2b-compatible" target="self">Legacy SDKs & CLI</Link>. Please note that legacy features may be less stable than production releases. If you encounter any issues while using these features, please <Link href="https://meetings-na2.hubspot.com/junyu" target="_blank">contact us</Link>.</Warning>;
  }
};

<Warning>
  Deze verouderde pagina wordt behouden voor gebruikers die nog steeds de 1.x- of beta-SDK-lijn gebruiken. Nieuwe SDK 2.x-integraties moeten de huidige Sandbox-documentatie volgen.
</Warning>

<SandboxBetaVersionWarning />

Wanneer de sandbox-instantie momenteel niet nodig is, maar je deze later op elk moment moet kunnen hervatten, kun je de [documentatie](/docs/nl/guides/sandbox-legacy-persistence) raadplegen om sandbox-instanties handmatig te pauzeren en te hervatten.

De functie **"Automatisch pauzeren en hervatten"** zorgt ervoor dat je sandbox-instantie automatisch pauzeert na [time-out](/docs/nl/guides/sandbox-lifecycle) en wordt hervat wanneer dat nodig is. Wanneer je probeert bewerkingen uit te voeren (zoals opdrachten uitvoeren, code uitvoeren of bestandsbewerkingen) op een gepauzeerde sandbox, wordt deze automatisch hervat zonder handmatige tussenkomst.

## Automatisch pauzeren inschakelen

Je kunt de functie voor automatisch pauzeren inschakelen door de parameter `auto_pause` in te stellen op `true` bij het maken van een sandbox-instantie. De sandbox-instantie pauzeert automatisch na de time-out en kan later worden hervat.

<Warning>
  Opmerking: De hervatte sandbox-instantie behoudt de functie voor automatisch pauzeren en pauzeert opnieuw automatisch na de time-out.
</Warning>

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

  const sandbox = await Sandbox.create(
      {
          timeoutMs: 5_000,
          autoPause: true
      },
  );
  console.log('Sandbox created', sandbox.sandboxId)

  console.log('Waiting for 10 seconds...')
  await new Promise(resolve => setTimeout(resolve, 10000));

  const resumedSandbox = await Sandbox.connect(sandbox.sandboxId)
  console.log('Sandbox resumed', resumedSandbox.sandboxId)

  await sandbox.kill()
  ```

  ```python Python icon="python" theme={"system"}
  from novita_sandbox.core import Sandbox
  import time

  sandbox = Sandbox.create(
      timeout=5,
      auto_pause=True,
  )
  print('Sandbox created', sandbox.sandbox_id)

  print('Waiting for 10 seconds...')
  time.sleep(10)

  resumed_sandbox = Sandbox.connect(sandbox.sandbox_id)
  print('Sandbox resumed', resumed_sandbox.sandbox_id)

  sandbox.kill()
  ```
</CodeGroup>

## Automatisch hervatten inschakelen

Je kunt de functie voor automatisch hervatten inschakelen door de sleutel `auto_resume` in `metadata` in te stellen op `true` bij het maken van een sandbox-instantie. Zodra dit is ingeschakeld, wordt de sandbox automatisch hervat wanneer je probeert een bewerking uit te voeren op een gepauzeerde sandbox (zoals opdrachten uitvoeren, code uitvoeren, bestandsbewerkingen, enz.).

<Warning>
  Opmerking: De standaardtime-out voor de hervatte sandbox is 5 minuten. Je kunt de time-out van de sandbox bijwerken met de methode `setTimeout` of `set_timeout`.
</Warning>

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

  const sandbox = await Sandbox.create(
      {
          metadata:{"auto_resume": "true"}
      }
  );
  console.log('Sandbox created', sandbox.sandboxId)

  await sandbox.betaPause()
  console.log('Sandbox paused', sandbox.sandboxId)

  const result = await sandbox.commands.run('ls -al')
  console.log('Command result', result)

  await sandbox.kill()
  ```

  ```python Python icon="python" theme={"system"}
  from novita_sandbox.core import Sandbox

  sandbox = Sandbox.create(
      metadata={
          "auto_resume": "true",
      }
  )
  print('Sandbox created', sandbox.sandbox_id)

  sandbox.beta_pause()
  print('Sandbox paused', sandbox.sandbox_id)

  result = sandbox.commands.run('ls -al')
  print('Command result', result)

  sandbox.kill()
  ```
</CodeGroup>
