requirements.txt를 사용하여 배포용 애플리케이션을 설정하는 기본 단계를 설명합니다.
이 예제는 LangGraph 프레임워크를 사용하는 이 저장소를 기반으로 합니다.
최종 저장소 구조는 다음과 같습니다:
LangSmith Deployment supports deploying a LangGraph graph. However, the implementation of a node of a graph can contain arbitrary Python code. This means any framework can be implemented within a node and deployed on LangSmith Deployment. This lets you keep your core application logic outside LangGraph while still using LangSmith for deployment, scaling, and observability.
pyproject.toml: 의존성 관리를 위해 poetry 사용을 선호하는 경우, LangSmith에서pyproject.toml을 사용하는 방법에 대한 가이드를 참조하세요.- 모노레포: 모노레포 내부에 위치한 그래프를 배포하고자 하는 경우, 이 저장소에서 예제를 확인하세요.
의존성 지정
의존성은 다음 파일 중 하나에서 선택적으로 지정할 수 있습니다:pyproject.toml, setup.py, 또는 requirements.txt. 이 파일들 중 어느 것도 생성하지 않은 경우, 구성 파일에서 나중에 의존성을 지정할 수 있습니다.
아래 의존성들은 이미지에 포함되며, 호환되는 버전 범위로 코드에서 사용할 수 있습니다:
requirements.txt 파일 예제:
환경 변수 지정
환경 변수는 파일(예:.env)에서 선택적으로 지정할 수 있습니다. 배포를 위한 추가 변수를 구성하려면 환경 변수 참조를 참조하세요.
.env 파일 예제:
By default, LangSmith follows the
uv/pip behavior of not installing prerelease versions unless explicitly allowed. If want to use prereleases, you have the following options:- With
pyproject.toml: addallow-prereleases = trueto your[tool.uv]section. - With
requirements.txtorsetup.py: you must explicitly specify every prerelease dependency, including transitive ones. For example, if you declarea==0.0.1a1andadepends onb==0.0.1a1, then you must also explicitly includeb==0.0.1a1in your dependencies.
그래프 정의
그래프를 구현합니다. 그래프는 단일 파일 또는 여러 파일에 정의할 수 있습니다. 애플리케이션에 포함될 각 CompiledStateGraph의 변수 이름을 기록해 두세요. 이 변수 이름들은 나중에 LangGraph 구성 파일을 생성할 때 사용됩니다.agent.py 파일 예제입니다. 여기서는 정의한 다른 모듈에서 가져오는 방법을 보여줍니다 (모듈 코드는 여기에 표시되지 않으며, 구현을 보려면 이 저장소를 참조하세요):
구성 파일 생성
langgraph.json이라는 구성 파일을 생성합니다. 구성 파일의 JSON 객체에 있는 각 키에 대한 자세한 설명은 구성 파일 참조를 참조하세요.
langgraph.json 파일 예제:
CompiledGraph의 변수 이름이 최상위 graphs 키의 각 하위 키 값 끝에 나타납니다(즉, :<variable_name>).
구성 파일 위치
구성 파일은 컴파일된 그래프와 관련 의존성을 포함하는 Python 파일과 같은 레벨 또는 더 높은 레벨의 디렉터리에 배치되어야 합니다.
다음 단계
프로젝트를 설정하고 GitHub 저장소에 배치한 후에는 앱을 배포할 차례입니다.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.