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
PythonlangsmithresourcessandboxesboxesAsyncBoxesResourcegenerate_service_url
Method●Since v0.16

generate_service_url

Copy
generate_service_url(
  self,
  name: str,
  *,
  access: Literal['restricted', 'workspace', 
View source on GitHub
'off'
]
|
Omit
=
omit
,
embed_origins
:
SequenceNotStr
[
str
]
|
Omit
=
omit
,
expires_in_seconds
:
int
|
Omit
=
omit
,
port
:
int
|
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
)
->
ServiceURLResponse

Parameters

NameTypeDescription
accessLiteral['restricted', 'workspace', 'off'] | Omit
Default:omit

Access selects the login mode, mutually exclusive with the minted token. Omit the field for token mode: mint a short-lived service token (default). "restricted" — LangSmith login: the sandbox's creator, or any user with SandboxesExec on it (admins by default). "workspace" — LangSmith login: any member of the owning workspace. "off" — remove an existing LangSmith login grant and mint a token. A LangSmith login grant is durable; token mode is refused (409) while one exists.

embed_originsSequenceNotStr[str] | 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 short-lived JWT for accessing an HTTP service running on a specific port inside a sandbox. Returns a browser_url (sets auth cookie via redirect), an embed_url (for an iframe; carries the token in the URL fragment, so no server or Referer sees it), a service_url (for use with the X-Langsmith-Sandbox-Service-Token header), the raw token, and its expiry. Set access=restricted|workspace to instead enable durable LangSmith login (no token; users authenticate with their normal LangSmith session), or access=off to disable it. embed_origins names the pages that may show the URL in an iframe. In token mode they are bound into the minted token; with LangSmith login they are stored on the grant and a viewer signs in from inside the frame through a LangSmith popup. LangSmith login and token access are mutually exclusive per service URL.

EmbedOrigins are the pages allowed to show the service URL in an iframe, besides LangSmith itself: at most 5 origins such as https://app.example.com (http only for localhost). In token mode they are bound into the minted token, so they last as long as it does. With access "restricted" or "workspace" each call sets the grant's whole list, so omitting the field removes any origins set before.

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