Sandbox SDK 0.x API map·续
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
allowedHosts, deniedHosts, outbound, outboundByHost, outboundHandlers, outboundProxies, outboundProxy |
Pattern | A WorkerEntrypoint that applies the rules in the 0.12 order |
Handlers take (request, env, params). Refer to Apply the rules in an entrypoint. |
outboundByHost handlers that read Workers bindings |
Pattern | A WorkerEntrypoint for each hostname |
Refer to Reach Workers bindings from the container. |
interceptHttps |
Native | container.interceptOutboundHttps("*", fetcher) for every sandbox |
Add the certificate to the system bundle, and set NODE_EXTRA_CA_CERTS and REQUESTS_CA_BUNDLE. 0.12 checked HTTPS only with interceptHttps = true. Refer to What changes for requests. |
setAllowedHosts(), setDeniedHosts(), allowHost(), denyHost(), removeAllowedHost(), removeDeniedHost(), setOutboundHandler(), setOutboundByHost(), setOutboundByHosts(), removeOutboundByHost() |
Pattern | Methods that update the OUTBOUND_CONFIGURATION key and register the entrypoint again |
Rules that 0.12 stored keep applying. Refer to Replace the runtime setters. |
ContainerProxy |
Removed | Export your own entrypoint | Remove it from the exports of your Worker. |
gitCheckout() |
Pattern | exec() of git clone --filter=blob:none in /workspace |
Refer to Replace gitCheckout(). For private repositories, refer to Clone a private repository. |
Bucket mounts
For the steps, refer to Move bucket mounts. These APIs mount object storage in the container:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
mountBucket() with an S3 endpoint |
Package | S3Mount.mount(), with S3Gateway exported from your Worker |
Credentials stay in the Worker. Refer to Mount the bucket. |
mountBucket() with an R2 binding |
Package | S3Mount.mount() with the R2 S3 endpoint |
Needs an R2 API token for the bucket. 1.0 cannot mount through a binding. |
prefix, readOnly, s3fsOptions |
Package | keyPrefix, access, s3fsOptions |
keyPrefix has no leading /, access is required, and s3fsOptions is an object. |
credentials, R2_* and AWS_* variables |
Package | source.credentials |
Not read from the environment. |
credentialProxy, provider |
Removed | Not needed | S3Gateway signs every request. S3Mount always sets nomixupload, which 0.12 added only for R2. |
localBucket |
Package | S3Mount under wrangler dev with a local S3-compatible server |
Needs Wrangler 4.137.0 or later. Refer to Replace localBucket. |
unmountBucket() |
Package | S3Mount.unmount() |
Throws S3_MOUNT_BUSY while a process uses the path. |
BucketMountError, BucketUnmountError, InvalidMountConfigError, MissingCredentialsError, S3FSMountError |
Package | SandboxS3MountError |
An invalid request throws TypeError. |
| Mounts next to outbound rules | Pattern | Mount before interceptAllOutboundHttp() |
A mount registered after the catch-all intercept fails. Refer to If you moved outbound rules. |
Backups
For the steps, refer to Move backups. These APIs save and restore directories:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
createBackup(), restoreBackup() |
Package | DirectoryBackup backup() and restore() |
Your Durable Object stores the record. For the whole filesystem, use container.snapshotContainer(). |
name, gitignore |
Package | The DirectoryBackup options with the same names |
gitignore does not need git in the image. |
excludes |
Package | exclude |
.gitignore syntax. A pattern that starts with **/ matches at any depth, as 0.12 patterns did. |
ttl |
Pattern | An expiry time stored in the bucket next to the backup | 0.12 refused expired restores and kept the objects. |
multipart, localBucket, compression |
Removed | Not needed | Every backup goes through the R2 binding in parts. |
BACKUP_BUCKET |
Native | An R2 binding | Pass its name as the binding of DirectoryBackup. |
BACKUP_BUCKET_NAME, BACKUP_BUCKET_ENDPOINT, R2 access keys |
Removed | The R2 binding | The container never holds bucket credentials. |
BackupNotFoundError |
Package | SandboxBackupError with the code BACKUP_NOT_FOUND |
|
BackupExpiredError |
Pattern | The error that your expiry check throws | |
InvalidBackupConfigError |
Removed | TypeError |
|
BackupCreateError, BackupRestoreError |
Package | SandboxFileError or SandboxBackupError |
Refer to DirectoryBackup errors. |
| Backups made by 0.12 | Pattern | unsquashfs on backups/<id>/data.sqsh, then backup() |
Refer to Convert backups that 0.12 created. |
Code interpreter and subpath packages
These APIs came from the code interpreter and the subpath exports of the package:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
runCode(), createCodeContext(), listCodeContexts(), deleteCodeContext(), CodeInterpreter |
Pattern | An IPython kernel for each context, or a Dynamic Worker for JavaScript | Refer to Replace the code interpreter. |
runCodeStream(), onStdout, onStderr, onResult |
Pattern | A command with python3 - and its stdout |
Refer to Replace streaming output. |
@cloudflare/sandbox/opencode, createOpencode(), createOpencodeServer(), OpencodeOptions, OpencodeResult, OpencodeServer, OpencodeStartupError |
Pattern | opencode serve and an OpenCode SDK client |
Refer to Start an OpenCode server. |
proxyToOpencode(), proxyToOpencodeServer() |
Pattern | fetch() in your Durable Object, which forwards to the server port |
Refer to Start an OpenCode server. |
@cloudflare/sandbox/openai, Shell, Editor, CommandResult, FileOperationResult |
Pattern | Your own Shell and Editor |
ShellResult and ApplyPatchResult from @openai/agents replace the result types. Refer to Give OpenAI agents a shell and an editor. |
@cloudflare/sandbox/bridge, bridge(), resolveWorkspacePath(), shellQuote(), BridgeConfig, BridgeEnv, WorkerHandlers |
Pattern | Your own Worker routes | Refer to Replace the bridge. |
WarmPool, WarmPoolConfig, PoolStats |
Removed | Start each sandbox when a request needs it | Refer to Remove WarmPool. |
Images
0.12 published container images for the Sandbox class to build on:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
cloudflare/sandbox, -python, -opencode, and -musl images |
Removed | Your own linux/amd64 image |
Copy sandbox-shim into it if you use Files, S3Mount, or DirectoryBackup. Refer to Requirements. |
docker:dind-rootless with USER root |
Pattern | docker:dind with --ip-forward=false |
Refer to Run Docker inside the sandbox. |
Errors and clients
These APIs report failures and talk to the container:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
ContainerUnavailableError, OperationInterruptedError, RPCTransportError, SessionTerminatedError |
Removed | Native errors from container |
Not wrapped. |
ProcessExitedBeforeReadyError, ProcessReadyTimeoutError |
Pattern | The results of your readiness check | Refer to Preview a web application. |
isPlatformTransientError(), isDurableObjectCodeUpdateReset() |
Removed | error.retryable and error.overloaded |
Retry idempotent calls with a new stub when retryable is true, and never when overloaded is true. The package does not retry. Refer to Error handling. |
SandboxClient, BackupClient, CommandClient, FileClient, GitClient, InterpreterClient, PortClient, ProcessClient, UtilityClient |
Removed | container and Files |
Call them from your Durable Object. |
SANDBOX_LOG_LEVEL, SANDBOX_LOG_FORMAT |
Removed | Your own logs | The package does not log. Log from your Worker and read the logs in Workers Logs. |
Types
These 0.12 types describe the options and results of the methods in the earlier sections. Each type goes where its method goes:
| 0.12 | Kind | Replacement | Notes |
|---|---|---|---|
SandboxOptions, SandboxTransport, ISandbox, ContainerStub |
Removed | Your class | Refer to Class, identity, and lifetime. |
BaseExecOptions, ExecOptions, StreamOptions, ExecResult, ExecEvent, ExecuteRequest, CommandExecuteResponse, CommandsResponse |
Native | ContainerExecOptions, ExecProcess, ExecOutput |
wrangler types generates them. |
PtyOptions |
Native | ContainerExecPtyOptions |
Pass it as pty to container.exec(). The shell goes in the command. |
SessionOptions, SessionRequest, CreateSessionRequest, CreateSessionResponse, DeleteSessionRequest, DeleteSessionResponse |
Removed | cwd and env on each call |
|
ProcessOptions, ProcessStatus, ProcessStartResult, ProcessListResult, ProcessInfoResult, ProcessKillResult, ProcessLogsResult, ProcessCleanupResult, StartProcessRequest, WaitForLogResult, WaitForPortOptions |
Pattern | The types of your process methods | Refer to Move background processes. |
ReadFileRequest, WriteFileRequest, FileOperationRequest, MkdirRequest, ListFilesOptions |
Package | FileOperationOptions, MkdirOptions, RemoveOptions, FileContent |
|
FileMetadata, FileChunk, FileStreamEvent |
Removed | The Response from files.readFile() |
|
WatchOptions, FileWatchSSEEvent, CheckChangesOptions, CheckChangesResult |
Pattern | The events that your inotifywait reader returns |
Refer to Replace file watching. |
TunnelOptions, TunnelInfo, QuickTunnelInfo, NamedTunnelInfo |
Pattern | The types of your tunnel methods | Refer to Move tunnels. |
GitCheckoutRequest, GitCheckoutResult |
Pattern | The arguments and output of your git clone command |
Refer to Replace gitCheckout(). |
MountBucketOptions, RemoteMountBucketOptions, LocalMountBucketOptions, BucketCredentials, BucketProvider |
Package | S3MountRequest |
|
BackupOptions, DirectoryBackup, RestoreBackupResult |
Package | DirectoryBackupOptions, DirectoryBackupRecord, DirectoryRestoreOptions |
DirectoryBackupRecord adds size, name, sha256, and format, and drops localBucket. restore() returns nothing. In 1.0, DirectoryBackup is the class that saves and restores backups. |
CodeContext, CreateContextOptions, RunCodeOptions, ExecutionCallbacks, ExecutionResult |
Pattern | The CodeContext and Execution types of your kernel |
Refer to Replace the code interpreter. |
ContainerUnavailableContext, ContainerUnavailableReason, OperationInterruptedContext, OperationInterruptedReason, RPCTransportContext, RPCTransportErrorKind |
Removed | Not needed | Their errors are removed. |
SandboxClientOptions, RequestConfig, ResponseHandler, BaseApiResponse, ErrorResponse, PingResponse |
Removed | Not needed | The clients are removed. |
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/sandbox/sdk/migrate/api-map/#page","headline":"Sandbox SDK 0.x API map","description":"Every public API of @cloudflare/sandbox 0.12, and what replaces it in @cloudflare/sandbox 1.0, on this.ctx.container, or in your own code.","url":"https://developers.cloudflare.com/sandbox/sdk/migrate/api-map/","inLanguage":"en","image":"https://developers.cloudflare.com/sandbox/sdk/migrate/api-map/og.png?v=3a061fea855c758c","dateModified":"2026-10-23","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Replace @cloudflare/sandbox 0.12 startProcess(), Process objects, process logs, waits, and kills with Durable Object methods that take a process ID. title: Move background processes image: https://developers.cloudflare.com/sandbox/sdk/migrate/background-processes/og.png?v=05e666288fe97895
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/sandbox/llms.txt
Use this file to discover all available pages before exploring further.
Docs