Skip to content
shiri0305Public

About

LangGraph-orchestrated intelligent SQL agent that converts natural language questions into executable SQL queries, executes them on a relational database, and returns structured results via a FastAPI backend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

LangGraph-Based Intelligent SQL Agent

LangGraph-orchestrated intelligent SQL agent that converts natural language questions into executable SQL queries, executes them on a relational database, and returns structured results via a FastAPI backend. This is a stateful SQL Agent that:

  • Accepts natural language questions
  • Translates them into SQL
  • Executes queries on a real database
  • Handles errors and retries using LangGraph control flow
  • Exposes the agent via a FastAPI REST API

High level Flow

Alt text

Why LangGraph?

Because:

  • You need state
  • You need conditional routing
  • You may need retry loops
  • You want deterministic control over agent behavior

Tech Stack

Syntax Description
Layer Technology
Language Python 3.10+
Agent Framework LangGraph
LLM OpenAI / Azure OpenAI (configurable)
Database SQLite (start simple)
Backend API FastAPI
ORM / SQL SQLAlchemy
Environment .env

Repository Structure

langgraph-sql-agent/langgraph-sql-agent/
│
├── app/
│   ├── main.py              # FastAPI entry
│   ├── agent/
│   │   ├── graph.py         # LangGraph definition
│   │   ├── state.py         # Graph state schema
│   │   ├── nodes.py         # Agent nodes
│   │   └── tools.py         # SQL execution tools
│   │
│   ├── db/
│   │   ├── models.py        # SQLAlchemy models
│   │   ├── init_db.py       # Sample data
│   │   └── session.py
│   │
│   └── config.py
│
├── tests/
├── README.md
├── requirements.txt
└── .env.example

About

LangGraph-orchestrated intelligent SQL agent that converts natural language questions into executable SQL queries, executes them on a relational database, and returns structured results via a FastAPI backend.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors