# Data-Agent

A Chinese-language tutorial that builds a Text2SQL agent from scratch, covering state-graph orchestration, dual retrieval-augmented generation, human-in-the-loop confirmation and automatic SQL correction.

Data-Agent is a learning tutorial that reproduces and explains a Text2SQL agent based on an existing open-source project, aimed at developers who want to understand graph-based orchestration, dual retrieval-augmented generation, self-correction, and human-in-the-loop collaboration step by step.

The tutorial walks through an execution chain that takes a natural-language question, recalls both a vectorized business glossary and a knowledge graph, plans and breaks the task into steps, pauses for human confirmation on risky steps, generates and executes SQL with automatic error correction in a Python Docker sandbox, and streams the result back to the user with server-sent events. The backend is built with Kotlin, Spring Boot and an object-relational library, orchestration uses a Spring AI graph extension, storage is PostgreSQL with the pgvector extension, and the frontend uses Vue 3, TypeScript and Vite.

The material is organized into chapters, each matched to its own git branch, meant to be read alongside the corresponding source code.

Website: https://www.jarcheng.top/data-agent/
