Inspiration
Developers and data teams constantly face a familiar friction: non-technical stakeholders need answers locked inside relational databases, but getting those answers requires writing custom SQL queries, analyzing schemas, or waiting on an overstretched data team.
While general-purpose LLM chatbots can write simple SQL code, they frequently hallucinate table names, fail on complex joins, or produce silent logic errors. We wanted to build DataScout—a specialized tool that makes querying any SQL database as intuitive as chatting with a colleague, while giving developers full visibility into the agent's underlying logic.
What it does
DataScout is a multi-agent analytical engine distributed first as a developer-friendly Python package (pip install datascout-ai) and backed by an end-user workspace.
- Frictionless Connection Hub: Users can drag-and-drop a
.sqlitefile, paste a PostgreSQL connection string, or drop in a.sqlschema dump. - Active Schema Context: Visual "Active Table" chips stay pinned in the context bar, letting users inspect column types, primary keys, and relations inline.
- Transparent Reasoning Trace: Instead of hiding behind a generic loading spinner, DataScout displays a real-time tree of its specialized agents (
Schema Agent,Planning Agent,SQL Generation, andSelf-Reflection Agent). - Dual-View Workspace: On the left, a natural-language conversation breaks down insights and caveats. On the right, the Data Artifact Canvas toggles between an interactive data grid, auto-generated charts, and executable Python/SQL code blocks.
How we built it
Core Multi-Agent Engine: Python & LangGraph / AutoGen. We built the execution core as a modular Python package. The engine orchestrates autonomous agents specialized in distinct phases: schema parsing, multi-step join planning, SQL generation, error handling, and narrative synthesis.
Database Driver Integration: SQLAlchemy & AsyncIO. We integrated SQLAlchemy drivers to dynamically inspect incoming database structures (SQLite, PostgreSQL, MySQL) without reading sensitive row data upfront, preserving user data privacy.
Self-Correction Loop: Validation Engine. We added a dry-run execution layer. If a generated query fails or returns a syntax error, the
Self-Reflection Agentcaptures the stack trace, adjusts the SQL query, and re-executes automatically before returning the result.Chat GPT -Inspired Dual Frontend: React & Tailwind CSS. We built the web UI featuring a side-by-side layout: a streaming conversational panel on the left and a responsive Canvas on the right powered by AG Grid (for tables) and Plotly (for charts).
Challenges we ran into
- Schema Hallucination & Large Datasets: Large databases with dozens of tables easily overflow standard context windows. We had to implement a lightweight
Schema Agentthat pre-filters and indexes relevant tables before passing context to thePlanning Agent. - Handling Ambitious Queries: Queries that require multi-stage aggregations often caused single-prompt LLMs to choke. Architecting the pipeline into distinct planning, drafting, and self-reflection steps drastically reduced invalid join conditions.
- Real-time Streaming UI: Streaming both standard conversational text and structured execution traces simultaneously over WebSockets required careful state management to avoid layout shifts in the frontend.
Accomplishments that we're proud of
Zero-to-SQL in seconds: Successfully taking a raw PostgreSQL connection string and answering complex analytical queries in natural language with 100% execution transparency.
- Packaging the core engine so tightly that developers can run
datascout-aiin a Jupyter notebook, CLI session, or CI/CD pipeline using the exact same underlying logic. - Designing a "Self-Reflection Loop" that catches and fixes syntax errors autonomously in milliseconds.
- Creating a UI layout that keeps technical artifacts (raw SQL, execution logs, schemas) accessible without cluttering the conversational narrative.
What we learned
- Trust requires transparency: Developers don't trust black-box AI outputs for data. Exposing collapsible agent logs (showing how the query was planned and corrected) builds immediate confidence in the results.
- Schema context is king: Most Text-to-SQL errors stem from a lack of structural context rather than weak LLM reasoning. Grounding agents in column data types and foreign key relationships yields the highest performance gains.
Built With
- autogen
- fastapi
- langraph
- pydantic
- python
- sqlalchemy
- streamlit
- tailwind
- websocket
Log in or sign up for Devpost to join the conversation.