Skip to main content

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

db_optimiser_agent-0.1.1.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

db_optimiser_agent-0.1.1-py3-none-any.whl (44.2 kB view details)

Uploaded Python 3

File details

Details for the file db_optimiser_agent-0.1.1.tar.gz.

File metadata

  • Download URL: db_optimiser_agent-0.1.1.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for db_optimiser_agent-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4bb7091e00953f4913b99363b53839099617a416b0ea5618a2d5b5e8ca9eb8c4
MD5 ebae9e47b8362a09f8997bbc5cfa1d0e
BLAKE2b-256 baf23bbc05f71ebe5a53ec8c23c35cdc77a6de9931dfa3fd82e9cab8aff369c0

See more details on using hashes here.

File details

Details for the file db_optimiser_agent-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for db_optimiser_agent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e63f8ea7df49025912eb809a03d72922b456d89423e024f5935ad099ec6590e
MD5 2963f14957fe1e6ae8a1f9c44b2f6709
BLAKE2b-256 815e32b1f31724913ade99b2782f30e41f98745e8f2e5d90b7d6d883fd6f4209

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page