AI-powered CLI tool that turns stack traces into root cause analysis instantly
Project description
๐ DebugAI
AI-powered CLI tool that turns any stack trace into a root cause analysis โ in seconds.
No dashboard. No account. No SDK to integrate. Just pipe in a log and get answers.
cat production.log | debuai --ai
Demo
https://github.com/user-attachments/assets/5771164c-865e-4c95-aff8-3cc7e2dae0f2
Install
pip install debuai
Quickstart
# Analyse a log file
debuai error.log
# Pipe from any source
cat error.log | debuai
kubectl logs my-pod | debuai
docker logs my-container | debuai
# With AI analysis
debuai error.log --ai
# Machine-readable JSON output
debuai error.log --json
debuai error.log --ai --json | jq .
# Choose your AI provider
debuai error.log --ai --provider openai
debuai error.log --ai --provider anthropic
debuai error.log --ai --provider nvidia
# Analyse the last N errors in a log
debuai error.log --top 3
What It Does
Given a stack trace like this:
Traceback (most recent call last):
File "server.py", line 10, in handle_request
result = process_data(payload)
File "processor.py", line 25, in process_data
value = parse_input(raw)
File "parser.py", line 8, in parse_input
return int(raw)
ValueError: invalid literal for int() with base 10: 'abc'
DebugAI gives you this:
๐ฅ Exception Type ValueError
๐ Failure Origin parse_input
๐ Execution Chain handle_request โ process_data โ parse_input
๐ค AI Root Cause The function receives a string that cannot be
converted to int โ 'abc' is passed where a
numeric string is expected.
๐ Suggested Fix Validate input before conversion:
if not raw.isdigit(): raise ValueError(...)
๐ก Prevention Add input validation at the API boundary so
invalid types never reach the parsing layer.
๐ข Confidence: HIGH
Supported Languages
| Language | Detection | Parser |
|---|---|---|
| Python | Traceback (most recent call last) |
โ |
| Java | .java: in frames |
โ |
| Go | goroutine / panic: |
โ |
| C# / .NET | at Namespace.Class.Method() |
โ |
| Node.js | .js: in frames |
โ |
Language is auto-detected โ no --lang flag needed.
AI Providers
DebugAI works with whichever key you already have. Set one environment variable and it just works.
export OPENAI_API_KEY=... # Uses gpt-4o-mini
export ANTHROPIC_API_KEY=... # Uses claude-haiku
export NVIDIA_API_KEY=... # Uses NVIDIA inference
Auto-detection order: OpenAI โ Anthropic โ NVIDIA. Override with --provider.
JSON Output
The --json flag outputs clean, pipeable JSON โ no Rich formatting, no colour codes.
debuai error.log --ai --json
{
"exception": "ValueError",
"failure_origin": "parse_input",
"execution_chain": ["handle_request", "process_data", "parse_input"],
"source_file": "parser.py",
"language": "python",
"ai": {
"root_cause": "...",
"fix": "...",
"prevention": "...",
"confidence": "high"
}
}
Pipe into jq, Slack bots, Jira integrations, or CI pipelines.
CI / CD Integration
Add DebugAI to your GitHub Actions workflow to get AI analysis on every failed build:
- name: Analyse failure
if: failure()
run: |
pip install debuai
cat logs/error.log | debuai --ai --json
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Setup for Development
git clone https://github.com/kanhaiya-bhayana/debugai.git
cd debugai
python -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
pip install -e ".[dev]"
Run tests:
python -m pytest tests/ -v
Set your API key:
export OPENAI_API_KEY=your_key_here
Project Structure
debugai/
โโโ parser/
โ โโโ python.py # Python traceback parser
โ โโโ java.py # Java / Spring parser
โ โโโ go.py # Go panic parser
โ โโโ csharp.py # C# / .NET parser
โ โโโ node.py # Node.js parser
โ โโโ registry.py # Language auto-detection router
โโโ providers/
โ โโโ openai_provider.py
โ โโโ anthropic_provider.py
โ โโโ nvidia.py
โโโ analyzer.py # Core extraction logic
โโโ ai_analyzer.py # Provider selection + AI orchestration
โโโ cli.py # Typer CLI entry point
tests/
โโโ test_parsers.py # 50 parser tests
โโโ test_analyzer.py # 28 analyzer tests
โโโ test_safeguards.py # 13 edge case + safeguard tests
Roadmap
- Python, Java, Go, C#, Node.js parsers
- Multi-provider AI backend (OpenAI, Anthropic, NVIDIA)
- Structured JSON output
- CI/CD pipeline
- PyPI publish
- GitHub issue search โ link traces to known issues automatically
- Kubernetes / Docker log stream support
- VS Code extension
- Web UI for team sharing
Contributing
Contributions are welcome. Please read CONTRIBUTING.md before opening a PR.
# Run the full test suite before submitting
python -m pytest tests/ -v
License
MIT โ see LICENSE for details.
Built with โค๏ธ for developers who are tired of Googling stack traces.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file debuai-0.1.1.tar.gz.
File metadata
- Download URL: debuai-0.1.1.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68dd0b3767e2279842820d9e08c78365522a3b44d5c8307e11488c3eef704296
|
|
| MD5 |
f5c8eea18b4de983b7a21189092897a6
|
|
| BLAKE2b-256 |
aa66f59d983295769c2ffd84c5d8458224968baa6c6ddc31edfe09d19888eb9c
|
File details
Details for the file debuai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: debuai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b91913186fbfc37bad182187162a8fea666124b57d2fddd84b1bdc04ba944d2
|
|
| MD5 |
f0a6800198623b46deb4347bb1106950
|
|
| BLAKE2b-256 |
05d8b721bf91e68b3743220b5f9f2231fc4581c24e7fe49d6c87ae6c93e76375
|