LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_clientresourcessandboxesboxesBoxesResourcecreate
Method●Since v0.9

create

Copy
create(
  self,
  *,
  cpu_millicores: int | Omit = omit
View source on GitHub
,
delete_after_stop_seconds
:
int
|
Omit
=
omit
,
env_vars
:
Dict
[
str
,
str
]
|
Omit
=
omit
,
fs_capacity_bytes
:
int
|
Omit
=
omit
,
idle_ttl_seconds
:
int
|
Omit
=
omit
,
labels
:
Dict
[
str
,
str
]
|
Omit
=
omit
,
mem_bytes
:
int
|
Omit
=
omit
,
mount_config
:
box_create_params
.
MountConfig
|
Omit
=
omit
,
name
:
str
|
Omit
=
omit
,
preserve_memory_on_stop
:
bool
|
Omit
=
omit
,
proxy_config
:
box_create_params
.
ProxyConfig
|
Omit
=
omit
,
restore_memory
:
bool
|
Omit
=
omit
,
snapshot_id
:
str
|
Omit
=
omit
,
snapshot_name
:
str
|
Omit
=
omit
,
tag_value_ids
:
SequenceNotStr
[
str
]
|
Omit
=
omit
,
vcpus
:
int
|
Omit
=
omit
,
extra_headers
:
Headers
|
None
=
None
,
extra_query
:
Query
|
None
=
None
,
extra_body
:
Body
|
None
=
None
,
timeout
:
float
|
httpx
.
Timeout
|
None
|
NotGiven
=
not_given
)
->
SandboxResponse

Parameters

NameTypeDescription
cpu_millicoresint | Omit
Default:omit

CPUMillicores optionally requests CPU at millicore granularity (e.g. 500 = 0.5 vCPU); takes precedence over VCPUs. Fractional (sub-vCPU) values are not available for every sandbox.

labelsDict[str, str] | Omit
Default:omit
preserve_memory_on_stopbool | Omit
Default:omit
restore_memorybool | Omit
Default:omit
extra_headersHeaders | None
Default:None
extra_queryQuery | None
Default:None
extra_bodyBody | None
Default:None
timeoutfloat | httpx.Timeout | None | NotGiven
Default:not_given

Create a new sandbox from a snapshot.

Provide at most one of snapshot_id or snapshot_name; if neither is provided, the server uses the default snapshot.

Labels are free-form key/value metadata persisted with the sandbox and returned on reads. Labels from the source snapshot are inherited unless overridden here.

PreserveMemoryOnStop, when true, suspends the sandbox's memory on a voluntary stop (idle timeout or explicit stop) so the next start resumes from where it left off. Default false discards memory and keeps only the filesystem, so the next start is a cold boot. Restarts triggered by infrastructure maintenance always preserve memory regardless of this setting.

RestoreMemory selects how the sandbox handles a snapshot's captured memory:

nil → if-present: resume from memory when the snapshot has it, else cold-boot (default). true → always: resume from memory; rejected if the snapshot has none. false → never: always cold-boot.

Applies to this request only.

Send extra headers

Add additional query parameters to the request

Add additional JSON properties to the request

Override the client-level default timeout for this request, in seconds