AI-powered database performance optimisation agent
Project description
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
# 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
# Run tests
pytest
# Lint
ruff check src/
# Type check
mypy src/
Project details
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 db_optimiser_agent-0.1.4.tar.gz.
File metadata
- Download URL: db_optimiser_agent-0.1.4.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b457aa9c2aaf22e002fa10a50f4df124b68220d9171f0f97f9959534fd05ba
|
|
| MD5 |
8baadcb4fd5a3184417fa9ec9461f129
|
|
| BLAKE2b-256 |
e222e63ffaa20748de671f6da32760dca4abf97edf74bd45fe6e4b961ae4cd6e
|
Provenance
The following attestation bundles were made for db_optimiser_agent-0.1.4.tar.gz:
Publisher:
publish.yml on stonewallmhk/db-optimiser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
db_optimiser_agent-0.1.4.tar.gz -
Subject digest:
b9b457aa9c2aaf22e002fa10a50f4df124b68220d9171f0f97f9959534fd05ba - Sigstore transparency entry: 1395684853
- Sigstore integration time:
-
Permalink:
stonewallmhk/db-optimiser@778bb78598163c0ff25c5f1f945ca703649e474e -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/stonewallmhk
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@778bb78598163c0ff25c5f1f945ca703649e474e -
Trigger Event:
push
-
Statement type:
File details
Details for the file db_optimiser_agent-0.1.4-py3-none-any.whl.
File metadata
- Download URL: db_optimiser_agent-0.1.4-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f0f153f6f6c944e5c0b17356073caf03e8570a2d06f55246d7b179ef60bfde
|
|
| MD5 |
a11ceead2cf34e664a48aba488548ed2
|
|
| BLAKE2b-256 |
d8ff24b1a688c427cfcfc753af1b82bf8801016f83322339241a22d5ccee189d
|
Provenance
The following attestation bundles were made for db_optimiser_agent-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on stonewallmhk/db-optimiser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
db_optimiser_agent-0.1.4-py3-none-any.whl -
Subject digest:
13f0f153f6f6c944e5c0b17356073caf03e8570a2d06f55246d7b179ef60bfde - Sigstore transparency entry: 1395684872
- Sigstore integration time:
-
Permalink:
stonewallmhk/db-optimiser@778bb78598163c0ff25c5f1f945ca703649e474e -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/stonewallmhk
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@778bb78598163c0ff25c5f1f945ca703649e474e -
Trigger Event:
push
-
Statement type: