arthi.kasturirangan@informa.com
readme
e4b501b
metadata
title: Text To Sql Agent Api
emoji: 🐨
colorFrom: indigo
colorTo: indigo
sdk: docker
pinned: false
short_description: SQL agent to converse with structured databases

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Text-to-SQL Agent API

A FastAPI backend service that converts natural language queries into SQL and provides intelligent data insights using LangGraph agents.

Overview

This API service enables natural language querying of SQL databases through an AI-powered agent that:

  • Converts text queries to SQL statements
  • Executes queries safely on SQLite databases
  • Provides intelligent data analysis and insights
  • Offers conversational interface for data exploration

Built with FastAPI, LangGraph, and SQLAlchemy for high-performance data querying.

Quick Start

Prerequisites

  • Python 3.8+
  • OpenAI API key

Installation

  1. Clone and setup:
git clone https://github.com/arthikrangan/text-to-sql-agent-api.git
cd text-to-sql-agent-api
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment:
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
  1. Run the server:
uvicorn app.main:app --reload

Docker

# Build and run
docker build -t text-to-sql-api .
docker run -p 8000:8000 --env-file .env text-to-sql-api