sql-harness
A thin, single-process SQL + Redis + SSH CLI for LLM agents. Mirrors browser-harness's structure but targets relational databases (Postgres, MySQL, SQLite) plus Redis (keyspace ops + Lua) and SSH (remote shell + SFTP). No daemon, no cloud backend — engines live in one process.
Quickstart
# install (from PyPI)
uv tool install sql-harness # or: pipx install sql-harness
# or develop locally from a source checkout
uv sync
# scaffold a starter connections.toml
uv run sql-harness init
# add a connection (or edit ~/.config/sql-harness/connections.toml directly)
uv run sql-harness add --name local_pg --driver postgres --url 'postgresql://postgres:postgres@localhost:5432/postgres'
# verify
uv run sql-harness test local_pg
# use it — helpers are pre-imported in heredoc mode
uv run sql-harness <<'PY'
use_workspace("local_pg")
print(query("SELECT version()"))
print(list_tables())
PY
# browse + edit the doc library (SKILL.md, interaction-skills/, your zone skills, connections.toml)
uv run sql-harness web
Architecture
SKILL.md— the agent-facing entry (day-to-day usage; auto-shipped in the wheel)src/sql_harness/— protected core package (~1k lines: drivers, manager, helpers, web UI)${XDG_CONFIG_HOME:-~/.config}/sql-harness/connections.toml— plaintext credentials in ONE file (${env:VAR}indirection for prod secrets)agent-workspace/zones/<conn>/skills/— per-DSN skills the agent writes/readsagent-workspace/zones/meta/skills/— cross-DSN strategy skills (apply_skill()fallback)
Drivers
| Driver | Backend | Package | Status |
|---|---|---|---|
postgres |
PostgreSQL | psycopg[binary]>=3.2 |
✅ |
mysql |
MySQL | pymysql>=1.1 |
✅ |
redis |
Redis | redis>=5.0 |
✅ |
sqlite |
SQLite | stdlib (sqlite3) |
✅ (test-only) |
ssh / ssh+password / ssh+key |
remote shell + SFTP | paramiko>=3.4 |
✅ |
Key env vars
| Var | Purpose |
|---|---|
BH_SQL_HOME |
Override state root (default ~/.config/sql-harness) |
BH_SQL_CONFIG_FILE |
Override connections.toml path |
BH_SQL_AGENT_WORKSPACE |
Override agent-workspace dir |
BH_SQL_ZONE_SKILLS=1 |
use_workspace() auto-surfaces the zone's skills/scripts |
Full connection-file schema, read-only guard notes, and troubleshooting: read SKILL.md (shipped in the package, or sql-harness skill prints it).
What this is NOT
Not a migration framework, not an ORM, not an interactive REPL (pgcli exists for that) — this is for agents: heredoc scripts with auto-injected helpers, saved per-DSN and re-runnable.
License
MIT.
Metadata
Release files for sql-harness 0.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sql_harness-0.3.9.tar.gz | 620.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sql_harness-0.3.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / sql_harness-0.3.9.tar.gz
| Download URL | sql_harness-0.3.9.tar.gz |
|---|---|
| Size | 620.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f689fae05716df43dea8f37803d9ac54b1f40631a75d57c1ff41671f701848e
|
|
BLAKE2b-256 checksum How to use checksums |
f02bb18526a593619627c26fea83e0b14a5f88657dd4f5f4e3403b45a6a4ca74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|
Release files / sql_harness-0.3.9-py3-none-any.whl
| Download URL | sql_harness-0.3.9-py3-none-any.whl |
|---|---|
| Size | 509.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f731ed437d4a7c65384d52911f80581ba138636f5e8e1bdc3b5b7a0bcfda833f
|
|
BLAKE2b-256 checksum How to use checksums |
5c40ee8d3c54c9e24f84ca8676869527946585111e6c2696fdd22bc15095e22d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|