Step-thru Debugging your LangGraphs
Most of the details required are already covered in langgraph tutorial here: https://langchain-ai.github.io/langgraph/tutorials/langgraph-platform/local-server/
Key points covered there are:
- Install LangGraph CLI
pip install --upgrade "langgraph-cli[inmem]" - Install the dependencies
pip install -e . - Use the CLI to run langGraph server
langgraph dev - You may now use LangGraph Studio Web UI at: https://smith.langchain.com/studio/?baseUrl=http://locahost:2024
Here are the additions to enable step-thru-debugging:
- Install debugpy in your virtual environment for the langgraph project
pip install debugpy - Start langgraph API server in debug mode. In the following we are telling langgraph-cli to allow clients to listen on Port 2025 for debugger events
langgraph dev --debug-port 2025 - Attach to debugger from your IDE. E.g., in here’s my VS Code launch config:
{ "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Remote Attach", "type": "debugpy", "request": "attach", "connect": { "host": "localhost", "port": 2025 }, "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "." } ], "justMyCode": false } ] } - I can now put a breakpoint on any of my langgraph code files and step-thru the execution!