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
Pythonlangsmithsandbox_tunnelAsyncTunnel
Class●Since v0.7

AsyncTunnel

Async wrapper around :class:Tunnel.

The underlying tunnel runs in background threads (TCP listener + bridges); async context-manager methods delegate to the sync tunnel via the event loop's executor.

Usage::

async with await sandbox.tunnel(remote_port=5432) as t:
    conn = await asyncpg.connect(host="127.0.0.1", port=t.local_port)
Copy
AsyncTunnel(
  self,
  dataplane_url: str,
  api_key: Optional[str],
  remote_port: int,
  *,
  local_port: int = 0,
  max_reconnects: int = 3
)

Constructors

constructor
__init__
NameType
dataplane_urlstr
api_keyOptional[str]
remote_portint
local_portint
max_reconnectsint

Attributes

attribute
local_port: int
attribute
remote_port: int

Methods

method
close

Shut down the tunnel (sync, safe to call from any context).

View source on GitHub