liveBook · Manning

Debugging

As explained in AI Agents and Applications

Debugging is the systematic diagnosis and correction of faults in software execution or behavior.

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

How AI Agents and Applications covers it

How deep it goes
Provides a worked debugger procedure across nodes, messages, tool calls, and results, while omitting defensive error handling.
Examples
Traces a Cornwall beach-town request through three rewritten searches, ToolMessage results, and a final assistant response.
What it assumes
Assumes a Python project, configured virtual environment, installed dependencies, API key, and a runnable travel agent.
What you can do after
Diagnose/debug with VS Code breakpoints by inspecting agent state, tool calls, tool results, routing, and final responses.
How it connects
Connects debugging with breakpoints, LangGraph nodes, tool calling, message state, vector stores, and semantic search.

Also explained in

Compare how 16 books explain debugging →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.