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

AsyncServiceURL

Async variant of :class:ServiceURL with auto-refreshing token.

Properties and HTTP helpers are async. Use with :meth:AsyncSandboxClient.service or :meth:AsyncSandbox.service.

Example::

svc = await sb.service(port=3000)

resp = await svc.get("/api/data")
print(await svc.get_browser_url())
Copy
AsyncServiceURL(
  self,
  browser_url: str,
  service_url: str,
  token: str,
  expires_at: str,
  *,
  _refresher: Optional[Callable[[], Awaitable[AsyncServiceURL]]] = None
)

Constructors

constructor
__init__
NameType
browser_urlstr
service_urlstr
tokenstr
expires_atstr
_refresherOptional[Callable[[], Awaitable[AsyncServiceURL]]]

Attributes

attribute
token: str

Return the raw JWT without refreshing.

attribute
service_url: str

Return the base URL without refreshing.

attribute
browser_url: str

Return the browser auth URL without refreshing.

attribute
expires_at: str

Return the expiration timestamp without refreshing.

Methods

method
get_token

Return the raw JWT, refreshing if near expiry.

method
get_service_url

Return the base URL, refreshing if near expiry.

method
get_browser_url

Return the browser auth URL, refreshing if near expiry.

method
get_expires_at

Return the ISO 8601 expiration, refreshing if near expiry.

method
request

Make an async HTTP request to the service, injecting the auth header.

method
get

Async HTTP GET to the service.

method
post

Async HTTP POST to the service.

method
put

Async HTTP PUT to the service.

method
patch

Async HTTP PATCH to the service.

method
delete

Async HTTP DELETE to the service.

method
from_dict

Create an AsyncServiceURL from API response dict.

View source on GitHub