The auth proxy lets sandbox code call external APIs (OpenAI, Anthropic, GitHub, etc.) without hardcoding credentials. When configured on a sandbox, a proxy sidecar automatically injects authentication headers into matching outbound requests using your workspace secrets or write-only credentials you provide in the proxy config.Documentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-mdrxyd-1779813393-7298843.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Configure auth proxy rules
Add aproxy_config when creating a sandbox, or update an existing sandbox by patching its proxy_config. Each rule specifies:
| Field | Description |
|---|---|
match_hosts | Hosts to intercept (supports globs like *.github.com) |
match_paths | Paths to match (empty = all paths) |
headers | Headers to inject, each with a name, type, and value |
no_proxy | Hosts to bypass the proxy entirely (e.g. localhost) |
Header types
Each header has atype that controls how its value is stored and displayed:
| Type | Description |
|---|---|
workspace_secret | References a workspace secret using {KEY} syntax. Resolved when the proxy configuration is applied. |
plaintext | Value is stored and returned as-is. Use for non-sensitive headers. |
opaque | Write-only. Value is encrypted at rest and never returned via the API. |
Single API example
Create a sandbox that automatically injects an OpenAI API key into outbound requests: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:
| Host | Header |
|---|---|
api.github.com | Authorization: Bearer <github-token> for gh and REST API calls |
github.com, *.github.com | Authorization: Basic <base64("x-access-token:<github-token>")> for Git over HTTPS operations like clone, fetch, and push |
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.
Inside the sandbox, set a non-secret placeholder token when a CLI requires a local credential before it sends a request:
gh CLI’s local check. The proxy injects the real 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:
| Field | Description |
|---|---|
match_hosts | Hosts to intercept (same syntax as rules; supports globs like *.github.com). |
url | Your callback endpoint. Must be an http:// or https:// URL reachable from the proxy. |
request_headers | Headers attached to the proxy → callback request, e.g., an HMAC or shared secret your endpoint uses to verify the request. Only plaintext and opaque types are permitted (no workspace_secret). |
ttl_seconds | How long resolved headers are cached before re-invoking the callback. Must be between 60 and 3600. |
rules matches the host, the callback is skipped for that host. Within rules, first-match-wins; the same applies between callbacks if multiple match.
Callback contract
The proxy makes the following request whenever it needs to resolve credentials for a matched host on a cache miss: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).
Example
Use a callback when your OAuth tokens are minted on demand by your own service:Configure via SDK
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

