Skip to main content

SLayer — AI agent operating a semantic layer

PyPI Python Docs License GitHub stars Discord

SLayer

An expressive, embeddable semantic layer for AI agents and humans.

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.

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.

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.

SLayer is at the core of Motley and is maintained with ♡ by the same team.

How SLayer is different

Traditionally, semantic layers were a part of the BI stack, where every metric and its aggregation had to be predefined. Agents need more flexibility because users ask questions that involve metric combinations (like ratios), transforms (like time shifts), or different aggregations of the same metric (like average instead of sum).

SLayer allows to define a column revenue once and query it using expressions like revenue:sum, revenue:avg, revenue:sum / *:count, time_shift(revenue:sum, -1, 'year') etc.; multi-stage queries are also supported.

SLayer is focused on the common agentic search → inspect → query flow. It has a search tool for efficient discovery and a memory store for linking the relevant business context.

Agents, apps and humans can talk to SLayer via MCP, REST API, CLI, Python, Flight SQL, or Postgres-based SQL API. SLayer supports most popular databases.

SLayer fits next to your existing data stack. It also provides importers for dbt, Cube, and Ossie configs.

See docs for more.

Example

Question (run on the built-in demo Jaffle Shop database): "show monthly revenue by store, with month-over-month % change"

Side by side, here's LLM-generated SQL and the equivalent SLayer query.

Example SQL vs SLayer query

Quickstart

We recommend using uv, especially if you don't work in a Python project.

uv tool install 'motley-slayer[all]'

If slayer isn't found on PATH afterwards, run uv tool update-shell and reopen your terminal.

Using demo dataset

# With the Jaffle Shop demo preloaded (zero-config quickstart)
claude mcp add slayer_demo -- slayer mcp --demo

Using your own data

Set up your datasource, substituting the correct database, username, hostname, and db_name.

slayer datasources create 'postgresql://user:${DB_PASSWORD}@hostname/db_name'

The password will be read by SLayer at init time, not saved to disk nor exposed to Claude.

Then add SLayer to Claude Code:

claude mcp add slayer -- slayer mcp --ingest-on-startup

Now SLayer MCP will be visible in Claude Code next time you start it. Make sure to launch Claude Code from a shell where DB_PASSWORD is exported — the MCP subprocess inherits its environment from the launching process.

Read more on how to get started with MCP, CLI, REST API, Python in the docs.

License

MIT

Metadata

Release files for motley-slayer 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for motley-slayer 0.10.1
File Size Uploaded
motley_slayer-0.10.1.tar.gz 952.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for motley-slayer 0.10.1
File Interpreter ABI Platform
motley_slayer-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.0 MB

Release files / motley_slayer-0.10.1.tar.gz

Download URL motley_slayer-0.10.1.tar.gz
Size 952.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5e5f99bbdcbde8b8df20a5e4e9f0b13a7136f45cbc99c082639d5d51de7a29ad
BLAKE2b-256 checksum
How to use checksums
76dcc993eb68fec6f82c2b04973d692b5a71e85f8e8e6a4b2c10b66dd30d0830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / motley_slayer-0.10.1-py3-none-any.whl

Download URL motley_slayer-0.10.1-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c00e473fad70eae70ab8b5f49697ba3bb350d9f19fcfcd98c49863069fb8d8b5
BLAKE2b-256 checksum
How to use checksums
fdf304a2b3ce4103c56639461b3d581f8723c37e8af6a78d21be49308f72a2fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.10.2

2 release files

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.9.12

2 release files

0.9.11

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.10

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page