Skip to main content

Agent Debugger for LangChain/LangGraph

Project description

adb: Agent Debugger for LangChain/LangGraph

A terminal UI debugger that combines application-level agent inspection (state, memory, tool calls, messages) with Python-level debugging (breakpoints, stepping, variable inspection).

Motivation

An agent developer needs to answer two kinds of questions simultaneously:

  1. Application-level: "How did state or memory change? What tools were called and how?"

  2. Code-level: "Why did this node produce that output? What's in the local variables at line 42? Why did the conditional branch go left?"

When you stop at a breakpoint inside a node, you want to see both the Python locals and the graph-level context (which node, what triggered it, the full agent state).

A combined debugger makes "zoom in / zoom out" seamless

Quick Start

# Install
uv add agent-debugger

# Debug a LangGraph agent script
adb run my_agent.py

# Attach to a specific graph object
adb attach my_module:graph

# Attach with optional renderers/providers
adb attach my_module:graph \
  --store-renderer my_mod:StoreRenderer \
  --state-renderer my_mod:StateRenderer \
  --output-renderer my_mod:ChatOutputRenderer \
  --tool-renderer my_mod:ToolRenderer \
  --state-mutator my_mod:StateMutator

Run from Source

# Create/update local env from this repo
uv sync --dev

# Run adb directly from source (project root)
uv run adb run examples/simple_agent.py

# Equivalent module invocation
uv run python -m agent_debugger.cli run examples/simple_agent.py

Simple Agent Demo

# Run simple_agent with all demo renderer/mutator extensions
uv run adb run examples/simple_agent.py \
  --store-renderer examples.simple_extensions:SimpleStoreRenderer \
  --output-renderer examples.simple_extensions:SimpleChatOutputRenderer \
  --tool-renderer examples.simple_extensions:SimpleToolRenderer \
  --state-mutator examples.simple_extensions:SimpleStateMutator

# Optional: enable LiteLLM tool-calling path in examples/simple_agent.py
# (example model uses Vertex + service account/ADC auth)
USE_LITELLM=1 LITELLM_MODEL=vertex_ai/gemini-2.0-flash uv run adb run examples/simple_agent.py \
  --store-renderer examples.simple_extensions:SimpleStoreRenderer \
  --output-renderer examples.simple_extensions:SimpleChatOutputRenderer \
  --tool-renderer examples.simple_extensions:SimpleToolRenderer \
  --state-mutator examples.simple_extensions:SimpleStateMutator

Features

  • Application-level debugging: See agent state, messages, tool calls, state diffs
  • Code-level debugging: Set breakpoints, step through code, inspect variables
  • Agent-level breakpoints: Break on node start, tool call, or state change
  • Optional renderers/providers: Custom state, store, tools, chat output, and state mutation hooks
  • Persistent tool history: Tool calls are kept across turns in the Tools pane and grouped by turn
  • import agent_debugger as adb; adb.set_trace(): Drop into the debugger from anywhere in your agent code

Usage

# Set a breakpoint on a node
/break node agent

# Set a breakpoint on a tool
/break tool search_listings

# Break when a state key changes
/break state messages

# Standard Python breakpoint
/break line my_agent.py:42

# Clear local UI context
/clear

# Local clear + optional mutator mutation
/clear memory

See /help in the TUI for all commands.

Programmatic Breakpoints

You can drop into the adb debugger from anywhere in your agent code using Python's built-in breakpoint():

PYTHONBREAKPOINT="adb.set_trace" adb run my_agent.py

Then add breakpoint() calls in your code:

def my_node(state: dict) -> dict:
    messages = state.get("messages", [])
    breakpoint()  # execution pauses here in the adb UI
    return {"messages": [...]}

Or call adb.set_trace() directly:

def my_node(state: dict) -> dict:
    import agent_debugger as adb; adb.set_trace()
    return {"messages": [...]}

Debug Keys

When at a breakpoint, use pudb-style keys:

Key Action
c Continue execution
n Step over (next line)
s Step into
r Step out (return / finish)

Implementation note: When a breakpoint hits, the Input widget is disabled (inp.disabled = True). This prevents it from consuming keystrokes, so c/n/s/r go to the App's BINDINGS instead. When the user presses c (continue), the Input is re-enabled and re-focused.

Design

See Design.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_debugger-0.1.4.tar.gz (262.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_debugger-0.1.4-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file agent_debugger-0.1.4.tar.gz.

File metadata

  • Download URL: agent_debugger-0.1.4.tar.gz
  • Upload date:
  • Size: 262.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agent_debugger-0.1.4.tar.gz
Algorithm Hash digest
SHA256 38a9e711ecdc864c9fb76ba53bf804376c53392db6b074186bd296df6892a246
MD5 ee229ad2113d924be154eac091709184
BLAKE2b-256 9586b4672b0c493736d2ec811eb78701b0291d6de2f143979a8b72d94de4ed25

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_debugger-0.1.4.tar.gz:

Publisher: release.yml on dkondo/agent-tackle-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_debugger-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: agent_debugger-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agent_debugger-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e71ea811a060fd8def7162573d4cdfa8a51899fbff5b555e07eacdf2bf8fe92a
MD5 943f3c834d6fff02ae7ba46545c76887
BLAKE2b-256 dc64e4c2372e53594b3ee4a3e05e6b85618b9f5a74afae1ff61783aa25212b61

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_debugger-0.1.4-py3-none-any.whl:

Publisher: release.yml on dkondo/agent-tackle-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page