Debugging systematically exposes how an agent moves between the language model, tools, and shared state. In a LangGraph travel assistant, it turns an opaque request into inspectable execution steps. section 11.6 section 11.6.1
Trace the request through the agent in a repeatable sequence:
- Open the implementation in VS Code, launch debug mode, and place breakpoints in search_travel_info(), ToolsExecutionNode.__call__(), and llm_node(). section 11.6.1
- Inspect state["messages"] when llm_node() runs, then examine the response_message for generated tool calls and rewritten search queries. section 11.6.1
- Follow the conditional route into ToolsExecutionNode.__call__(), inspect each tool name and argument, and step through result = tool.invoke(tool_args). section 11.6.1
- Confirm that semantic-search results become ToolMessage entries, return to llm_node(), and inspect the final response and accumulated message state. section 11.6.1
Tracing a Cornwall travel request
For “Suggest three towns with a nice beach in Cornwall,” the LLM produces three search_travel_info tool calls. The tool node executes them, adds three ToolMessage results, and the LLM returns Newquay, St Ives, and Falmouth. The message list reveals each transition.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
Use the VS Code debugpy launch configuration to run the current Python file under the debugger. section 11.1.1















