minerva is a Python-based CLI tool that uses LangGraph to create a simple workflow for processing JSON errors from Red Hat Ansible Automation Controllers by passing them to an LLM with a systems prompt for diagnosis.
- ✨ LLM-Powered Diagnosis: Uses OpenAI's GPT models to analyze and diagnose Ansible automation errors
- 🔄 LangGraph Workflow: Simple, clear workflow processing with LangGraph
- 📊 Structured Output: Pydantic-based models ensure consistent, validated diagnostic outputs
- 🖥️ CLI Interface: Easy-to-use command-line interface powered by Typer
- 📝 JSON Processing: Processes error events from Red Hat Ansible Automation Controllers
- Python 3.13+
uvpackage manager (recommended) or standard Pythonvenv
-
Clone the repository
git clone https://github.com/example/jaii-langgraph-minerva.git cd jaii-langgraph-minerva -
Create and activate virtual environment
Using
uv(recommended):uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
Or using standard Python:
python3.13 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
uv pip install -e . -
Install development dependencies (optional)
uv pip install -e ".[dev]"
Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"Process a single error event:
uv run minerva diagnose events/1364477456.jsonProcess multiple error events with verbose output:
uv run minerva diagnose events/ --verboseShow version:
uv run minerva versionGet help:
uv run minerva --helpjaii-langgraph-minerva/
├── src/minerva/ # Main package source
│ ├── __init__.py # Package initialization
│ ├── cli.py # CLI interface
│ ├── basemodels.py # Pydantic models (to be created)
│ ├── workflow.py # LangGraph workflow (to be created)
│ └── utils.py # Utility functions (to be created)
├── tests/ # Test suite
├── events/ # Sample error events (gitignored)
├── data/ # Data files (gitignored)
├── spec/ # Requirements and specifications
├── pyproject.toml # Project configuration
├── README.md # This file
└── .gitignore # Git ignore rules
-
Install development dependencies
uv pip install -e ".[dev]" -
Run tests
uv run pytest
-
Code formatting and linting
uv run ruff check . uv run ruff format .
The tool follows a simple architecture:
- Input: JSON error events from Ansible Automation Controllers
- Processing: LangGraph workflow that:
- Loads and validates error events using Pydantic models
- Sends structured prompts to OpenAI's GPT models
- Processes LLM responses into structured diagnostic outputs
- Output: Structured diagnosis with confidence levels
- ErrorTask: Pydantic model for original error events (to be implemented)
- ErrorDiagnosis: Pydantic model for LLM diagnostic outputs (to be implemented)
- LangGraph Workflow: Simple processing pipeline (to be implemented)
- CLI Interface: User-friendly command-line tool ✅
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following the coding standards
- Run tests and ensure they pass
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Python 3.13+ standards
- Use type hints throughout
- Follow the project's Ruff configuration
- Write comprehensive tests with pytest
- Document functions and classes with docstrings
- Keep code modular and well-structured
This project is licensed under the MIT License - see the LICENSE file for details.