CLI ToolsMay 13, 2026·2 min read

langchain_data_agent — NL2SQL Data Agent CLI

NL2SQL data agent with a CLI (`data-agent`) built on LangGraph/LangChain. Ask questions in English to get SQL + results, with per-source configs.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Stage only
Trust
Trust: Established
Entrypoint
Asset
Safe staging command
npx -y tokrepo@latest install 975874e7-2a49-55ed-b667-917d8bc9bd50 --target codex

Stages files first; activation requires review of the staged README and plan.

Intro

langchain_data_agent turns natural-language questions into SQL with a CLI front-end, routing queries to specialized agents per config—useful for repeatable data Q&A workflows.

Best for: Data teams prototyping NL2SQL assistants with repeatable configs and CLI workflows

Works with: Python 3.12+ + uv; uses .env for credentials (per README prerequisites)

Setup time: 20–45 minutes

Key facts (verified)

  • README lists CLI commands (query, chat, configs, validate) and config routing behavior.
  • Quick start uses uv sync --all-extras and copies .env.example (README).
  • GitHub: 231 stars · 33 forks; pushed 2026-01-14 (GitHub API verified).

Main

Practical guardrails for NL2SQL agents

Use read-only credentials until you have eval coverage, and log generated SQL + result shape for audits.

README excerpt (verbatim)

+  ╔╦╗╔═╗╔╦╗╔═╗  ╔═╗╔═╗╔═╗╔╗╔╔╦╗
+   ║║╠═╣ ║ ╠═╣  ╠═╣║ ╦║╣ ║║║ ║
+  ═╩╝╩ ╩ ╩ ╩ ╩  ╩ ╩╚═╝╚═╝╝╚╝ ╩

[ Natural Language → SQL Query Agent ]

Python 3.12+ License: MIT


A natural language to SQL (NL2SQL) platform built on LangGraph and Azure OpenAI. This multi-agent system automatically routes user questions to the appropriate database backend and generates optimized SQL queries and results.

Built on top of LangChain's SQLDatabase with extended support for Azure AD authentication, Cosmos DB, and built-in dialect validation.

Features

  • Multi-Database Support: PostgreSQL, Azure SQL, Azure Synapse, Azure Cosmos DB, Databricks SQL, and Google BigQuery
  • Intent Detection: Automatically routes queries to the correct data agent based on question context
  • Multi-Turn Conversations: Follow-up questions with context awareness (e.g., "What's the average?" after a query)
  • SQL Validation: Safe query execution with sqlglot-based validation across all dialects
  • Data Visualization: Generate charts and graphs from query results using natural language (e.g., "show me a bar chart")
  • Configurable Agents: YAML-based configuration for adding new data sources
  • A2A Protocol: Agent-to-Agent interoperability for integration with other A2A-compliant systems

Architecture

Intent Detection Flow

Routes user questions to the appropriate data agent based on context.

Intent Detection Flow

Data Agent Flow

Generates, validates, and executes SQL queries with retry logic.

Data Agent Flow

Documentation

🙏

Source & Thanks

Source: https://github.com/eosho/langchain_data_agent > License: MIT > GitHub stars: 231 · forks: 33

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets