AI·News
뒤로

Auth Proxy가 LangSmith 에이전트 샌드박스를 보호하는 방법

How Auth Proxy secures LangSmith agent sandboxes

대규모 엔터프라이즈에서 일해본 적이 있다면, 표준적인 기업 노트북 설정을 본 적이 있을 것입니다.

엔드포인트 보호, 브라우저 필터링, 장치 관리, 네트워크 제어, 인증서 저장소, 비밀 스캐너 등이 있습니다. 이들의 역할은 신뢰할 수 있는 직원이 실수로 자격증명을 유출하거나, 악성 패키지를 설치하거나, 잘못된 페이지를 방문하는 것을 방지하는 것입니다.

이러한 도구가 존재하는 이유는 개발자가 광범위한 액세스 권한을 가지고 있기 때문입니다. 개발자는 코드를 실행하고, 의존성을 설치하며, 시스템 간에 데이터를 복사합니다. 내부 및 외부 서비스에 인증합니다. 많은 엔터프라이즈 보안은 이러한 강력하고 개방적인 환경을 더 안전하게 만드는 것을 중심으로 구축되어 있습니다.

에이전트는 이 문제의 규모와 형태를 변경합니다. 단 하나의 개발자에게 노트북을 제공하는 것이 아닙니다. 수천 개 또는 결국 수백만 개의 "신뢰할 수 없는 개발자"를 생성할 수 있으며, 이들은 귀하를 대신하여 코드를 작성하고, 명령을 실행하고, 패키지를 설치하고, 네트워크 요청을 만들 수 있습니다.

인간 개발자의 경우, 환경은 종종 기본적으로 열려 있어야 합니다. 개발자는 탐색하고, 디버깅하고, 도구를 설치하고, 작업이 변함에 따라 새로운 서비스에 도달해야 합니다. 에이전트의 경우, 기본값이 다를 수 있습니다. 작업이 알려져 있다면, 네트워크를 더 좁힐 수 있습니다. 에이전트가 GitHub와 LLM 제공자만 필요로 한다면, 인터넷의 모든 임의의 호스트와 통신할 수 없어야 합니다. 자격증명이 필요하다면, 그 자격증명이 런타임 내부에 존재할 필요가 없습니다.

이것이 샌드박스 네트워킹이 에이전트 하네스의 일등급 부분이 되는 곳입니다.

샌드박스 인증 프록시 소개

LangSmith 샌드박스는 에이전트가 주 인프라에 영향을 주지 않고 코드를 실행하고 파일 시스템과 상호작용할 수 있는 격리된 환경을 제공합니다. 하지만 격리는 이야기의 일부일 뿐입니다. 에이전트는 여전히 모델 제공자, GitHub, 패키지 레지스트리, 내부 서비스, 데이터 API 등과 같은 외부 API를 호출해야 합니다.

샌드박스 인증 프록시는 에이전트 생성 동작과 나머지 세계 간의 경계를 제어하는 방법입니다.

API 키를 환경 변수나 파일로 샌드박스에 넣는 대신, 프록시는 아웃바운드 네트워크 경로에 위치하며 샌드박스된 코드가 외부 서비스와 상호작용하는 방식을 제어합니다. 어떤 대상이 허용되는지, 어떤 인증이 적용되는지, 샌드박스를 떠나기 전에 요청이 어떻게 형성되는지에 대한 정책을 적용할 수 있습니다. 샌드박스 코드는 외부 API에 정상적인 요청을 보내고, 자격증명과 액세스 규칙은 샌드박스 외부의 네트워크 계층에서 처리됩니다.

이 모델을 사용하면 세 가지가 훨씬 더 쉬워집니다:

  1. 자격증명이 런타임 외부에 유지됩니다. 에이전트는 API 키를 읽을 수 없으면서 API를 사용할 수 있으므로, 프롬프트 주입, 악성 의존성, 실수로 인한 로깅 및 모델 실수로 인한 손상을 줄입니다.
  2. 네트워크 액세스가 명시적이 됩니다. 에이전트가 OpenAI, Anthropic, GitHub 또는 내부 API하고만 통신해야 한다면, 이는 에이전트의 판단에 맡기기보다는 인프라 정책으로 인코딩되어야 합니다.
  3. 팀은 더 깔끔한 관심사의 분리를 얻습니다. 에이전트는 작업에 집중하고, 샌드박스는 격리를 제공하며, 프록시는 네트워크 인증 및 자격증명 주입을 처리하고, 애플리케이션 또는 인증 서비스는 사용자 범위 액세스 및 토큰 새로고침을 처리합니다.

이 분리는 에이전트가 신뢰할 수 없고 미리 모든 분기를 검토할 수 없기 때문에 중요합니다. 더 안전한 패턴은 인프라에 의해 가능한 동작이 제한되는 제한된 환경을 제공하는 것이므로, 인증 프록시는 자격증명을 샌드박스 밖에 완전히 유지합니다.

작동 방식

높은 수준에서, 인증 프록시는 샌드박스 송신에 대한 제어된 중간자이며, 다음과 같이 보입니다:

  1. 에이전트 또는 샌드박스된 코드가 아웃바운드 요청을 만듭니다.
  2. 요청이 인증 프록시를 통과합니다.
  3. 인증 프록시가 해당 대상에 대한 구성된 정책을 확인합니다.
  4. 프록시는 요청을 차단하거나, 허용하거나, 헤더를 첨부할 수 있습니다.
  5. 요청이 런타임에 자격증명을 노출하지 않고 대상으로 계속됩니다.

간단한 규칙은 다음을 말할 수 있습니다. 샌드박스가 api.openai.com을 호출할 때, Authorization 헤더를 주입하며, 그 값은 LangSmith 워크스페이스 비밀에서 옵니다. 다른 규칙은 다음을 말할 수 있습니다. 샌드박스가 /repos/* 또는 /user에서 api.github.com을 호출할 때, GitHub 토큰을 주입합니다.

우리가 샌드박스의 네트워크를 제어하기 때문에, 이는 완전히 투명합니다. 이는 모든 언어, 패키지 관리자, SDK 또는 부프로세스가 HTTP_PROXY를 존중하기를 희망하여 구현되지 않습니다. 모든 런타임이 동일하게 작동하지 않으며, 에이전트는 종종 작성하지 않은 임의의 코드 경로를 실행합니다.

자격증명을 에이전트에 전달하지 않고 인증하기

프록시는 많은 다양한 정책 구성을 지원합니다. 하나의 강력한 것은 특정 특성과 일치하는 요청에 헤더를 주입하는 능력입니다.

헤더는 다양한 유형으로 구성할 수 있습니다:

  • workspace_secret: LangSmith 워크스페이스 설정에 저장된 비밀을 참조합니다
  • plaintext: 민감하지 않은 헤더의 경우 그대로 저장되고 반환됩니다
  • opaque: 쓰기 전용, 나머지에서 암호화되고, API에 의해 반환되지 않습니다

예를 들어, OpenAI 규칙의 예에서, 우리는 다음을 주입할 수 있습니다:

{
  "name": "Authorization",
  "type": "workspace_secret",
  "value": "Bearer {OPENAI_API_KEY}"
}


샌드박스 코드는 API 키를 알 필요가 없습니다. .env 파일이 필요하지 않습니다. 자신의 파일 시스템에 마운트된 비밀이 필요하지 않습니다. 그냥 API를 호출하면, 프록시는 대상이 구성된 규칙과 일치할 때 올바른 헤더를 추가합니다.

이것은 에이전트 시스템의 더 나은 기본값입니다. 인간 개발자는 새로운 통합을 디버깅하기 위해 자격증명에 직접 액세스해야 할 수 있습니다. 에이전트는 일반적으로 그럴 필요가 없습니다. 에이전트는 자격증명의 효과 — 특정 API를 호출할 수 있는 능력 — 이 필요하지, 자격증명 자체의 소유가 아닙니다.

그 구별은 에이전트 실행 수가 증가함에 따라 더 중요해집니다. 단일 샌드박스를 사용하면 누수된 키는 나쁘지만, 샌드박스의 함대의 경우, 자격증명을 런타임에 직접 넣는 것은 상당한 위험입니다. 모든 도구 호출, 패키지 설치, 로그 라인 및 파일 쓰기는 가능한 자격증명 노출 경로입니다. 헤더 주입은 자격증명을 해당 피해 범위 밖으로 이동합니다.

네트워크 잠금

자격증명은 네트워크 문제의 절반일 뿐입니다. 에이전트도 송신 정책이 필요합니다. 왜냐하면 의존성을 설치하고, 스크립트를 가져오고, API를 호출하고, 신뢰할 수 없는 콘텐츠의 지시사항을 따를 수 있기 때문입니다. 모든 샌드박스가 개방 인터넷 액세스를 가지면, 손상되거나 혼란스러운 에이전트는 그렇지 않아야 할 곳에 도달할 수 있습니다.

헤더를 주입하는 같은 프록시 경계는 또한 팀이 예상되는 대상을 정의하는 곳이 될 수 있습니다:

  • 모델 제공자 API를 허용하고 다른 모든 것을 차단합니다
  • 에이전트가 필요로 하는 GitHub API 경로를 허용하되, 임의의 GitHub 인접 도메인은 허용하지 않습니다
  • 패키지 레지스트리를 허용하지만, 내부 미러만 허용합니다
  • 알려진 악성 또는 신뢰할 수 없는 패키지 레지스트리를 차단합니다
  • 허가되지 않은 제3자 서비스에 대한 실수로인 호출을 방지합니다

이는 패키지 관리에 특히 중요합니다. 코딩 에이전트가 pip install, npm install 또는 curl | bash를 실행할 수 있다면, 코드를 가져오고 실행할 수 있습니다. 보안 질문은 샌드박스가 실행을 포함할 수 있는지뿐만 아니라, 해당 코드가 어디에서 오는지와 데이터를 어디로 보낼 수 있는지를 제어할 수 있는지입니다.

실제 프로덕션 인증을 위한 동적 자격증명

샌드박스를 LangSmith Fleet과 통합하면서, 고급 사용 사례의 경우 정적 구성이 충분하지 않을 수 있다는 것을 깨달았습니다. Fleet 에이전트는 위임된 액세스 및 OAuth 토큰 새로고침이 필요할 수 있으면서 실제 자격증명 처리를 에이전트 런타임 밖에 유지합니다.

고급 사용 사례의 다른 예는 다음을 포함합니다:

  • 단기 OAuth 액세스 토큰
  • 사용자별 범위 토큰
  • 내부 인증 서비스에 의해 발급된 자격증명
  • 대상 또는 현재 사용자 컨텍스트에 따라 새로고침해야 하는 토큰

이러한 경우, 인증 프록시는 콜백을 사용한 동적 자격증명을 지원합니다.

모든 자격증명 자료를 정적 규칙에 넣는 대신, proxy_config 아래에 콜백을 구성합니다. 샌드박스가 일치하는 호스트에 요청을 보내고 프록시가 캐시된 자격증명을 가지지 않은 경우, 프록시는 대상 호스트 및 포트와 함께 콜백 엔드포인트를 호출합니다. 엔드포인트는 주입할 헤더를 반환하고, 프록시는 구성된 TTL에 대한 결과를 캐시합니다.

계약은 간단합니다. 콜백은 다음과 같은 JSON 객체를 반환합니다:

{
  "headers": {
    "Authorization": "Bearer <token>",
    "X-Org-Id": "..."
  }
}

프록시는 해당 헤더를 아웃바운드 요청에 주입합니다. 콜백이 실패하거나, 잘못된 JSON을 반환하거나, 비 2xx 상태로 응답하면, 프록시는 실패합니다. 자격증명 없이 요청을 보내는 대신 샌드박스 요청을 거부합니다. 이것이 샌드박스 네트워크 계층이 새로고침 토큰이나 장기 자격증명을 샌드박스에 노출하지 않고 인증 흐름에 참여할 수 있게 하는 패턴입니다.

다음에 이것이 무엇을 가능하게 하는지

샌드박스 네트워크 경로를 제어하면, 프록시는 자격증명 주입기 이상이 될 수 있으며, 몇 가지 자연스러운 확장이 있습니다.

  1. DNS 재매핑: 팀은 공용 패키지 레지스트리에 대한 요청이 대신 내부 Artifactory 또는 패키지 미러로 해결되기를 원할 수 있습니다. LLM API 요청을 내부 게이트웨이로 가리키고 싶을 수 있습니다. 에이전트는 여전히 정상적인 설치 명령을 실행하지만, 네트워크 계층은 해당 요청을 승인된 인프라로 가리킵니다.
  2. 네트워크 로깅: 에이전트가 장기간에 걸쳐 의미 있는 작업을 하는 경우, 팀은 어떤 서비스를 호출했는지, 어떤 패키지를 가져왔는지, 어떤 도메인에 도달하려고 시도했는지 알고 싶을 것입니다. 네트워크 로그는 에이전트 동작의 감시 추적 일부가 됩니다.
  3. 요청 변환: 프록시가 아웃바운드 요청을 보기 때문에, 개인식별정보 제거, 조직 메타데이터 추가, 요청 형태 적용 또는 정책을 위반하는 페이로드 차단과 같은 결정론적 변환을 적용하는 곳이 될 수 있습니다.

더 광범위한 포인트는 에이전트 인프라가 런타임 밖에 있는 제어 평면이 필요하며, 에이전트 지시사항 및 결정에 노출되지 않는다는 것입니다.

에이전트 송신에 대한 새로운 기본값

에이전트는 유용한 작업을 수행하기 위해 자격증명과 네트워크 액세스가 필요하지만, 이러한 기능은 런타임 내부에 장기 비밀이나 제한 없는 인터넷 액세스를 배치할 필요가 없어야 합니다. 인증 프록시는 자격증명을 환경 외부에 유지하고, 아웃바운드 트래픽을 제어된 계층을 통해 라우팅하고, 언어, SDK, 패키지 관리자 및 CLI에 걸쳐 정책을 일관되게 적용함으로써 샌드박스된 에이전트에 더 안전한 기본값을 제공합니다.

결과는 에이전트에게 필요한 시스템에 대한 액세스를 제공하면서 자격증명과 네트워크 정책을 플랫폼 제어 아래에 유지하는 샌드박스 모델입니다.

LangSmith 샌드박스를 시도해보세요: https://www.langchain.com/langsmith/sandboxes

문서를 읽어보세요: https://docs.langchain.com/langsmith/sandboxes

If you’ve ever worked at a large enterprise, you have probably seen the standard corporate laptop setup.

There’s endpoint protection, browser filtering, device management, network controls, certificate stores, secret scanners… a long list of tools whose job is to stop an otherwise trusted employee from accidentally leaking credentials, installing a malicious package, or visiting the wrong page.

That tooling exists because developers have broad access. They run code, install dependencies, and copy data between systems. They authenticate to internal and external services. A lot of enterprise security is built around making that powerful, open-ended environment safer.

Agents change the scale and shape of this problem. You’re not just giving one developer a laptop. You may be spawning thousands, or eventually millions, of “untrusted developers” that can write code, run commands, install packages, and make network requests on your behalf.

For human developers, the environment often needs to stay open by default. Developers need to explore, debug, install tools, and reach new services as their work changes. For agents, the default can be different. If the task is known, the network can be narrower. If the agent only needs GitHub and an LLM provider, it should not be able to talk to every random host on the internet. If it needs a credential, that credential should not have to exist inside the runtime at all.

This is where sandbox networking becomes a first-class part of the agent harness.

Introducing the sandbox Auth Proxy

LangSmith Sandboxes give agents isolated environments for running code and interacting with filesystems without affecting your main infrastructure. But isolation is only one part of the story. Agents still need to call external APIs like model providers, GitHub, package registries, internal services, data APIs, and more.

The sandbox auth proxy is a way to control the boundary between agent-generated behavior and the rest of the world.

Instead of putting API keys into the sandbox as environment variables or files, the proxy sits on the outbound network path and controls how sandboxed code interacts with external services. It can enforce policy for which destinations are allowed, what authentication is applied, and how requests are shaped before they leave the sandbox. Sandbox code makes a normal request to an external API, while credentials and access rules are handled outside the sandbox at the network layer.

Three things become much easier with this model:

  1. Credentials stay out of the runtime. The agent can use an API without being able to read the API key, which reduces the damage from prompt injection, malicious dependencies, accidental logging, and model mistakes.
  2. Network access becomes explicit. If an agent should only talk to OpenAI, Anthropic, GitHub, or an internal API, that should be encoded as infrastructure policy rather than left to the agent’s judgment.
  3. Teams get a cleaner separation of concerns: the agent focuses on the task, the sandbox provides isolation, the proxy handles network authorization and credential injection, and the application or auth service handles user-scoped access and token refresh.

This separation is important because agents are untrusted and you can’t review every branch they will take ahead of time. The safer pattern is to give them constrained environments where the possible actions are bounded by infrastructure, so the auth proxy keeps credentials out of the sandbox entirely.

How it works

At a high level, the auth proxy is a controlled intermediary for sandbox egress, which looks like this:

  1. The agent or sandboxed code makes an outbound request.
  2. The request passes through Auth Proxy.
  3. Auth Proxy checks the configured policy for that destination.
  4. The proxy can block the request, allow it, or attach headers.
  5. The request continues to the destination without exposing credentials to the runtime.

A simple rule might say: when the sandbox calls api.openai.com, inject an Authorization header whose value comes from a LangSmith workspace secret. Another rule might say: when the sandbox calls api.github.com on /repos/* or /user, inject a GitHub token.

Because we control the network for the sandbox, this is completely transparent. This is not implemented by hoping every language, package manager, SDK, or subprocess respects HTTP_PROXY. Not all runtimes behave the same way, and agents often execute arbitrary code paths you didn’t write.

Authenticate without handing credentials to your agent

The proxy supports many different policy configurations. One powerful one is the ability to inject headers into requests that match certain characteristics.

Headers can be configured with different types:

  • workspace_secret: references a secret stored in LangSmith workspace settings
  • plaintext: stored and returned as-is, for non-sensitive headers
  • opaque: write-only, encrypted at rest, and never returned by the API

For example, in the example of the OpenAI rule, we can inject:

{
  "name": "Authorization",
  "type": "workspace_secret",
  "value": "Bearer {OPENAI_API_KEY}"
}


The sandbox code does not need to know the API key. It does not need an .env file. It does not need a secret mounted into its filesystem. It just calls the API, and the proxy adds the right header when the destination matches the configured rule.

This is a better default for agent systems. A human developer may need direct access to a credential to debug a new integration. An agent usually does not. The agent needs the effect of the credential — the ability to call a specific API — not possession of the credential itself.

That distinction becomes more important as the number of agent runs grows. With a single sandbox, a leaked key is bad, but for a fleet of sandboxes, putting credentials directly into runtimes is a significant risk. Every tool call, package install, log line, and file write is a possible credential exposure path. Header injection moves the credential out of that blast radius.

Locking down the network

Credentials are only half the network problem; agents also need egress policy because they can install dependencies, fetch scripts, call APIs, and follow instructions from untrusted content. If every sandbox has open internet access, a compromised or confused agent can reach places it shouldn’t.

The same proxy boundary that injects headers can also become the place where teams define which destinations are expected, like:

  • allowing the model provider API and blocking everything else
  • allowing GitHub API paths the agent needs, but not arbitrary GitHub-adjacent domains
  • allowing a package registry, but only the internal mirror
  • blocking known malicious or untrusted package registries
  • preventing accidental calls to unauthorized third-party services

This is especially important for package management. If a coding agent can run pip install, npm install, or curl | bash, it can fetch and execute code. The security question is not just whether the sandbox can contain execution, but whether you can control where that code comes from and where it can send data.

Dynamic credentials for real production auth

While integrating sandboxes with LangSmith Fleet, we realized that for advanced use cases, static configuration may not be sufficient. Fleet agents may need delegated access and OAuth token refreshes while still keeping the actual credential handling outside the agent runtime.

Other examples of advanced use cases include:

  • short-lived OAuth access tokens
  • per-user-scoped tokens
  • credentials minted by an internal auth service
  • tokens that need to be refreshed based on the destination or current user context

For these cases, the auth proxy supports dynamic credentials with callbacks.

Instead of putting all credential material into static rules, you configure a callback under proxy_config. When the sandbox makes a request to a matching host and the proxy does not have a cached credential, the proxy calls your callback endpoint with the target host and port. Your endpoint returns the headers to inject, and the proxy caches the result for a configured TTL.

The contract is simple: the callback returns a JSON object like:

{
  "headers": {
    "Authorization": "Bearer <token>",
    "X-Org-Id": "..."
  }
}

The proxy injects those headers into the outbound request. If the callback fails, returns malformed JSON, or responds with a non-2xx status, the proxy fails closed and rejects the sandbox request rather than sending it without credentials. This is the pattern lets the sandbox network layer participate in auth flows without exposing refresh tokens or long-lived credentials to the sandbox.

What this unlocks next

Once you control the sandbox network path, the proxy can become more than a credential injector, and there are a few natural extensions.

  1. DNS remapping: a team may want requests to public package registries to resolve to an internal Artifactory or package mirror instead. You may want to point LLM API requests towards an internal gateway. The agent still runs normal install commands, but the network layer points those requests at approved infrastructure.
  2. Network logging: if agents are doing meaningful work over long horizons, teams will want to know which services they called, which packages they fetched, and which domains they attempted to reach. Network logs become part of the audit trail for agent behavior.
  3. Request transformation: since the proxy sees outbound requests, it can eventually become a place to apply deterministic transformations, such as redacting PII, adding organization metadata, enforcing request shape, or blocking payloads that violate policy.

The broader point is that agent infrastructure needs control planes that live outside the runtime and aren’t exposed to agent instructions and decisions.

The new default for agent egress

Agents need credentials and network access to do useful work, but those capabilities should not require putting long-lived secrets or unrestricted internet access inside the runtime. Auth Proxy gives sandboxed agents a safer default by keeping credentials outside the environment, routing outbound traffic through a controlled layer, and applying policy consistently across languages, SDKs, package managers, and CLIs.

The result is a sandbox model that gives agents access to the systems they need, while keeping credentials and network policy under platform control.

Try LangSmith Sandboxes: https://www.langchain.com/langsmith/sandboxes

Read the docs: https://docs.langchain.com/langsmith/sandboxes

원문 보기 https://www.langchain.com/blog/how-auth-proxy-secures-network-access-for-langsmith-agent-sandboxes