Skip to main content
LangGraph는 에이전트 동작과 권한을 동적으로 수정하기 위한 런타임 구성을 허용합니다. LangSmith Deployment를 사용할 때 요청 본문(config) 또는 특정 요청 헤더에서 이 구성을 전달할 수 있습니다. 이를 통해 사용자 신원 또는 기타 요청을 기반으로 조정할 수 있습니다. 프라이버시를 위해 langgraph.json 파일의 http.configurable_headers 섹션을 통해 런타임 구성에 전달되는 헤더를 제어합니다. 포함 및 제외 헤더를 커스터마이징하는 방법은 다음과 같습니다:
{
  "http": {
    "configurable_headers": {
      "include": ["x-user-id", "x-organization-id", "my-prefix-*"],
      "exclude": ["authorization", "x-api-key"]
    }
  }
}
includeexclude 목록은 정확한 헤더 이름 또는 *를 사용하여 임의의 수의 문자와 일치하는 패턴을 허용합니다. 보안을 위해 다른 정규식 패턴은 지원되지 않습니다.

그래프 내에서 사용

노드의 config 인수를 사용하여 그래프에서 포함된 헤더에 액세스할 수 있습니다.
def my_node(state, config):
  organization_id = config["configurable"].get("x-organization-id")
  ...
또는 컨텍스트에서 가져올 수 있습니다(도구 또는 다른 중첩된 함수 내에서 유용).
from langgraph.config import get_config

def search_everything(query: str):
  organization_id = get_config()["configurable"].get("x-organization-id")
  ...
이를 사용하여 그래프를 동적으로 컴파일할 수도 있습니다.
# my_graph.py.
import contextlib

@contextlib.asynccontextmanager
async def generate_agent(config):
  organization_id = config["configurable"].get("x-organization-id")
  if organization_id == "org1":
    graph = ...
    yield graph
  else:
    graph = ...
    yield graph

{
  "graphs": {"agent": "my_grph.py:generate_agent"}
}

구성 가능한 헤더에서 제외

구성 가능한 헤더에서 제외하려면 exclude 목록에 와일드카드 패턴을 설정하면 됩니다:
{
  "http": {
    "configurable_headers": {
      "exclude": ["*"]
    }
  }
}
이렇게 하면 모든 헤더가 실행 구성에 추가되지 않습니다. 제외가 포함보다 우선한다는 점에 유의하세요.
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I