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

AsyncServiceURL

Copy
AsyncServiceURL(
  self,
  browser_url: str,
  service_url: str,
  token: str,
  expires_at

Constructors

Attributes

Methods

View source on GitHub
:
str
,
*
,
embed_url
:
str
=
''
,
embed_origins
:
Optional
[
list
[
str
]
]
=
None
,
_refresher
:
Optional
[
Callable
[
[
]
,
Awaitable
[
AsyncServiceURL
]
]
]
=
None
)
constructor
__init__
NameType
browser_urlstr
service_urlstr
tokenstr
expires_atstr
embed_urlstr
embed_originsOptional[list[str]]
_refresherOptional[Callable[[], Awaitable[AsyncServiceURL]]]
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.

attribute
embed_url: str

Return the iframe URL without refreshing.

attribute
embed_origins: list[str]

Return the origins allowed to frame the URL, as the server normalized them.

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
get_embed_url

Return the URL to load in an iframe, refreshing if near expiry.

The token rides the URL fragment, so no server sees it. Append &redirect=/path to open a page other than /. Only pages on :attr:embed_origins may frame it.

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.

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())