Skip to main content

Single-process SQL + SSH CLI for LLM agents. PostgreSQL/MySQL/SSH via SQLAlchemy + paramiko. Plaintext credentials in one TOML file. Helpers auto-injected into the heredoc namespace.

Project description

sql-harness

A thin, single-process SQL CLI for LLM agents. Mirrors browser-harness's structure but targets relational databases (Postgres, MySQL, Redis-soon).

Connection file format, env vars, and driver list: see install.md.

Quickstart

# 1. Install deps (one-time)
uv sync

# 2. Scaffold a starter connections.toml
uv run sql-harness init

# 3. Add a connection
uv run sql-harness add local_pg --driver postgres --url 'postgresql://postgres:postgres@localhost:5432/postgres'

# 4. Test it
uv run sql-harness test local_pg

# 5. Use it
uv run sql-harness <<'PY'
use_workspace("local_pg")
print(query("SELECT version()"))
print(list_tables())
print(describe("pg_class"))
PY

Architecture (~1k lines across 8 core files)

  • install.md — first-time install + first connection
  • SKILL.md — day-to-day usage
  • lab/sql_harness/src/sql_harness/ — protected core package
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/connections.toml — plaintext credentials in ONE place
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/agent_helpers.py — task-specific helpers
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/zones/<conn>/skills/ — per-DSN skills (one zone per connection)
  • ${XDG_CONFIG_HOME:-~/.config}/sql-harness/agent-workspace/zones/meta/skills/ — cross-DSN strategy skills (passive fallback for apply_skill)

Why mirror browser-harness?

  • Same operational ergonomics for agents: heredoc CLI with auto-imported helpers.
  • Same agent-workspace pattern (helpers + skills stay editable per-project).
  • Same path/state layout (XDG-style state directory).
  • Same doc layering: SKILL.md body + interaction-skills/*.md for stuck points.

What this is NOT

  • Not a database migration framework.
  • Not an ORM.
  • Not a connection-string parser (pgcli/mycli already exist for interactive REPL use; this is for agents).
  • Not a long-running daemon. SQL connections don't need one.

Contributing

PRs and improvements welcome. See AGENTS.md for code priorities.

  • Skills are written by the harness, not by you. When you figure out a non-obvious SQL flow (a weird schema, a slow query, a JSON column trick), file a skill in agent-workspace/zones/<conn>/skills/<name>.md for that DSN, or agent-workspace/zones/meta/skills/<name>.md if it generalizes. Future sessions will read it before re-discovering it.
  • Bug fixes, new drivers, helper additions all welcome.

License

MIT.

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

sql_harness-0.2.3.tar.gz (129.1 kB view details)

Uploaded Source

Built Distribution

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

sql_harness-0.2.3-py3-none-any.whl (95.2 kB view details)

Uploaded Python 3

File details

Details for the file sql_harness-0.2.3.tar.gz.

File metadata

  • Download URL: sql_harness-0.2.3.tar.gz
  • Upload date:
  • Size: 129.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sql_harness-0.2.3.tar.gz
Algorithm Hash digest
SHA256 ff60a8e4d4237dee578f51d5e92446ae933b0b1f91b5e493eb771d45f0ca51ce
MD5 5db011989ee98689a9128400bb377ccc
BLAKE2b-256 8a12f7d915b2c1d75facca17349ffa1ffb394494e637a8de0d0aa0f0f89793fc

See more details on using hashes here.

File details

Details for the file sql_harness-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: sql_harness-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 95.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sql_harness-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e06d90e0538d13db78ab647d90f68dfe2aae6c8ef7b85a50baff45a2a0941579
MD5 47a4c8c158fb80be01bb2d94940d1660
BLAKE2b-256 b91132b3a7cdaff47023f5f91203e11ee0102947268a8bbd8dc344ad55e9d6b8

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