Delegate LangSmith access
Access delegation lets sandbox code call the LangSmith API without an API key inside the sandbox. The auth proxy injects credentials for requests to your LangSmith API host. Setaccess_delegation in the top-level request body when creating a sandbox with POST /v2/sandboxes/boxes:
INHERIT: Set{"mode": "INHERIT"}to inherit the caller’s current delegatable permissions. Do not includepermissions.EXPLICIT: Set{"mode": "EXPLICIT", "permissions": ["sandboxes:read"]}to restrict access to specific permissions you hold. The list must be nonempty.
Egress and network access control
The sameproxy_config that injects credentials also controls which destinations a sandbox can reach. Access control is enforced per connection on the sandbox host, so changes to access_control take effect immediately.
How egress works
- Access control applies to every outbound TCP connection, HTTP or not.
- HTTPS to a host matched by a rule or callback is decrypted by the proxy so it can inject headers; sandboxes trust the proxy’s CA. An active attribution rule or callback also triggers interception for every proxy-handled HTTPS destination. Without attribution, HTTPS to unmatched hosts passes through unchanged. Direct non-HTTP connections, including PostgreSQL, SSH, and Redis, pass through unchanged on their normal ports. Ports 80 and 443 are reserved for HTTP and TLS; a non-HTTP protocol on either port does not work.
- Use hostnames for direct connections by default. Raw TCP to a public literal IP requires an explicitly matching IP or CIDR entry in
allow_listand is unavailable in deny-list mode. HTTPS to a literal IP is dropped because the proxy needs a hostname in the TLS handshake. Cleartext HTTP on port 80 can use a literal IP. - Only TCP leaves the sandbox. UDP (including QUIC) and ICMP are dropped.
Default egress posture
With noaccess_control, every hostname is reachable on every TCP port, unless your organization is on restricted egress. The only exception is hosts that resolve to private, loopback, or cloud-metadata addresses, which the proxy refuses to dial. For a sandbox created with access_delegation, your LangSmith API host is exempt from the private-address check, so a self-hosted install whose hostname resolves to a private address, such as an internal load balancer, can still serve delegated requests. No other private destination is opened, and loopback and cloud-metadata addresses stay blocked. On a self-hosted installation, an allow_list entry that matches a private destination also opens it; see Reach private services directly. Add an access_control to restrict this.
- HTTP and HTTPS (ports 80 and 443) to any hostname are allowed. Outbound HTTP(S) is transparently routed through the proxy, where your
rulesandcallbacksinject credentials. - Raw TCP to hostnames is allowed. Connections to non-HTTP ports, such as databases (
psqlordbton 5432), SSH (22), and Redis (6379), pass through without protocol interception. - Raw TCP to a literal public IP address requires an explicit IP or CIDR entry in an
allow_list. Private, reserved, loopback, link-local, and cloud-metadata destinations remain subject to SSRF protections; see the self-hosted and delegation exceptions above.
* matches every hostname:
host:PORT entries to open specific raw TCP destinations on top of that, such as db.example.com:5432.
On a self-hosted installation, this list also lets the Sandbox reach private destinations on ports 80 and 443. List specific public hosts instead when Sandboxes must not reach your internal network.
Allow and deny lists
Add anaccess_control object to proxy_config with either an allow_list or a deny_list (not both—the request is rejected if both are set):
To enable raw TCP to a literal public IP address, use allow-list mode and allow the IP on every port or on a specific port, such as
8.8.8.8 or 8.8.8.8:53. A containing CIDR also allows every port in that range. Hostname, glob, and regex entries do not authorize applications that connect to a literal IP address.Pattern syntax
Eachallow_list/deny_list entry uses the following forms:
Matching is on the destination exactly as the sandbox addressed it. A hostname entry matches requests made to that hostname; an IP or CIDR entry matches requests made to a literal IP address. Neither is resolved:
deny_list: ["203.0.113.0/24"] does not block foo.example.com even when it resolves into that range, and allow_list: ["203.0.113.7"] does not allow it either. In allow-list mode, an IP or CIDR entry also permits raw TCP to a matching public literal IP. Direct IP connections are unavailable in deny-list mode, and HTTPS to a literal IP is dropped because the proxy needs a hostname in the TLS handshake. Cleartext HTTP on port 80 can use a literal IP when allowed by the active access control.
Entries that do not parse—example.com:abc, example.com:99999, or a CIDR with a port—are rejected when the sandbox is created or updated.
Organization-level restricted egress
Restricted egress limits sandbox connections to a LangSmith-managed allowlist of hosts and ports. It applies to non-Enterprise organizations by default and to organizations that request it. Organizations with an approved exemption can use unrestricted egress. The allowlist supports common development tasks, including installing packages, accessing source repositories, and calling model APIs. It includes PyPI, npm, GitHub, OpenAI, Anthropic, and LangSmith, primarily over HTTPS on port 443. Selected package repositories also allow HTTP on port 80. When restricted egress is enabled for your organization, LangSmith blocks destinations outside this allowlist. The organization policy replaces caller-suppliedaccess_control settings and disables no_proxy bypasses. Adding a destination to your sandbox’s allow_list or configuring credentials for it does not grant access beyond the organization policy.
An organization policy change does not automatically update existing sandboxes. Starting or waking an existing sandbox reuses its stored network configuration.
Request unrestricted access
If your sandbox needs destinations outside the managed allowlist, file a support ticket to request unrestricted egress for your organization. Include the following details:- Organization: Your organization or workspace ID and deployment region.
- Network requirements: The destination hostnames, ports, and a description of your use case.
- Affected sandbox: For an existing sandbox, its ID and the connection error.
Connecting to a database (raw TCP)
If your organization has restricted egress, request unrestricted access before connecting to a database outside the managed allowlist. To let sandbox code reach an external PostgreSQL database withpsql, dbt, or any driver, allow-list the host on its port. Because allow_list is default-deny, also list any HTTP(S) hosts the sandbox needs. Pin them to :443 unless you need other ports too:
db.example.com:5432 is passed through at the TCP layer with no interception, so the PostgreSQL wire protocol—and TLS, host-key checking, and any other end-to-end protocol on top of it—works unchanged.
Creating a sandbox boots it and returns once it reports
ready, so there is no wait step to add. GET /api/v2/sandboxes/boxes/{name}/status reports the current state if you need to re-check it later.Configure via SDK
Configure auth proxy rules
Add aproxy_config when creating a sandbox, or update an existing sandbox by patching its proxy_config. A proxy_config has:
Each rule specifies:
Header types
Each header has a requiredtype that controls how its value is stored and displayed:
Match rules by path or header
match_hosts alone sends every request to a host through one rule. Add match_paths or match_headers to give different requests to the same host different credentials. The proxy checks enabled header rules in list order and applies the first rule whose host, path, and headers all match, so put the more specific rule first.
match_paths patterns are compared with the request path, not the query string:
A pattern cannot put a wildcard in the middle of a path, such as
/v1/*/runs.
The same host can use a different credential per route. This example sends one secret for requests under /ingest and another for requests under /query:
match_headers entry is "name: value" with a lowercase name and an exact value, and the rule matches only when the request carries every listed header. Have the sandbox send a placeholder, and the rule replaces it with the real credential:
match_paths and match_headers are accepted on header rules only. aws, gcp, and relay rules reject both.
Set environment variables from a rule
A rule’senv_vars are plaintext environment variables set for every command in the sandbox while that rule is enabled. Use them for tools that refuse to run unless a credential variable is present, even though the proxy injects the real credential on the wire: give the variable a placeholder value so the command starts, and the proxy supplies the real credential.
Values are plaintext and are returned by the API, so never put a secret in env_vars. Use a header with the workspace_secret or opaque type instead.
Environment variables resolve in this order, from lowest precedence to highest:
- The snapshot image’s
ENV, when the sandbox opted intoapply_image_config. - Enabled proxy rules: When two enabled rules declare the same name, the later rule in
ruleswins. - The sandbox’s own
env_vars: Explicit per-sandbox values override values from rules.
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_EC2_METADATA_DISABLED, AWS_CA_BUNDLE; CLOUDSDK_AUTH_ACCESS_TOKEN, CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE) sit outside this order: a rule or a sandbox env_vars entry that declares one of them is rejected while the matching auth rule is enabled.
Every sandbox also has the common CA-bundle environment variables pointed at the system trust store, which includes the proxy’s CA, so tools that pin their own bundle still verify proxy-injected hosts. Set any of them yourself to override.
Add public attribution headers
An attribution rule adds public metadata, such asX-Agent-ID or X-Cost-Center, to every outbound HTTP(S) request the proxy handles. Use it when your egress gateway or a destination needs to identify which agent sent a request. Attribution runs alongside destination-specific credentials.
Self-hosted literal and callback attribution require LangSmith API and sandbox-host version 0.18.26rc1 or later. LangSmith Helm chart 0.18.0-rc.72 is the first chart that uses this release by default. For a separate sandbox cluster, use
langsmith-sandbox chart 0.18.0-rc.7 or later, with an appVersion matching the LangSmith chart.These minimum versions are release candidates, not generally available releases. The 0.17 release line does not include attribution support. If you override image tags, verify that both the API and sandbox-host images meet the version requirement.For self-hosted or BYOC deployments, upgrade every sandbox host before enabling attribution. Older hosts reject active attribution rules and can reject the entire proxy configuration, including credentials and access controls. The API does not send disabled or empty attribution rules to hosts.proxy_config.rules when creating or updating a sandbox:
enabled: true. Set enabled: false to retain the labels without injecting them. Removing the rule or setting headers: [] also disables attribution.
Attribution is additive, not a wildcard credential rule. Ordinary header rules still use first-match-wins matching. The proxy applies attribution after static and callback headers, replacing same-name headers without regard to case, and before provider signing.
Updating proxy_config replaces the whole configuration. It does not append a rule. Preserve existing rules, access_control, callbacks, and other settings in the replacement.
For the CLI, save the inner proxy_config object to a file and pass --proxy-config @proxy.json.
Validate attribution settings
Attribution rules have the following constraints, even when disabled:- Rule count: At most one attribution rule per configuration, including disabled rules.
- Header count: Up to 16 headers.
- Header names: Between 3 and 128 ASCII characters, starting with
X-. Use only letters, digits, and hyphens. Names must be unique, ignoring case. - Header values: Literal
plaintextvalues of at most 1024 bytes. Empty values are allowed. Values cannot contain line breaks, braces, or secret templates. Workspace-secret references and opaque values are not supported. - Matching and credentials: Do not set
match_hosts,match_paths,match_headers,env_vars, or provider, relay, or rewrite settings on the attribution rule itself. Keep credential rules separate.
X-Sandbox-ID, a header name is rejected if it meets any of these conditions:
- Contains
auth,token,secret,credential,cookie,session,signature,apikey,csrf, orxsrfanywhere in the name. - Contains a hyphen-delimited segment equal to
key, as inX-Api-Key. - Starts with any reserved prefix in the following table. Each prefix is literal, including whether it ends with a hyphen.
For example,
X-Session-ID and X-Tenant-ID are rejected. Use public labels such as X-Agent-ID or X-Cost-Center instead.
An enabled attribution rule with nonempty headers cannot coexist with a nonempty no_proxy list or an enabled relay rule. Remove the conflict or disable attribution. Disabled attribution and empty header lists do not impose these conflicts.
Refresh attribution through a callback
A callback withattribution_headers supplies selected headers for every proxy-handled HTTP(S) request. Use this mode for non-sensitive metadata that expires, rather than repeatedly updating literal configuration. It runs alongside destination credentials, not only when ordinary rules fail to match.
Callback attribution has the same version requirements as literal attribution. Upgrade hosts before enabling this mode. Older hosts reject the configuration, leaving the previous configuration active on a failed live update. Verify successful propagation before relying on attribution.
proxy_config.callbacks:
match_hosts and full_request. Ordinary credential callbacks still require scoped host patterns; a bare * remains invalid. Configure at most one attribution callback, with at most 16 combined callback and active literal header names. Names must be unique, ignoring case. Callback attribution also conflicts with no_proxy and active relay rules. Remove the callback to disable it.
Selected names follow the same restrictions as literal names. The API and proxy reject X-LangSmith-Agent-Access-Token, including case variants. Use destination-specific credential callbacks for authentication headers.
The callback response must contain exactly the selected headers and their earliest absolute expiration:
- Values: Nonempty, valid HTTP field values, up to 8192 bytes each.
- Response size: At most 64 KiB, with no missing, extra, or case-duplicate header names.
- Expiration: An RFC 3339
expires_atmore than 30 seconds in the future. - Caching: Per sandbox, callback configuration, destination host, and port. Entries expire after
ttl_secondsor 30 seconds beforeexpires_at, whichever comes first. - Failures: Callback errors, invalid responses, and failed refreshes block the covered request. The proxy never reuses stale values or forwards the request without required attribution.
Understand connection coverage
Attribution covers transparent HTTP on port 80 and hostname-based HTTPS on port 443. It also covers HTTP and HTTPS through an explicit proxy, including HTTPSCONNECT requests on nonstandard ports.
HTTP/1.1 and HTTP/2 requests are covered. For WebSockets, attribution applies to the HTTP/1.1 upgrade handshake, not subsequent WebSocket frames. Requests that declare a configured attribution name as a trailer are rejected with 400 Bad Request.
HTTPS interception requires the client to trust the proxy CA and the proxy host to trust the destination certificate. A private CA trusted only inside the sandbox does not establish host-side trust. Certificate-pinned clients can fail. Non-TLS protocols over explicit CONNECT, such as SSH or PostgreSQL, are unsupported while attribution is active. The proxy does not fall back to an untagged tunnel when interception fails.
Attribution does not tag raw TCP, direct sandbox links, or traffic that bypasses HTTP(S) handling, such as transparent connections on other ports. HTTP proxy requests rewritten to a sandbox destination remain covered after authorization checks. Attribution does not expand the protocols or destinations permitted by your network policy. Reconnect existing opaque tunnels, or restart the sandbox, after enabling attribution.
Authenticate AWS requests
Use an AWS auth rule when sandbox code needs to call AWS services with an AWS SDK or CLI. The proxy keeps the real AWS credentials outside the sandbox, then signs outbound HTTPS requests to*.amazonaws.com endpoints with AWS SigV4.
This is useful when agent code needs to inspect S3 objects, call Bedrock, or use another AWS endpoint without exposing long-lived AWS access keys in sandbox files, environment variables, shell history, or logs. The sandbox receives placeholder AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY values (plus AWS_EC2_METADATA_DISABLED=true and AWS_CA_BUNDLE) so SDK credential detection works, while the proxy replaces whatever the request carries with a real SigV4 signature. Only service.region.amazonaws.com hosts, S3 virtual-hosted and path-style hosts, and a few global endpoints such as iam, sts, and s3 are signed; plaintext HTTP to a matched AWS host is rejected with 403.
AWS auth rules are different from header injection rules:
- Set
typetoaws. - Put credentials under the
awsobject. - Do not set
match_hosts,match_paths, orheaders; AWS host matching is built into the proxy. - Configure at most one AWS auth rule per sandbox. The limit counts every AWS rule, including disabled ones.
Configure AWS auth via SDK
AWS_REGION through the sandbox’s env_vars or the rule’s env_vars, or most SDK and CLI calls fail before they reach the proxy.
Static AWS auth accepts an access key ID and secret access key, but not a caller-supplied session token. Deployments with AWS proxy role authentication enabled also support an IAM role as described below.
Authenticate with an IAM role
An AWS proxy role lets LangSmith assume a customer IAM role and sign supported AWS HTTPS requests with renewable temporary credentials. It works with or without S3 mounts, without exposing real credentials to sandbox code. This option requires deployment support for AWS proxy role authentication. ECR registry role authentication is a separate feature. In Create sandbox > Network, enable AWS authentication and select AWS IAM role. The form shows the exact LangSmith principal and workspace External ID that the customer role must trust. Follow the linked setup instructions to configure the trust and permissions policies, then enter the customer role in AWS role ARN.The SDK examples below require a release that supports
aws_auth(role_arn=...) in Python or awsAuth({ roleArn }) in TypeScript. Backend support alone does not add these helpers to an older SDK release.aws.role_arn instead of static credential fields:
Authenticate GCP requests
Use a GCP auth rule when sandbox code needs to call Google APIs with Google SDKs or CLIs. The proxy keeps the service account JSON outside the sandbox, then authenticates outbound HTTPS requests togoogleapis.com and its subdomains.
This is useful when agent code needs to inspect GCS objects or call another Google API without exposing service account JSON in sandbox files, environment variables, shell history, or logs. The sandbox receives a placeholder CLOUDSDK_AUTH_ACCESS_TOKEN (plus CLOUDSDK_CORE_CUSTOM_CA_CERTS_FILE) so gcloud runs, while the proxy replaces whatever authorization the request carries with a token minted from the configured service account. Google client libraries that discover credentials through Application Default Credentials do not read these variables and fail to find credentials; only gcloud and direct HTTPS calls are supported.
GCP auth rules are different from header injection rules:
- Set
typetogcp. - Put credentials under
gcp.service_account_json. - Set
gcp.scopesto a non-empty list of OAuth scopes. - The proxy matches
googleapis.comand its subdomains automatically and authenticates those requests with the configured service account. Hosts undergoogle.comare not matched. Plaintext HTTP to a matched host is rejected with403. - Configure at most one GCP auth rule per sandbox. The limit counts every GCP rule, including disabled ones.
gcp_auth and gcpAuth helpers build this same rule shape.
Configure GCP auth via SDK
gcloud or direct HTTPS calls to googleapis.com hosts normally inside the sandbox. The proxy applies the real GCP authentication without exposing service account JSON inside the sandbox.
Single API example
Create a sandbox that automatically injects an OpenAI API key into outbound requests:api.openai.com are now authenticated by the proxy; no real key is stored in the sandbox. SDKs that refuse to start without an API key still need a placeholder—set one with the rule’s env_vars, as in the GitHub example.
Multiple API example
Add multiple rules to authenticate with several services at once:GitHub example
Open SWE authenticates GitHub access by minting a short-lived GitHub App installation token outside the sandbox, then patching the sandbox with write-onlyopaque proxy rules. This keeps the short-lived GitHub access token out of the sandbox filesystem and out of deployment environment variables.
Configure two rules:
Python
configure_github_proxy after creating or reattaching to a sandbox. GitHub App installation tokens expire, so refresh the proxy config whenever you reuse a sandbox for a new run.
The github-api rule sets GH_TOKEN to a non-secret placeholder, which satisfies the gh CLI’s local credential check. Commands then run without a per-command prefix:
Authorization header into the outbound request.
Configure via SDK
Callback credential example
Staticworkspace_secret rules pull credentials from your workspace when the proxy configuration is applied, and opaque rules let your application patch in short-lived credentials such as the GitHub token example. For credentials that must be resolved by your own service at proxy time, use a callback. The proxy POSTs to a URL you provide, your endpoint returns the headers to inject, and the proxy caches the result.
Callbacks are configured alongside rules under proxy_config:
Static rules win. For credential callbacks, if an enabled header-injection rule matches both the host and the path, the callback is skipped for that request. Within rules, first-match-wins; the same applies between credential callbacks if multiple match. Attribution callbacks are never skipped this way; they run alongside destination credentials.
Callback contract
This contract covers credential callbacks. Attribution callbacks receive the same request but must return exactly the selected headers and anexpires_at; see Refresh attribution through a callback.
The proxy makes the following request whenever it needs to resolve credentials for a matched host on a cache miss:
identity tells your endpoint which sandbox is asking, so one callback URL can serve many sandboxes and mint per-sandbox or per-user credentials. ls_user_id is the creating user and is omitted when the sandbox was created with a workspace or service key. Ignore fields and headers you do not recognize; the proxy may add more.
Your endpoint must respond 2xx with a JSON body:
ttl_seconds. Any non-2xx response, transport error, or malformed JSON fails closed: the sandbox’s request is rejected with 502 callback resolution failed (no headers injected, response not cached). Redirects are not followed and count as failures.
Verify callback requests
request_headers let your endpoint check a shared secret you chose. To verify that a request came from LangSmith and was not altered in transit, check the X-LangSmith-Signature-JWT header. It is a JWT signed with an Ed25519 key (alg: EdDSA) whose public half is published at <LANGSMITH_ENDPOINT>/.well-known/jwks.json, selected by the token’s kid.
Verify the signature against the JWKS, check every claim above, hash the body you received, and compare it to
body_sha256. Then trust identity in the body.
Example
Use a callback when your OAuth tokens are minted on demand by your own service:Configure via SDK
Connect these docs to your agent of choice via MCP for real-time answers.

