pyproject.toml to define your package’s dependencies.
This example is based on this repository, which uses the LangGraph framework.
The final repository structure will look something like this:
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.
requirements.txt: for dependency management, check out this how-to guide on usingrequirements.txtfor LangSmith.- a monorepo: To deploy 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 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:
pyproject.toml 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:
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.
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 application. The variable names will be used later when creating the 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 the configuration file
Create a configuration file calledlanggraph.json. See the 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 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.
Next
After you setup your project and place it in a GitHub repository, it’s time to deploy your app.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.