CLI Tools2026年5月13日·1 分钟阅读

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 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
CLI Tool
安装
Stage only
信任
信任等级:Established
入口
Asset
安全暂存命令
npx -y tokrepo@latest install 975874e7-2a49-55ed-b667-917d8bc9bd50 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

简介

langchain_data_agent 把自然语言问题变成 SQL,并提供 CLI 入口;它能按配置把问题路由到不同的专用数据 agent,适合把数据问答流程标准化。

最适合: 想用可复用配置 + CLI 快速原型 NL2SQL 助手的数据团队

适配: Python 3.12+ + uv;通过 .env 配置凭证(README 前置条件)

配置时间: 20–45 分钟

关键事实(已验证)

  • README 列出 CLI 命令(query/chat/configs/validate)以及按配置路由机制。
  • Quick start 使用 uv sync --all-extras 并复制 .env.example(README)。
  • GitHub:231 stars · 33 forks;最近更新 2026-01-14(GitHub API 验证)。

正文

NL2SQL agent 的实用护栏

在评测覆盖不够之前使用只读凭证,并记录生成的 SQL 与结果结构,便于审计。

README 原文节选(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: https://github.com/eosho/langchain_data_agent > License: MIT > GitHub stars: 231 · forks: 33

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产