[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"readme:slayer":3},"\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002FMotleyAI\u002Fslayer\u002Fmain\u002Fdocs\u002Fimages\u002Fslayer-hero.png\" alt=\"SLayer — AI agent operating a semantic layer\" width=\"600\" \u002F>\n\u003C\u002Fp>\u003Cp>\u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fmotley-slayer\u002F\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fmotley-slayer?label=PyPI\" alt=\"PyPI\" \u002F>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fmotley-slayer\u002F\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fmotley-slayer\" alt=\"Python\" \u002F>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002F\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdocs-docs.motley.ai-blue\" alt=\"Docs\" \u002F>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FMotleyAI\u002Fslayer\u002Fblob\u002FHEAD\u002FLICENSE\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FMotleyAI\u002Fslayer\" alt=\"License\" \u002F>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002FMotleyAI\u002Fslayer\u002Fstargazers\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FMotleyAI\u002Fslayer?style=social\" alt=\"GitHub stars\" \u002F>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FegWxMctHCA\" rel=\"nofollow ugc noopener\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-join-5865F2?logo=discord&amp;logoColor=white\" alt=\"Discord\" \u002F>\u003C\u002Fa>\u003C\u002Fp>\n\u003Ch1>SLayer\u003C\u002Fh1>\n\u003Cp>An expressive, embeddable semantic layer for AI agents and humans.\u003C\u002Fp>\n\u003Cp>SLayer enables AI-powered data analytics on top of your warehouse. Agents get a governed, shared surface through which they access your data and metrics and give you reliable answers.\u003C\u002Fp>\n\u003Cp>SLayer handles database connectivity (read-only), SQL translation, common data transformations, and row-level security, so LLMs and humans don't have to. Adapt it to your workflows, not the other way around. Manage definitions easily with an agent or by yourself.\u003C\u002Fp>\n\u003Cp>SLayer can be used as a standalone tool or imported as a Python library, easily embeddable into any Python app. Use it for powering analytical MCP servers or APIs or simply to query databases semantically.\u003C\u002Fp>\n\u003Cp>SLayer is at the core of \u003Ca href=\"https:\u002F\u002Fmotley.ai\" rel=\"nofollow ugc noopener\">Motley\u003C\u002Fa> and is maintained with ♡ by the same team.\u003C\u002Fp>\n\u003Ch2>How SLayer is different\u003C\u002Fh2>\n\u003Cp>Traditionally, semantic layers were a part of the BI stack, where every metric and its aggregation\nhad to be predefined. Agents need more flexibility because users ask questions that involve metric combinations (like ratios), transforms (like time shifts), or different aggregations\nof the same metric (like average instead of sum).\u003C\u002Fp>\n\u003Cp>SLayer allows to define a column \u003Ccode>revenue\u003C\u002Fcode> once and query it using \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fconcepts\u002Fformulas\u002F\" rel=\"nofollow ugc noopener\">expressions\u003C\u002Fa> like \u003Ccode>sum(revenue)\u003C\u002Fcode>, \u003Ccode>avg(revenue)\u003C\u002Fcode>, \u003Ccode>sum(revenue) \u002F count(*)\u003C\u002Fcode>, \u003Ccode>time_shift(sum(revenue), -1, 'year')\u003C\u002Fcode> etc.; \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fexamples\u002F06_multistage_queries\u002Fmultistage_queries\u002F\" rel=\"nofollow ugc noopener\">multi-stage queries\u003C\u002Fa> are also supported.\u003C\u002Fp>\n\u003Cp>SLayer is focused on the common agentic \u003Cstrong>search → inspect → query\u003C\u002Fstrong> flow. It has a \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fconcepts\u002Fsearch\u002F\" rel=\"nofollow ugc noopener\">search\u003C\u002Fa> tool for efficient discovery and a \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fconcepts\u002Fmemories\u002F\" rel=\"nofollow ugc noopener\">memory store\u003C\u002Fa> for linking the relevant business context.\u003C\u002Fp>\n\u003Cp>Agents, apps and humans can talk to SLayer via \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Freference\u002Fmcp\u002F\" rel=\"nofollow ugc noopener\">MCP\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Freference\u002Frest-api\u002F\" rel=\"nofollow ugc noopener\">REST API\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Freference\u002Fcli\u002F\" rel=\"nofollow ugc noopener\">CLI\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Freference\u002Fpython-client\u002F\" rel=\"nofollow ugc noopener\">Python\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Finterfaces\u002Fflight-sql\u002F\" rel=\"nofollow ugc noopener\">Flight SQL\u003C\u002Fa>, or Postgres-based \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Finterfaces\u002Fpg-facade\u002F\" rel=\"nofollow ugc noopener\">SQL API\u003C\u002Fa>. SLayer \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fconfiguration\u002Fdatasources\u002F#supported-database-types\" rel=\"nofollow ugc noopener\">supports\u003C\u002Fa> most popular databases.\u003C\u002Fp>\n\u003Cp>SLayer fits next to your existing data stack. It also provides importers for \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fdbt\u002Fdbt_import\u002F\" rel=\"nofollow ugc noopener\">dbt\u003C\u002Fa>, \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fcube\u002Fcube_import\u002F\" rel=\"nofollow ugc noopener\">Cube\u003C\u002Fa>, and \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002Fosi\u002Fosi_import\u002F\" rel=\"nofollow ugc noopener\">Ossie\u003C\u002Fa> configs.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>See \u003Ca href=\"https:\u002F\u002Fdocs.motley.ai\u002Fslayer\u002F\" rel=\"nofollow ugc noopener\">docs\u003C\u002Fa> for more.\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Ch3>Example\u003C\u002Fh3>\n\u003Cp>Question (run on the built-in demo Jaffle Shop database): \u003Cstrong>\"show monthly revenue by store, with month-over-month % change\"\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp>Side by side, here's LLM-generated SQL and the equivalent SLayer query.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fa8c73688-e760-402e-9f87-a05591d6cbee\" alt=\"Example SQL vs SLayer query\" \u002F>\u003C\u002Fp>\n\u003Ch2>Quickstart\u003C\u002Fh2>\n\u003Cp>We recommend using \u003Ca href=\"https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F\" rel=\"nofollow ugc noopener\">uv\u003C\u002Fa>, especially if you don't work in a Python project.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">u\n\u003C\u002Fcode>\u003C\u002Fpre>\n",1790633832648]