Skip to main content

Service-first database intelligence platform for safe inspection and agent-ready exports

Project description

sqldbagent

CI Docs Python 3.13 PDM License: MIT

Safe database intelligence for agents, operators, and automation.

sqldbagent is a service-first platform for understanding relational databases through normalized metadata, durable artifacts, guarded querying, and agent-ready surfaces. It starts with Postgres and MSSQL, uses SQLite as a lightweight smoke/E2E target, and keeps the shared service layer authoritative across every interface.

Why This Exists

Most database tooling gives you one of two extremes:

  • a thin SQL shell with no meaningful safety boundary
  • a one-off schema export with no reusable runtime context

sqldbagent is trying to sit in the middle:

  • inspect and normalize database structure once
  • store snapshots, profiles, docs, diagrams, prompts, and retrieval indexes durably
  • let CLI workflows, dashboards, MCP tools, and LangGraph agents reuse that context
  • keep all agent-facing SQL behind an explicit read-only safety layer

Core Shape

The architecture rule is:

Normalized Metadata Core In The Middle, Dialect Enrichers On The Edges

That means:

  • shared models for databases, schemas, tables, views, columns, relationships, profiles, and snapshots
  • Postgres and MSSQL adapters for dialect-specific introspection and execution details
  • thin surfaces on top: CLI, dashboard, MCP, LangChain, and LangGraph

Current Capabilities

  • datasource config and engine factories through Pydantic Settings and .env
  • normalized inspection of servers, schemas, tables, and views
  • profiling with row counts, distinct/null stats, samples, storage hints, and entity heuristics
  • guarded sync and async SQL execution
  • snapshot persistence with per-datasource and per-schema storage
  • snapshot diffing, docs export, Mermaid ER export, and prompt export
  • Qdrant-backed retrieval over stored snapshot documents
  • LangChain tools and LangGraph agent builders with middleware, checkpointing, and optional LangSmith tracing
  • FastMCP server surface
  • Streamlit dashboard chat surface over the same persisted agent stack

Install

With PDM:

pdm install -G :all

With pip:

pip install "sqldbagent[cli,postgres,langchain,langgraph,mcp,dashboard,docs,test]"

Local Demo

Bring up the local integration stack and migrate the demo database:

make up
make demo-migrate

Run the common workflow:

pdm run sqldbagent inspect tables postgres_demo --schema public
pdm run sqldbagent snapshot create postgres_demo public
pdm run sqldbagent prompt export postgres_demo public
make dashboard-demo

Agent Stack

sqldbagent uses LangChain v1's create_agent(...) surface on top of LangGraph runtime primitives.

  • state is seeded from stored snapshots
  • middleware owns prompt injection, tool handling, summarization, HITL, and limits
  • Postgres checkpointing is the durable thread path
  • the dashboard uses a session-scoped memory saver when Postgres checkpointing is not enabled
  • LangSmith tracing is optional and .env-driven

langgraph.json points at the local project root and .env, so langgraph dev uses the same package and tracing configuration as the rest of the repo.

Documentation

Public docs live in docs/source, internal repo memory lives in docs/_internal, and the main contributor rules live in AGENTS.md.

Useful entrypoints:

Build docs locally:

make docs
make docs-live

Development

trunk check --fix
make test
make test-integration
make test-e2e

Publishing

make build
make publish-check
make publish-testpypi
make publish-pypi

The repo also includes GitHub Actions workflows for CI, docs builds, and trusted-publisher PyPI releases on version tags.

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

sqldbagent-0.1.0.tar.gz (91.5 kB view details)

Uploaded Source

Built Distribution

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

sqldbagent-0.1.0-py3-none-any.whl (99.2 kB view details)

Uploaded Python 3

File details

Details for the file sqldbagent-0.1.0.tar.gz.

File metadata

  • Download URL: sqldbagent-0.1.0.tar.gz
  • Upload date:
  • Size: 91.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sqldbagent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c2c0d6cb4f70de67ae8c5461fb9bf7664dee871c9ebfc56e5c42f7ede07adea
MD5 837b1194cd4d4913c341e481eec9de32
BLAKE2b-256 920d169ad41c2d268d0eacf57a6b0c041f732ab54007bec02eb91e34cb4282d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqldbagent-0.1.0.tar.gz:

Publisher: publish.yml on pr1m8/sqldbagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqldbagent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqldbagent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 99.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sqldbagent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b17e0426682a521ed457c40e3838e95fcd39f88d2729f487750557810fdd8eee
MD5 d9b05979a54b058bc4840d6cae7ec8ce
BLAKE2b-256 641a9caadb1f2c4b8deb90fa3f5d34c6a2ceb6440c58247809aa17497ac8c20a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqldbagent-0.1.0-py3-none-any.whl:

Publisher: publish.yml on pr1m8/sqldbagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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