Repository navigation
Agent DX: any-database connect, one toolkit for every agent stack, grounded generation - #27
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Infers the sqlglot dialect from the URL, introspects keys, comments, views and schemas, layers engine-native read-only modes over a rolled-back transaction, and blocks dangerous functions for each dialect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One QueryPilotToolkit (list_tables, describe_table, search_schema, validate_sql, run_sql, ask_database) with structured errors and truncation flags, exposed for OpenAI, Anthropic, MCP (read-only annotations, mcp 1.x and 2.x), LangChain, LlamaIndex, OpenAI Agents SDK, Claude Agent SDK and plain functions. Adds querypilot demo/schema/sql/ask/init/mcp-config, a querypilot.yaml project config, and fixes the MCP registry entry to install the mcp extra. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pty results Prompts now carry primary/foreign keys, comments, policy-safe sample values and business hints, pruned with FK bridges only above a token budget. Errors come back with did-you-mean hints, and ask() and the eval pipeline share one repair loop that also handles execution errors and empty results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onfig Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…schema cache Redacts quoted values from database errors and replaces policy errors that name hidden columns with a generic message. Sampling is limited to low-cardinality, non-sensitive columns. Row-filter predicates are no longer echoed to agents. search_schema keeps multi-column matches, the schema cache is shared across with_audit_metadata copies, and the HTTP /schema endpoint honours the policy. mcp-config passes QUERYPILOT_CONFIG. MariaDB and SQLite Engine read-only and timeout handling are fixed. Eval runs default to 3 attempts, matching the library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…el cannot answer A wide-schema run (SaaSPulse + 300 distractor tables) showed pruning dropping accounts for questions that say "customer": distractor tables sharing a column name outranked it. Join partners of relevant tables now inherit most of their score, and a generation failure on a pruned schema retries once with a 4x larger context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Top-3 samples of a priority column ('normal', 'low', 'high') led the model to
map "urgent" onto 'high' in the wide-schema benchmark. Columns with at most 10
distinct values now list all of them as "one of ..."; SaaSPulse gold-literal
coverage goes from 18/22 to 22/22.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a 220-question BIRD dev sample (Claude Haiku, 2 runs each), accuracy goes from 42.5% before this PR to 47.7% with grounded context and repair, and to 57.0% with the exact-columns rule: extra unrequested columns were about half of the remaining misses. SaaSPulse core and natural suites stay at 65/65. The claude CLI runner gains --each for per-database Spider/BIRD suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/querypilot/connectors/sqlite.py # src/querypilot/core/client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes QueryPilot easier to adopt on any database, LLM provider, agent framework or MCP client. The work is prioritised by a research pass over about 250 sourced developer pain points (Vanna, WrenAI, DB-GPT, LangChain/LlamaIndex SQL tooling, MCP database servers, Spider/BIRD literature). See
docs/research/developer-needs.mdand the ranked gap analysis indocs/roadmap.md.pip install querypilot, thenquerypilot demo,schema,sql,askandinit.querypilot.yamlproject config, read by the CLI, the servers andQueryPilot.from_config().querypilot mcp-config <claude-code|claude-desktop|cursor|vscode|windsurf>prints a paste-ready config. It uses an absoluteuvxpath and passesQUERYPILOT_CONFIG.Engine. Onmain,connect("postgresql://…")silently built a SQLite connector.SQLAlchemyConnectorcovers DuckDB, MySQL/MariaDB, SQL Server, Snowflake, BigQuery, Redshift, Trino, Oracle, Databricks and ClickHouse, each with its own pip extra.list_tables,describe_table,search_schema,validate_sql,run_sqlandask_database.truncatedflag. Errors come back as payloads with "did you mean" hints instead of exceptions.readOnlyHint; mcp 1.x and 2.x), LangChain (optional drop-insql_db_*names), LlamaIndex, the OpenAI Agents SDK, the Claude Agent SDK and plain functions.hints=/descriptions=.ask()and evals share one loop.claudeCLI as the model.Bugs on
mainfixed along the wayquerypilot mcpcrashed on mcp 2.x (mcp.server.fastmcpno longer exists), which is whatmcp>=1.0installs today.uvx querypilot, which doesn't install themcpextra.QueryPilot.connect("postgresql://…")built a SQLite connector.Policy hardening from code review
CAST(email AS INTEGER)./schemaendpoint honours the access policy.Behaviour changes
These are listed in the CHANGELOG:
sqlite.columnsplus row arrays.handle_anthropic_tool_callreturns error payloads instead of raising.run_sqlis advertised instead ofexecute_sql(the old name still works).Quality measurement
Full write-up in
benchmarks/results/2026-10-20-agent-dx.md. All runs use Claude Haiku via theclaudeCLI. "Before" is #25's head; "after" is this branch merged with #25.BIRD dev, 220-question stratified sample (11 real databases, 2 runs each). This is the headline result:
About half of the misses that remained after grounding were unrequested extra columns. The exact-columns rule targets those, and part of its gain reflects BIRD's strict column scoring.
SaaSPulse. This benchmark is saturated for this model; it confirms there is no accuracy regression and shows the prompt-size change:
The runs caught two regressions in this branch, both fixed: pruning dropped join partners, and top-3 enum samples misled the model. A 64-thread concurrency check (400 mixed toolkit calls on BIRD's 459 MB database) produced no errors beyond the expected structured rejections.
Relationship to #25
This PR doesn't touch
validation/validator.py. A test merge with #25 conflicts only on import lines inconnectors/sqlite.pyandcore/client.py: keep both sides. 803 tests pass on the merged tree. Validator gaps found while adding dialects are listed in the session notes (e.g. DuckDBSELECT * FROM 'file.csv'); none were fixed here.Test plan
ruff check src tests(0.17.1)pytest: 694 passedpython benchmarks/validate_golds.pyquerypilot eval run/eval checkfromeval.yml, plussuites/safety.yaml(7/7)mcpclient (list_tables,run_sql, structured errors)examples/01andexamples/07run🤖 Generated with Claude Code