Show HN:Graphene——面向编程智能体的数据分析工具包
Show HN: Graphene – Data analysis toolkit for your coding agent

原始链接: https://github.com/graphene-data/graphene

Graphene 是一个“一切皆代码”的分析框架,主要为编程智能体设计。它结合了: - **Graphene SQL:** 一层兼容 ANSI 的语义层,支持常见的 SQL 功能,以及受治理的度量、建模连接、公共表表达式(CTE)、子查询、窗口函数和 170 多种函数。 - **Graphene Pages:** 基于 Markdown 的仪表板,使用 HTML、CSS、JavaScript 和 ECharts,支持交互式筛选、布局、图表和叙事型笔记本。 项目包含 `.gsql` 语义模型和 `.md` 页面,并通过 npm 安装的命令行工具进行管理。该工具可以编译查询、校验语法、启动仪表板服务和截取屏幕。 支持的数据源包括 Snowflake、BigQuery、ClickHouse、PostgreSQL、MotherDuck 和本地 DuckDB。 Graphene 强调令牌效率、智能体友好的工作流、版本控制、测试、指标可复现性,以及使用任意大语言模型或智能体的自由。文档以智能体技能的形式提供。它支持多种数据仓库,可以在本机运行,也可以通过计划推出的 Graphene Cloud 服务运行。 Graphene 采用 Elastic License 2.0 许可证,内部使用免费;商业应用需要获得许可。

Graphene 是一套开源工具包,旨在帮助编程智能体完成商业智能和数据分析工作。它提供: - 高效利用令牌、结果确定的语义层,并支持可组合的指标宏和基于 SQL 的查询 API。 - MDX 风格仪表板文件,可将 Markdown、SQL、HTML 可视化组件、CSS 和 JavaScript 组合在一起。 - 连接 popular 数据仓库和本地 DuckDB 的能力。 creators 表示,智能体可以在单个拉取请求中生成报告、可视化、监控埋点、修改数据管道以及创建仪表板。他们还提供了安装文档和一个航班数据示例项目。 反馈主要集中于“Graphene”这个名称。评论者认为它容易引起混淆,因为它已经用于 Graphene OS 和 Python 的 Graphene 库。他们建议在采用规模扩大之前,选择一个辨识度更高的名称。
相关文章

原文

Graphene is a data analytics framework built for coding agents.
Ask questions and build visualizations 10x faster when agents do the work.

Graphene is an everything-as-code analytics framework for SQL-based data exploration, visualization, and reporting. It is designed with coding agents in mind as the primary user persona.

It provides two critical pieces that allow coding agents to do better data work:

  1. A semantic layer, which yields more accurate queries. Graphene SQL combines the power of SQL with the governance of metrics and modeled joins.
  2. A dashboard file type, which yields more consistent and polished visuals compared to raw Python or Javascript.

Design goals

  • Token efficiency. Languages are designed to be brief with minimal boilerplate.
  • Agent ergonomics. Graphene is controlled entirely via CLI. All documentation is inside our agent skill.
  • High ceilings. Graphene SQL follows ANSI and supports over 170 functions; Graphene pages support anything that can be expressed with HTML, CSS, Javascript, and ECharts.

We believe coding agents coupled with an everything-as-code analytics stack beats traditional BI in several ways:

  • Broad ecosystem of SOTA LLMs, harnesses, skills, and tools
  • Leverage business-wide context from other tools or repos
  • Perform end-to-end tasks across tools, where analytics is just one step
  • More graceful change management and bulk refactors
  • Easily promote/demote logic into or out of the semantic layer
  • Version control and CI. Revert agent mistakes. Run tests on mission-critical dashboards.
  • Tight, complete iteration loops. Agents can validate before running, view dashboards, and iterate locally
  • Leverage continuous agents for self-healing codebases

Graphene is free to use, forever. Your business logic lives in your repo and is never locked into a contract with us.

Graphene pages support visualizations, input components for filtering and dynamic behaviors, and layout modes for monitoring-oriented dashboards vs. narrative-oriented notebooks.

Graphene Screenshots

Powerful, next-generation semantic layer

Traditional semantic layers give you governance at the expense of capability. They tend to expose niche query APIs that agents aren't familiar with.

