Skip to main content

🐛 DebugAI

PyPI version Python 3.9+ License: MIT CI

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.

Metadata

Release files for debuai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for debuai 0.1.1
File Size Uploaded
debuai-0.1.1.tar.gz 19.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for debuai 0.1.1
File Interpreter ABI Platform
debuai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 38.7 kB

Release files / debuai-0.1.1.tar.gz

Download URL debuai-0.1.1.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
68dd0b3767e2279842820d9e08c78365522a3b44d5c8307e11488c3eef704296
BLAKE2b-256 checksum
How to use checksums
aa66f59d983295769c2ffd84c5d8458224968baa6c6ddc31edfe09d19888eb9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / debuai-0.1.1-py3-none-any.whl

Download URL debuai-0.1.1-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b91913186fbfc37bad182187162a8fea666124b57d2fddd84b1bdc04ba944d2
BLAKE2b-256 checksum
How to use checksums
05d8b721bf91e68b3743220b5f9f2231fc4581c24e7fe49d6c87ae6c93e76375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page