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

Chat LangChain

What can I help with?

Enter to send·Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithresourcessandboxesboxesBoxesResourcecreate_snapshot
Method●Since v0.16

create_snapshot

Copy
create_snapshot(
  self,
  path_name: str,
  *,
  body_name: str,
  
View source on GitHub
checkpoint
:
str
|
Omit
=
omit
,
confirm_allow_snapshot_secret_values
:
bool
|
Omit
=
omit
,
description
:
str
|
Omit
=
omit
,
docker_image
:
str
|
Omit
=
omit
,
fs_capacity_bytes
:
int
|
Omit
=
omit
,
image_config
:
box_create_snapshot_params
.
ImageConfig
|
Omit
=
omit
,
include
:
List
[
Literal
[
'all'
,
'mounts'
,
'proxy_config'
,
'env_vars'
,
'resources'
,
'lifecycle'
,
'labels'
]
]
|
Omit
=
omit
,
include_memory
:
bool
|
Omit
=
omit
,
labels
:
Dict
[
str
,
str
]
|
Omit
=
omit
,
run_config
:
box_create_snapshot_params
.
RunConfig
|
Omit
=
omit
,
tag
:
str
|
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
)
->
SnapshotResponse

Parameters

NameTypeDescription
checkpointstr | Omit
Default:omit

if omitted, creates a fresh checkpoint from the running VM

confirm_allow_snapshot_secret_valuesbool | Omit
Default:omit

Must be true when the included settings hold literal secret values (opaque values rather than workspace secret references, and any env var value), acknowledging that the snapshot stores them and every sandbox created from it can use them.

descriptionstr | Omit
Default:omit
docker_imagestr | Omit
Default:omit
fs_capacity_bytesint | Omit
Default:omit
image_configbox_create_snapshot_params.ImageConfig | Omit
Default:omit
includeList[Literal['all', 'mounts', 'proxy_config', 'env_vars', 'resources', 'lifecycle', 'labels']] | Omit
Default:omit
include_memorybool | Omit
Default:omit
labelsDict[str, str] | Omit
Default:omit
run_configbox_create_snapshot_params.RunConfig | Omit
Default:omit
tagstr | 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 snapshot by capturing the current state of a sandbox or promoting an existing checkpoint.

Description says what this snapshot's image can do, so a caller can hand it to an agent as a capability summary. At most 1024 characters.

sandbox-local Docker image to export

required for Docker image export unless the sandbox has a capacity

ImageConfig sets the command and ports the snapshot records, as a Docker image's ENTRYPOINT, CMD and EXPOSE do. By default a capture keeps those of the snapshot the sandbox was created from; each field given here replaces that one, and an empty list clears it. A function serving the snapshot runs this command and listens on its one exposed port.

Sandbox settings to carry into the snapshot. Sandboxes created from it start with each carried setting their create request leaves unset: "mounts" (the mount_config, with its auth), "proxy_config", "env_vars", "resources" (CPU and memory), "lifecycle" (idle_ttl_seconds, delete_after_stop_seconds, preserve_memory_on_stop), and "labels" (merged under this request's labels; reserved com.langchain.** labels are left out). "all" names every one of these. VM memory is captured with include_memory, not here. Warning: mounts, proxy_config and env_vars carry the sandbox's credentials, and every sandbox created from the snapshot can use them.

IncludeMemory, when true, captures a full VM memory snapshot alongside the filesystem clone. Only honored when the sandbox is running AND Checkpoint is omitted (i.e. a fresh in-VM checkpoint is requested). Defaults to false to keep snapshots small unless memory restore is explicitly desired.

Labels seed the captured snapshot's labels.

RunConfig overrides the runtime configuration the snapshot carries: for a docker_image export, the image's USER, WORKDIR and ENV; for a capture of the running VM, the sandbox's own. user and work_dir replace, env_vars merge.

mutable Docker-style tag; defaults to "latest"

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