A short business question can hide a complicated data problem: unfamiliar schemas, ambiguous terms, joins and conversational follow-ups.
Inside the architecture
INTERACTIVE OVERVIEWDiscover
A slower discovery workflow reads schema metadata and samples, then prepares semantic descriptions. The aim is to ground later requests in the actual database structure.
The conversational path uses context prepared by a separate discovery workflow.
The client problem
Business users know the question they want to ask, but they may not know the schema behind the answer. A request can depend on how the organisation defines a term, which tables hold the relevant records and which joins preserve the intended meaning.
I led the design and initial implementation of a client proof of concept using n8n and Flowise. The objective was to demonstrate a conversational interface over databases, with an execution path that could be inspected and evaluated.
The architecture separated the work that changes slowly, such as learning a schema, from the work that happens every conversational turn. That distinction became central to the design.
Two workflows, two different time scales
Discovery prepares the context. The data-discovery workflow reads database metadata, samples records and builds semantic descriptions of tables and columns. Those descriptions help bridge the gap between a business phrase and the structure in which the data is stored.
The conversational workflow answers the request. It interprets intent, chooses relevant tables, prunes columns and plans the SQL. This reduces the need to repeatedly ask a model to reconstruct the entire database from scratch.
The original design explored specialised agents for those responsibilities. Later iterations also considered consolidating steps to reduce model calls. Agent decomposition provides clearer responsibilities, but each boundary brings latency, context transfer and evaluation work.
My contribution
I owned the POC architecture and technical execution, including discovery, orchestration, database integration and the structure of the conversational flow. I also worked through how to evaluate whether an answer was correct.
- Designed the separation between discovery and request-time reasoning.
- Built the initial orchestration using n8n and Flowise.
- Worked on semantic grounding and intent, table and column selection.
- Used conversational context to support refinement and follow-up questions.
- Made generated SQL and returned data inspectable.
- Defined evaluation thinking around result correctness as well as the user’s intended meaning.
Following one question through the design
“Show the trend by department, then compare it with the previous period.”
The first step is to establish what “trend” means in this context and which period the user intends. A relevant table name alone is not enough. Discovery context can suggest candidate fields; an ambiguous business definition can still require clarification.
Once the intent is clear, the workflow selects the relevant tables and columns, proposes SQL and passes it through the execution boundary. The interface can then show a table or chart from the returned rows, alongside the query.
The follow-up needs the earlier metric, grouping and time context. This is why conversational state is part of the design, rather than treating each sentence as an isolated SQL-generation task.
Evaluating the answer and the boundary
The solution design considered exact result comparison, relaxed value equivalence, partial correctness and semantic equivalence. These answer different questions. A formatting difference should not necessarily invalidate an otherwise correct result, while a plausible explanation should not conceal incorrect rows.
A later documented prototype walkthrough covered demonstration scenarios such as follow-up questions, charts, ambiguous input and refusal of destructive SQL. It compared results with independently written SQL and included focused validation tests.
This remains POC and prototype work. The validation used synthetic historical records queried from a database; it is not evidence of a continuous operational event feed or a customer production rollout.
Decision notes
Open a note for the reasoning and the trade-off.
Prepare schema context outside the conversation
Move discovery into a separate workflow, so the request path can retrieve relevant context instead of repeatedly scanning and interpreting the full schema.
Schema changes create a freshness problem. Context preparation and the conversational path need an explicit relationship.
Keep execution authority in code
Let the model propose SQL while a controlled layer governs database access. Read-only permissions and bounded execution are concrete controls around a probabilistic planner.
A syntactically valid query can still express the wrong business meaning. Execution controls and semantic evaluation address different risks.
Expose the query behind the result
Make SQL and results inspectable so users and engineers can understand the route to an answer. The interface becomes part of the trust model.
Explainability adds information to the experience. The summary must remain readable while the underlying detail is available.
The diagram is a simplified design view. Some elements of the original solution roadmap, including additional database dialect support, were future work.