Skip to main content

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/reads
  • agent-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.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql-harness 0.3.8
File Size Uploaded
sql_harness-0.3.8.tar.gz 205.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-harness 0.3.8
File Interpreter ABI Platform
sql_harness-0.3.8-py3-none-any.whl Python 3 none any Details

Total release size: 370.8 kB

Release files / sql_harness-0.3.8.tar.gz

Download URL sql_harness-0.3.8.tar.gz
Size 205.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1ae4f504884a94e58575a8f05ff231e936b29576be12645711d3f88109b6120a
BLAKE2b-256 checksum
How to use checksums
e2b7a82f082a0aca8c79d9fbf655b76b198b1447962e84f26581377a446ed7d3
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.8-py3-none-any.whl

Download URL sql_harness-0.3.8-py3-none-any.whl
Size 165.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f15e55848de42a56110b8cf4dd57e4869633ec798bf61ff39181d5fb9285ad67
BLAKE2b-256 checksum
How to use checksums
2791e487ca7a63128bbdc64ace53b9855598e432af8fbd00a56c7b5cb2345d76
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 history Release notifications | RSS feed

0.3.10

2 release files

0.3.9

2 release files

This release

0.3.8 This release

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page