Metadata-Version: 2.4
Name: db-optimiser-agent
Version: 0.1.0
Summary: AI-powered database performance optimisation agent
Author-email: Harikumar Mindi <harikumar.mindi@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/stonewallmhk/db-optimiser
Project-URL: Bug Tracker, https://github.com/stonewallmhk/db-optimiser/issues
Keywords: database,performance,optimisation,AI,agent,postgresql,mysql
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Environment :: Console
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: anthropic>=0.25.0
Requires-Dist: google-genai>=1.0.0
Requires-Dist: psycopg2-binary>=2.9.9
Requires-Dist: mysql-connector-python>=8.3.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: rich>=13.7.0
Requires-Dist: typer>=0.12.0
Requires-Dist: pydantic>=2.6.0
Provides-Extra: web
Requires-Dist: streamlit>=1.35.0; extra == "web"
Provides-Extra: dev
Requires-Dist: pytest>=8.1.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.9.0; extra == "dev"

# db-optimiser-agent

An AI-powered database performance agent. Connect it to a PostgreSQL or MySQL database and it analyses schemas, slow queries, and index health — then delivers ranked, actionable recommendations with copy-paste SQL to fix them.

## Quick start

```bash
# 1. Clone and enter the project
git clone <your-repo>
cd db-optimiser-agent

# 2. Create a virtual environment
python3.11 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate

# 3. Install the package in editable mode
pip install -e ".[dev]"

# 4. Set up your environment
cp .env.example .env
# Edit .env with your Anthropic API key and database credentials

# 5. Run your first analysis
db-optimiser analyse
```

## Project structure

```
db-optimiser-agent/
├── src/db_optimiser_agent/
│   ├── prompts/          # System prompt (the agent's brain)
│   ├── adapters/         # PostgreSQL + MySQL connection adapters  [Phase 1 Step 3]
│   ├── tools/            # Schema analyser, slow query finder, etc [Phase 2]
│   ├── config.py         # Environment-based configuration
│   └── cli.py            # Typer CLI entry point                   [Phase 1 Step 2]
├── tests/
├── scripts/              # Docker, seed scripts
├── .env.example
└── pyproject.toml
```

## Environment variables

| Variable | Required | Default | Description |
|---|---|---|---|
| `ANTHROPIC_API_KEY` | Yes | — | Your Anthropic API key |
| `DB_TYPE` | No | `postgresql` | `postgresql` or `mysql` |
| `DB_HOST` | No | `localhost` | Database host |
| `DB_PORT` | No | `5432` | Database port |
| `DB_NAME` | Yes | — | Database name |
| `DB_USER` | Yes | — | Database user |
| `DB_PASSWORD` | Yes | — | Database password |
| `DB_SCHEMA` | No | `public` | PostgreSQL schema |

## Development

```bash
# Run tests
pytest

# Lint
ruff check src/

# Type check
mypy src/
```
