Delete a File
Remove a file (or an empty directory) from a sandbox directly from your client. The path is the agent-visible absolute path (e.g. /workspace/tmp.txt) and must resolve beneath one of the sandbox's configured mounts.
Delete
Removes the target. Deleting a directory only works if it's empty, list it and delete the children first otherwise.
index.ts
await sandbox.deleteFile("/workspace/tmp.txt");Clear a directory by listing it and deleting each child:
index.ts
for (const e of await sandbox.listDirectory("/workspace/scratch")) {
if (!e.is_dir) await sandbox.deleteFile(e.path);
}i
Like the other file methods, this runs as the operator and bypasses the per-mount ACLs. It deletes through the mount's backend, so removing a file on a GCS or Drive mount deletes the underlying object. Deletes are permanent, there's no trash.
Next: Network Access