배포

배포 (Deployment)

LangGraph 에이전트를 LangSmith Cloud 또는 JavaScript 프레임워크·호스팅 플랫폼으로 프로덕션에 배포해요.

LangGraph 에이전트를 프로덕션에 배포할 준비가 되면, 본인 스택에 맞는 호스팅 모델을 선택하면 됩니다. LangSmith Cloud 는 상태를 유지하고 오래 실행되는 에이전트(stateful, long-running agents)를 위해 완전히 관리되는 인프라를 제공하며, 영속 상태(persistent state)와 백그라운드 실행을 지원합니다.

출처: 문서

본문

LangSmith는 Cloud 외에도 [hybrid](/langsmith/hybrid), [standalone servers](/langsmith/deploy-standalone-server), [control plane을 이용한 셀프 호스팅](/langsmith/deploy-with-control-plane) 등 여러 배포 옵션을 제공해요. 자세한 내용은 [LangSmith Deployment 개요](/langsmith/deployment)를 참고하세요.

LangSmith Cloud

이 섹션에서는 GitHub 저장소에서 에이전트를 LangSmith Cloud로 배포하는 과정을 살펴봐요. LangSmith가 인프라, 확장, 운영 관련 문제를 처리해 줍니다.

사전 준비 (Prerequisites)

시작하기 전에 다음이 준비되어 있어야 해요:

에이전트 배포하기 (Deploy your agent)

1. GitHub에 저장소 만들기

서비스를 LangSmith에 배포하려면 애플리케이션 코드가 GitHub 저장소에 있어야 해요. 공개 저장소와 비공개 저장소 모두 지원됩니다. 이 빠른 시작을 위해 먼저 로컬 서버 설정 가이드를 따라 앱이 LangGraph 호환인지 확인한 뒤, 코드를 저장소에 push하세요.

2. LangSmith에 배포하기
  1. LangSmith Deployment로 이동하기LangSmith에 로그인하고 왼쪽 사이드바에서 Deployments를 선택하세요.
  2. 새 배포 만들기+ New Deployment 버튼을 클릭하면 필수 필드를 채울 수 있는 패널이 열립니다.
  3. 저장소 연결하기 — 처음 사용하거나 이전에 연결하지 않은 비공개 저장소를 추가하는 경우 Add new account 버튼을 클릭하고 안내에 따라 GitHub 계정을 연결하세요.
  4. 저장소 배포하기 — 애플리케이션의 저장소를 선택하고 Submit을 클릭해 배포하세요. 완료까지 약 15분이 걸릴 수 있으며, Deployment details 화면에서 상태를 확인할 수 있어요.
3. Studio에서 애플리케이션 테스트하기

애플리케이션이 배포되면:

  1. 방금 만든 배포를 선택해 상세 정보를 확인합니다.
  2. 오른쪽 위의 Studio 버튼을 클릭하면 Studio가 열리면서 그래프가 표시됩니다.
4. 배포의 API URL 가져오기
  1. LangGraph의 Deployment details 화면에서 API URL을 클릭해 클립보드에 복사합니다.
  2. URL을 클릭해 클립보드에 복사합니다.
5. API 테스트하기

이제 API를 테스트할 수 있어요.

Python으로:

pip install langgraph-sdk

에이전트에 메시지를 보내보세요:

from langgraph_sdk import get_sync_client # or get_client for async

client = get_sync_client(url="your-deployment-url", api_key="your-langsmith-api-key")

for chunk in client.runs.stream(
    None,    # Threadless run
    "agent", # Name of agent. Defined in langgraph.json.
    input={
        "messages": [{
            "role": "human",
            "content": "What is LangGraph?",
        }],
    },
    stream_mode="updates",
):
    print(f"Receiving new event of type: {chunk.event}...")
    print(chunk.data)
    print("\n\n")

REST API로:

curl -s --request POST \
    --url <DEPLOYMENT_URL>/runs/stream \
    --header 'Content-Type: application/json' \
    --header "X-Api-Key: <YOUR_API_KEY>" \
    --data "{
        \"assistant_id\": \"agent\", # Name of agent. Defined in langgraph.json.
        \"input\": {
            \"messages\": [
                {
                    \"role\": \"human\",
                    \"content\": \"What is LangGraph?\"
                }
            ]
        },
        \"stream_mode\": \"updates\"
    }"

더 알아보기 (Learn more)