novita.volume.connect() connects to an existing volume by its ID and returns a Volume instance you can mount into sandboxes. Use it to reuse a volume that was created earlier — in a different process, session, or service — without re-creating it.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
novita.volume.connect() connects to an existing volume by its ID and returns a Volume instance you can mount into sandboxes. Use it to reuse a volume that was created earlier — in a different process, session, or service — without re-creating it.
import { Novita } from 'novita-sandbox'
const novita = new Novita()
const volume = await novita.volume.connect('vol-123')
console.log('Volume ID:', volume.volumeId)
console.log('Name:', volume.name)
from novita_sandbox import Novita
novita = Novita()
volume = novita.volume.connect("vol-123")
print("Volume ID:", volume.volume_id)
print("Name:", volume.name)
import { Novita } from 'novita-sandbox'
const novita = new Novita()
// 1. Connect to an existing volume by ID.
const volume = await novita.volume.connect('vol-123')
// 2. Create a sandbox.
const sandbox = await novita.sandbox.create()
try {
// 3. Mount the volume at a path inside the sandbox.
await sandbox.mountVolume(volume.name, '/mnt/data')
// 4. Read data that was persisted to the volume earlier.
const result = await sandbox.commands.run('cat /mnt/data/note.txt')
console.log(result.stdout)
} finally {
// 5. Clean up the sandbox. The volume and its data persist.
await sandbox.kill()
}
from novita_sandbox import Novita
novita = Novita()
# 1. Connect to an existing volume by ID.
volume = novita.volume.connect("vol-123")
# 2. Create a sandbox.
sandbox = novita.sandbox.create()
try:
# 3. Mount the volume at a path inside the sandbox.
sandbox.mount_volume(volume.name, "/mnt/data")
# 4. Read data that was persisted to the volume earlier.
result = sandbox.commands.run("cat /mnt/data/note.txt")
print(result.stdout)
finally:
# 5. Clean up the sandbox. The volume and its data persist.
sandbox.kill()
novita.volume.connect() looks up an existing volume and does not create a new one. If the volume ID does not exist, the call raises a not-found error (404). To create a new volume, use novita.volume.create() instead.