[LangGraph](https://www.langchain.com/langgraph) is a framework for building controllable agentic workflows. You may [self-host](https://langchain-ai.github.io/langgraph/concepts/deployment_options/#self-hosted-lite) or deploy to the cloud.
[LangGraph Studio](https://github.com/langchain-ai/langgraph-studio) is an agent IDE that enables visualization, interaction, and debugging of complex agentic applications.
## Install
Install LangGraph with [[Poetry]].
```sh
poetry add langgraph
```
Install LangGraph Studio.
```sh
poetry add --group dev "langgraph-cli[inmem]"
```
## Run
```sh
poetry run langgraph dev
```
## Concepts
- Control flow
- Fixed - User-defined chain
- Agent - LLM-defined chain
- **Runnable** protocol
- invoke
- **State** is a dictionary.
- **Nodes** are functions.
## LangGraph Studio via Docker
> [!error] Deprecated
> LangGraph Studio now runs on the web instead of [[Docker]]. It creates a tunnel to your locally hosted graph.
### Docker up
A LangGraph project can be started from the command line.
```sh
langgraph up
```
This spins up a [[Docker]] container. You can configure custom dependencies and commands. For example:
```json
{
"dockerfile_lines": [
"RUN mkdir -p /input/upload",
"COPY ./input/upload/ /input/upload/"
],
"dependencies": ["./src/sales_ai_graph_pipeline"],
"graphs": {
"pipeline_agent": "./src/sales_ai_graph_pipeline/agents.py:graph"
},
"env": ".env",
"python_version": "3.12"
}
```
Read more:
- [LangGraph Docker code | GitHub](https://github.com/langchain-ai/langgraph/blob/916affa1b50fddbd6c373c3198409e46cf2d7a74/libs/cli/langgraph_cli/config.py#L214-L286)
- [How to customize Dockerfile | github.io](https://langchain-ai.github.io/langgraph/cloud/deployment/custom_docker/)
### Dockerfile
You can also generate the Dockerfile locally.
```sh
langgraph dockerfile output/Dockerfile
```
Where `output/Dockerfile` is the file path to save the Dockerfile.
### Parsing errors
> [!danger] ValueError
> Error: ValueError('An output parsing error occurred. In order to pass this error back to the agent and have it try again, pass `handle_parsing_errors=True` to the AgentExecutor. This is the error: Could not parse tool input: {\'arguments\': \'query: "len(df)"\', \'name\': \'python_repl_ast\'} because the `arguments` is not valid JSON.\nFor troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE')
If you see an error similar to the one above, try passing `handle_parsing_errors=True` to the `AgentExecutor`.
## Resources
- [[Intro to LangGraph]]
- [LangGraph explained in simple terms | Medium](https://cobusgreyling.medium.com/langgraph-from-langchain-explained-in-simple-terms-f7cd0c12cdbf), e.g., agents and their "disposable chains"
- [LangGraph Cloud Quick Start | GitHub](https://langchain-ai.github.io/langgraph/cloud/quick_start/)