requirements.txt
to specify project dependencies.
This walkthrough is based on this repository, which you can play around with to learn more about how to setup your LangGraph application for deployment.
Setup with pyproject.toml
If you prefer using poetry for dependency management, check out this how-to guide on using
pyproject.toml
for LangGraph Platform.Setup with a Monorepo
If you are interested in deploying a graph located inside a monorepo, take a look at this repository for an example of how to do so.
Specify Dependencies
Dependencies can optionally be specified in one of the following files:pyproject.toml
, setup.py
, or requirements.txt
. If none of these files is created, then dependencies can be specified later in the LangGraph configuration file.
The dependencies below will be included in the image, you can also use them in your code, as long as with a compatible version range:
requirements.txt
file:
Specify Environment Variables
Environment variables can optionally be specified in a file (e.g..env
). See the Environment Variables reference to configure additional variables for a deployment.
Example .env
file:
Define Graphs
Implement your graphs! Graphs can be defined in a single file or multiple files. Make note of the variable names of each CompiledStateGraph to be included in the LangGraph application. The variable names will be used later when creating the LangGraph configuration file. Exampleagent.py
file, which shows how to import from other modules you define (code for the modules is not shown here, please see this repository to see their implementation):
Create LangGraph Configuration File
Create a LangGraph configuration file calledlanggraph.json
. See the LangGraph configuration file reference for detailed explanations of each key in the JSON object of the configuration file.
Example langgraph.json
file:
CompiledGraph
appears at the end of the value of each subkey in the top-level graphs
key (i.e. :<variable_name>
).
Configuration File Location
The LangGraph configuration file must be placed in a directory that is at the same level or higher than the Python files that contain compiled graphs and associated dependencies.