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 docs/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)
docs/install.md— first-time install + first connectionSKILL.md— day-to-day usagelab/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 forapply_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.mdbody +interaction-skills/*.mdfor stuck points.
What this is NOT
- Not a database migration framework.
- Not an ORM.
- Not a connection-string parser (
pgcli/myclialready 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 docs/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>.mdfor that DSN, oragent-workspace/zones/meta/skills/<name>.mdif it generalizes. Future sessions will read it before re-discovering it. - Bug fixes, new drivers, helper additions all welcome.
License
MIT.
Metadata
Release files for sql-harness 0.3.2
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.2.tar.gz | 142.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sql_harness-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 244.8 kB
Release files / sql_harness-0.3.2.tar.gz
| Download URL | sql_harness-0.3.2.tar.gz |
|---|---|
| Size | 142.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4fe78b8e2c94756bb5a4ee708c6e34a5ffb77204c3a07ec2630ba1f414982bf
|
|
BLAKE2b-256 checksum How to use checksums |
6dd6b3395f037412a84aefb32df619ebadbe832b065c78e7d5b21ade01d72908
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","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.2-py3-none-any.whl
| Download URL | sql_harness-0.3.2-py3-none-any.whl |
|---|---|
| Size | 102.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c1b04855f229baafef13fafe92e0151b86632f9d72b7133a351f922f636aa65
|
|
BLAKE2b-256 checksum How to use checksums |
6b132a49a48579c5f6b4673d58e77a1f71c4d4c7ff2f8e9ec2c4b915797ae7f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","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}
|