Show HN: SLayer, a semantic layer maintained by your agent
Show HN (score: 8)Description
If you want to connect your agent to a database (say, to build a data analyst chatbot or any kind of agentic app) today you have 2 options: an SQL MCP server or a semantic layer.
SQL MCP is the easiest path to setup, especially if you also have a .md knowledge base which the agent can update. It gets quite messy quickly though, especially if there's many interactions or DB is large. Generated SQL is hard to review if you want to understand where the numbers came from, and related queries can be hard to align and compare.
The natural alternative is a semantic layer, which is an inventory of what data is available/useful (data models) and an interface for querying it using a structured DSL — usually a list of measures, dimensions, filters, with joins etc. handled under the hood.
When we needed a semantic layer at Motley for connecting to our customers' data, we first settled on Cube with custom wiring for multi-tenancy and updating the models on the fly. We quickly hit some limitations which led us to realize existing semantic layers just weren't built for the purpose: they're still a part of the BI world where you want an efficient backend for an essentially static set of human-curated dashboards, whereas agents need to iterate their way to the answer, learning in the process. That's when we built the first version of SLayer, which is now open-source.
Using either SLayer MCP or CLI, agents (and humans) can:
- Explore models, run queries, connect to multiple databases
- Edit columns/measures or create new ones
- Create custom models from SQL or from a query on other models
- Learn from interactions: save and retrieve natural-language memories linked to models, columns or queries, to form a knowledge base
Agents evolve the semantic layer, reuse the results of past interactions, and make fewer mistakes going forward.
A few more features:
- Auto-creation of models from introspecting your DB schema for a warm start
- Embeddability — doesn't need a server running
- Python client for doing data analysis with dataframes
- Schema drift detection and handling
- Expressive DSL with compact, natural representations for arbitrarily deep multistage queries, custom aggregations, time shifts, combining metrics from multiple models, and other features that are tricky to get right in raw SQL
On the roadmap: access controls, caching, and more.
More from Show
Show HN: Langy, an automated AI engineer (we gave it a robot body) [video]
Founder here. Langy is an AI engineer that lives inside our platform, LangWatch. It reads your production traces, writes Scenario tests and evaluations for the problems it finds, opens a pull request on your repo, and proves the fix by running those simulations in CI. A human still merges.<p>Reachy robot from Hugging Face arrived on the same week we were planing on launching it, so we wanted to use for the launch. So we it wired to our Langy which actually lives on the platform, and asked it to test our own customer-support voice agent. On the video you can see it writing the agent tests reading traces and everything.<p>LangWatch is an open source platform (github.com/langwatch/langwatch) and Scenario, the simulation-testing library it drives, is open source too if you want to run that part yourself: <a href="https://github.com/langwatch/scenario" rel="nofollow">https://github.com/langwatch/scenario</a>. A full write-up on how Langy works under the hood is coming later this week.<p>Happy to get into how it drives the robot, what is real vs staged, latency, or how the whole harness around it actually works.
No other tools from this source yet.