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
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
Language
Theme
Pythonlangsmithsandbox_async_sandboxAsyncSandbox
Class●Since v0.6

AsyncSandbox

Represents an active sandbox for running commands and file operations async.

This class is typically obtained from AsyncSandboxClient.sandbox() and supports the async context manager protocol for automatic cleanup.

Copy
AsyncSandbox(
  self,
  name: str,
  template_name: str,
  dataplane_url: Optional[str] = None,
  id: Optional[str] = None,
  created_at: Optional[str] = None,
  updated_at: Optional[str] = None,
  _client: AsyncSandboxClient = None,
  _auto_delete: bool = True
)

Example:

async with await client.sandbox(template_name="python-sandbox") as sandbox: result = await sandbox.run("python --version") print(result.stdout)

Constructors

constructor
__init__
NameType
namestr
template_namestr
dataplane_urlOptional[str]
idOptional[str]
created_atOptional[str]
updated_atOptional[str]
_clientAsyncSandboxClient
_auto_deletebool

Attributes

attribute
name: str
attribute
template_name: str
attribute
dataplane_url: Optional[str]
attribute
id: Optional[str]
attribute
created_at: Optional[str]
attribute
updated_at: Optional[str]

Methods

method
from_dict

Create an AsyncSandbox from API response dict.

method
run

Execute a command in the sandbox asynchronously.

method
write

Write content to a file in the sandbox asynchronously.

method
read

Read a file from the sandbox asynchronously.

View source on GitHub