Graphene SQL's goal is to bring governance without sacrificing capability. It behaves like regular SQL—with CTEs, subqueries, window functions, set operators, and more—but also adds in the concepts of measures and modeled joins from semantic layers.

Graphene SQL is inspired by Malloy, from the creators of LookML Lloyd Tabb and Michael Toy, but implements it as good old SQL for agent familiarity.

Graphene currently supports Snowflake, BigQuery, ClickHouse, Postgres, MotherDuck, and local data (via DuckDB) as data sources. It is easy for us to add more - just ask.

Once your project is set up, simply start the dev server via npm exec graphene serve (or pnpm graphene serve, etc. based on your package manager) and then prompt your coding agent to do analytics work: answer a data question, build a dashboard, edit the model, etc.

Graphene itself is a CLI which can be installed via npm (or pnpm, yarn, etc.). The CLI can run and compile Graphene SQL queries, render pages in the browser, check syntax, print screenshots, and more.

A Graphene project can either be a standalone repo or a directory within a larger codebase (such as dbt). It is comprised of semantic models via .gsql files and pages via .md files.

Architecture Diagram

Graphene SQL and Graphene markdown

Semantic models are defined like so:

table orders (
  id BIGINT
  user_id BIGINT
  amount FLOAT
  status STRING

  join one users on user_id = users.id  -- many orders per user

  is_complete: status = 'Complete'      -- dimension (scalar expression)
  revenue: sum(amount)                  -- measure (agg expression)
  aov: revenue / count(*)               -- measures can compose
)

table users (
  id BIGINT
  name VARCHAR

  join many orders on id = orders.user_id
)

Models are then queried via select, either directly via CLI or inside a Graphene markdown page like this.

```sql top_customers
select
  users.name as name,   -- Use the dot operator to traverse the modeled join relationship
  revenue               -- Invokes the measure
from orders             -- A join statement here is not needed
group by 1
order by 2 desc
limit 10
```

<BigValue data="orders" value="revenue" />
<BarChart data="top_customers" x="name" y="revenue" />

Graphene's entire documentation ships as an agent skill in the Graphene npm package. The source files are available here.

Why coding agents?
Context, mostly. If your BI stack lives in a folder right next to the rest of your company’s data and code, an agent can make smarter decisions on what it should be analyzing and why it matters.

The reverse is also true. If you’re working on building out some new feature or a recommendation for a new client, the agent doing that work can ground it’s approach in real data and past analytical insights.

Lock-in is the other big reason we hear. Folks post-SaaS are wary of having their data and dashboards locked away in some proprietary tool, or forced to use a single LLM provider. With Graphene, you own all the files in your repo. You can use whatever agent or LLM you’d like.

How do you make money?
We’re building out Graphene Cloud as a turnkey solution to host the dashboards and reports your agent builds. We also host an MCP server and Slack bot that you can use for quick questions. If you'd like to pilot it, contact us here.
So does everyone have to use git and a coding agent to use Graphene for BI?
If you just want to use this project and nothing more, yes. Our managed service, Graphene Cloud, offers a Slack agent, MCP server, and browser-based SaaS experience.
Is my data team out of a job?
No, but we think the nature of the work is going to change. Instead of manually building out reports, data experts are going to be shaping the skills, models, and tools that the rest of their team uses to answer data questions.

Data teams are going to be focused on guiding agents on how to approach the trickiest and most nebulous data questions at a company. Questions that still require a data expert’s taste to get a good solution.

Can’t I just use React? Or python notebooks?
You could! In fact a lot of the folks we’ve talked to have started down this route. The main problem you’ll run into is consistency. The look and feel of your dashboards and reports are all over the place, and in the worst case they end up using different formula to compute the same key metric.

Graphene SQL codifies metrics into deterministic objects you can directly invoke in queries. Not only does this ensure that every use of "EBITDA" will be the same, the metadata tags we attach can hint our charts into formatting data correctly.

Graphene raises the floor so that pages you generate with the help of an agent look beautiful by default, so you can move faster with less tokens.

What software license does this use?
Graphene is licensed under the Elastic License 2.0 which allows you to use it for internal use cases for free, forever. If you would like to build your own commercial application with Graphene, please contact us here.
联系我们 contact @ memedata.com