The Python Debugger (PDb) augmented with AI.
ai-pdb
is an enhanced version of the Python Debugger (PDb) that integrates AI capabilities to assist with debugging tasks. This tool leverages the power of Claude to provide more insightful debugging information and suggestions.
Use Claude directly from your debugging environment to avoid copying and pasting back and forth.
- AI-assisted debugging prompts
- Enhanced context-aware debugging
- Integration with the Anthropic API for AI responses
Install using pip
:
pip install ai-pdb
You should have ANTHROPIC_API_KEY
available in your ENV to be able to use this tool.
To use ai-pdb
, simply import it in your Python script and start the debugger as you normally would:
from ai_pdb import AIPdb
debugger = AIPdB()
debugger.set_trace()
Once you’re in a debugging session, you can use the ai
command to assist you with debugging.
There are three sub-commands available:
ai
ai debug
This is the default and is equivalent you just invoking ai
from the debugging shell.
This will provide Claude with your current execution context and it will help you understand what’s going on, help you fix errors, etc.
ai docs
This will provide documentation relevant to the execution context.
ai query <custom query>
You can ask Claude anything. Your question is automatically enriched with the execution context, providing all necessary information.