<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <atom:link href="https://motherduck.com/rss.xml" rel="self" type="application/rss+xml" />
        <title>MotherDuck Blog posts | RSS Feed</title>
        <link>https://motherduck.com</link>
        <description>Welcome to MotherDuck's blog posts!</description>
        <lastBuildDate>Tue, 08 Sep 2026 07:25:25 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>Next.js using Feed for Node.js</generator>
        <image>
            <title>MotherDuck Blog posts | RSS Feed</title>
            <url>https://motherduck.com/images/mother-duck-large-logo.png</url>
            <link>https://motherduck.com</link>
        </image>
        <copyright>MotherDuck is powered by DuckDB</copyright>
        <item>
            <title><![CDATA[Context, Semantics, and Ontology: A Primer for the Agentic Era]]></title>
            <link>https://motherduck.com/blog/context-layer-vs-semantic-layer-ontology</link>
            <guid isPermaLink="false">https://motherduck.com/blog/context-layer-vs-semantic-layer-ontology</guid>
            <pubDate>Wed, 02 Sep 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[A primer on the context layer, semantic layer, and ontology: what each term means, how they fit together, and why AI agents still need a human to decide what's true.]]></description>
            <content:encoded><![CDATA[
<p>There's so much talk about new ways of working with agent engineering supported workflows. New models are independently creating new metrics and transformations, finding gaps in the business data, reviewing the SQL they write, and verifying everything works with your data platform.</p>
<p>All of it is autonomous, so one might say, why do we still need BI tools, or therefore a semantic layer, or even a context layer? It's hard to predict the future, but as someone working with newer models as well as older ones, I could see that Fable for example is one-shotting work in minutes that previously took me many iterations with Opus 4.8 (below you see my recent Claude and Codex use (roborev only)). With the right workflows to brainstorm first a spec, then an implementation plan, it's really amazing how fast and precisely one can build with the right amount of inputs we give, and <a href="https://substack.com/home/post/p-189793289">taste</a>.</p>
<p>So what then is left for us humans to do in the data work context? Many are defaulting to adding or curating context, ergo the <strong>rise of a context layer</strong>. I see even more talks about added Ontologies. Maybe you ask yourself, what is that even? Do we need all of it?</p>
<p>This article is a primer about the context layer, the difference between a classical semantic layer contained in every BI tool, and an external semantic layer.</p>
<h2>What is Context, and Its Context Layer?</h2>
<p>But we can't talk about the new shiny context layer tools, ontologies or any other, before we define context, and how much context we need. If we go by the definition of the word context, <a href="https://dictionary.cambridge.org/dictionary/english/context">Cambridge Dictionary</a> says:</p>
<blockquote>
<p>The situation within which something exists or happens, and that can help explain it</p>
</blockquote>
<p><a href="https://jessicatalisman.substack.com/">Jessica Talisman</a>, who writes about semantics, the vocabulary and the intersections of ontologies, <a href="https://jessicatalisman.substack.com/p/the-context-problem">defines</a> context in information science as:</p>
<blockquote>
<p>Describes the <strong>relational structure that holds meaning in place</strong>.</p>
</blockquote>
<p>This sounds very much like metadata, the data about the data we collect in logs, orchestration runs, table information, index information. But let's go one step further, what's a Context Layer?</p>
<h3>What's a Context Layer?</h3>
<p>There are multiple definitions out there, and bear in mind, this term is less than a year old, but Andreessen Horowitz <a href="https://a16z.com/your-data-agents-need-context/">describes a "Modern Context Layer" to contain</a>[^1] three pieces:</p>
<blockquote>
<ol>
<li>
<p><strong>Accessing the right data</strong>. [...] we'd want to ensure the agent has access to all the data it needs [...] captured in internal systems, GDrive/Slack, etc.</p>
</li>
<li>
<p><strong>Automated context construction</strong> [...] emphasis of <strong>focus should be on high signal context</strong> – for example, looking through past query history can be high signal in determining the most referenced tables and most common joins, and data modeling solutions like dbt or LookML can provide clear definitions for business metrics.</p>
</li>
<li>
<p><strong>Human refinement</strong> – Automated context construction may be able to form a large portion of the context corpus, but it can't create the full picture. [...]</p>
</li>
</ol>
</blockquote>
<p>I defined it in <a href="https://www.kaelio.com/blog/building-a-context-layer-for-the-agentic-era">Beyond the Semantic Layer</a> in a similar fashion:</p>
<blockquote>
<p>The context layer primarily <strong>supports the accuracy of SQL queries, continuous updates to the business context</strong>, and governance. Additionally, with a newer context layer, we can <strong>include more relevant business insights</strong> that are stored internally, usually in <strong>unstructured form</strong>, in tools like Notion as business documentation.</p>
</blockquote>
<p>So it seems clear, we focus on less "classical" data sources from databases, or structured tables, but more free-flow text that humans wrote in docs, Confluence, Notion.</p>
<h3>Comparison to a Semantic Layer, and how They Work together</h3>
<p>Now that we defined context and its layer, it begs the question, what's the difference to a semantic layer (which, to some, might be another rather vague definition)? I know, I have <a href="https://www.ssp.sh/blog/rise-of-semantic-layer-metrics/">written about</a> past BI integrated ones, and more modern ones like Cube, Malloy, dbt one, but it still seems everyone has a different definition.</p>
<p>The definition of a semantic layer, as we discussed in <a href="https://motherduck.com/blog/semantic-layer-duckdb-tutorial/#what-is-a-semantic-layer-why-use-one">Why Semantic Layers Matter</a> (including an example of how to build one), is defined by Julian Hyde, creator of Morel Language, and an early employee of Looker and LookML:</p>
<blockquote>
<p>A semantic layer, also known as a metrics layer, lies between business users and the database, and lets those users compose queries in the concepts that they understand. It also governs access to the data, manages data transformations, and can tune the database by defining materializations.
Like many new ideas, the semantic layer is a distillation and evolution of many old ideas, such as query languages, multidimensional OLAP, and query federation.</p>
</blockquote>
<p>So that means, a <strong>semantic layer understands the semantics, the metrics and governance access</strong> and data transformation, and has a link to (multi-dimensional) OLAP and query languages, while the <strong>context layer is more focused on gathering context and refinement between humans and agents</strong>.</p>
<p>I see the two, a semantic layer and a context layer, working for distinct fields, and working hand in hand:</p>
<ul>
<li><strong>Semantic Layer</strong>: Definition is <strong>written as logic that compiles to SQL</strong>, like a metric or a dimension</li>
<li><strong>Context layer</strong>: Holds everything else: the rules that can't be explained, and everything that is <strong>unrelated to a dedicated query</strong>.</li>
</ul>
<h2>The Context Layer and Agents Paradox</h2>
<p>In a semantic layer, Notion Docs, Confluence pages, and other unstructured text didn't count as real data sources. There's no incremental load on Markdown, so we didn't include them.</p>
<p>There is also another angle in play. Before agents, it was hard to keep track of free flow Markdown text, finding out what has changed in the incremental load, and what's useful, what has the biggest signal as a16z said above. But with the help of agents, we can now integrate more. Agents can do the bulk of the work, and that's why context layers popped up in the first place.</p>
<p>It's a <strong>paradox</strong>: if we <strong>didn't have agents, we wouldn't need this much context</strong>. But we <strong>need more context because of agents</strong>, and we <strong>can only manage it because we have agents</strong>.</p>
<p>We can load more data than ever now <strong><em>because</em> agents do the integration work</strong> that wasn't feasible before, but we also need to load more data than ever because agents need to be smarter to use it well. The agent needs every bit of human-written information to increase its context and make better decisions, but that's only possible because of agents in the first place.</p>
<p>Jacob saw a similar paradox in <a href="https://analyticshour.io/2026/06/23/300-are-semantic-layers-really-necessary/">Are Semantic Layers Really Necessary?</a> and says:</p>
<blockquote>
<p><strong>there's a little bit of a paradox</strong>:  you need some level of conformity to communicate well, but also if you have too much conformity, you have a commodity. You need space to have some differentiation.</p>
</blockquote>
<h3>How much Context Do We Need? And what Kind?</h3>
<p>That begs the question: How much context do we need, and what kind? Should we gather all Markdown files we find, or use the JIRA tickets where we defined our tasks?</p>
<p>And what's the quality of these JIRA tickets? They might be super up-to-date, but missing a whole lot of information, so what kind of "context" do we get from them, or do we want?</p>
<p>With agents, we could probably say the more context, the better, and hopefully the agent identifies the high-signal and valuable data out of empty Jira tickets . But assuming we gathered all of the above context, how do we actually manage it? How do we update it, how do we make sure it's correct?</p>
<p>This is actually where we always land at the same fundamental questions of <em>Data Engineering Lifecycle</em> and <em>data governance</em>, especially in an enterprise setting with multiple actors and people. Because it's easy to build up context initially, once. But the hard part is updating it, maintaining it, having rules, having a governance strategy.</p>
<p>So the Context Layer integration, as well as the semantic layer, becomes a data governance and enterprise process definition problem.</p>
<h2>Open Standards for Metrics and Data Quality</h2>
<p>What helps us here are open standards. Luckily we just recently got the <strong>Open Semantic Interchange (OSI)</strong> standard, recently renamed to <a href="https://github.com/apache/ossie">Apache Ossie</a>. They standardise the syntax around semantic layer declarative configuration. The goal is to have an <strong>open-source, vendor-agnostic specification for describing and exchanging semantic models</strong>.</p>
<p>Not that we end up with many different proprietary YAML definitions for LookML, Cube, dbt Semantic Layer, Snowflake's internal one, etc. as we have it today. If you write in the standard, it can be easily mapped to any semantic layer definition.</p>
<h3>Metrics to Measure the Data Quality of Context</h3>
<p>Another part of the puzzle and how good context layers will be, is the data quality. The outcome, the <strong>context itself, strongly depends on the quality</strong> and how up-to-date and <em>correct</em> the data is.</p>
<p>One thing I was pondering for a long time: how do we measure that? In my previous job we had a single test score to represent data quality, something like an <a href="https://www.rohde-schwarz.com/us/knowledge-center/videos/interview-nps-the-single-qoe-centric-network-score-from-rs_251220-621634.html">Net Performance Score (NPS)</a> we used to represented the mobile network and network quality as a <strong>single metric that characterizes the overall performance</strong>. So as a network provider, I won't need to check every number on each phone call. I can aggregate it up to an NPS score as part of a region, commune, or country. This is a common approach in network profiling, but in data we don't have that luxury yet. Maybe we should?</p>
<p>Why am I saying all of this? Because to be able to massively ingest context, and documentation autonomously, without checking it, we need a measure. And that needs an open standard on data quality. Measures such as <code>last updated date, creator (agent/human), ratings, etc.</code> would be needed to condense a full score. If we have this, we can add a load more context, faster.</p>
<p>But right now, we do not have it, unless we use a <a href="https://www.ssp.sh/brain/open-table-format-catalogs">data catalog</a>, where catalogs scan metadata and humans rate data sets etc. But with faster agents and everything autonomous, this model needs some improvements.</p>
<h2>And what the Heck is an Ontology?</h2>
<p>Another term I see more frequently used and talked about, is an Ontology. I include it here, because if we talk about context, and the newly created context layer, I believe it's a good vehicle to explain the world for agents that need to understand not only the data our business holds, but also need to link it to common sense and how the world functions in real life. And that is what ontologies are really good at.</p>
<h3>Ontology: Broader Context to Explain World Models</h3>
<p>These are not something new. I used them back in 2017, when Airbus (where I was working at the time) <a href="https://www.airbus.com/en/newsroom/press-releases/2017-06-airbus-launches-skywise-aviations-open-data-platform">announced Skywise</a>, an open data platform for airplane parts. And do you know what it was built on? On <a href="https://www.palantir.com/docs/foundry">Palantir Foundry</a>, a data lake with a deep foundation in Ontologies.</p>
<p>If we go to Wikipedia, it <a href="https://en.wikipedia.org/wiki/Ontology_(information_science)">defines</a> an Ontology as follows:</p>
<blockquote>
<p>In information science, an ontology <strong>encompasses a representation, formal naming, and definitions</strong> of the <strong>categories, properties, and relations</strong> between the <strong>concepts, data, or entities</strong> that pertain to one, many, or all domains of discourse.</p>
</blockquote>
<p>In simpler words, usually existing objects in the world can be described through an ontology. For example, an ontology is seen as the whole below:</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/articles/context-layer-vs-semantic-layer-ontology/images/ontology_palantir_87701b2e96.webp" alt="Ontology core concepts diagram from Palantir Foundry docs, showing object types, link types, and properties">
<em>Source: <a href="https://www.palantir.com/docs/foundry/ontology/core-concepts#ontology">Core concepts for Palantir - Docs</a></em></p>
<p>Palantir <a href="https://www.palantir.com/docs/foundry/ontology/core-concepts#ontology">defines</a> it inside their tool called Foundry as:</p>
<blockquote>
<p>Ontology is a categorization of the world, <strong>it's the digital twin of an organization</strong>, integrating the organization's data and models into a coherent whole by mapping them to object types, properties, link types, and action types.</p>
</blockquote>
<p>The <code>Airport, Flight, Delay, Airline, Aircraft</code> each result in an object type, which is the <strong>schema definition</strong> of a real-world entity or event, not an ontology in itself.</p>
<p>Arrows (Departed From, Operated By, Hub For, etc.) are <strong>link types</strong> and the schema definition of a relationship between two object types, similar to how we model connections in the relational model in an Entity Relationship Diagram (ERD).</p>
<p>Things like <code>Duration, Founding Date, Range</code> are <strong>properties</strong>, which are the schema definition of a characteristic of a real-world entity or event. So the ontology is the whole schema (all five tables/datasets plus how they join together).</p>
<p>But in terms of computer/information science, the term was first used in information systems in 1967 by Mealy, though the more significant early work came from McCarthy and Hayes in 1969, who argued that intelligent machines need metaphysically adequate representations of the world. Hayes' 1978 paper "Naive Physics I: Ontology for Liquids" appears to be the first computer science paper with "ontology" in the title. Find more in What is an Ontology? (2018)
</p>
<h3>Compare Semantic with Context Layer, and Knowledge Graph and Ontologies</h3>
<p>Others such as Ananth Packkildurai <a href="https://www.dataengineeringweekly.com/p/an-ontology-for-ai-agents-is-a-system">share</a> it combined into a simple diagram where taxonomy and knowledge graph get added to showcase the technical semantic architecture leading to the context graph:</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/articles/context-layer-vs-semantic-layer-ontology/images/context_graph_ananth_12058179e6.webp" alt="Diagram showing semantics, taxonomy, knowledge graph, and ontology layered into a context graph">
Source: <a href="https://www.dataengineeringweekly.com/p/an-ontology-for-ai-agents-is-a-system">What an Ontology for AI Agents Actually Needs</a></p>
<p>So another term, "<strong>Knowledge Graph</strong>", simply explained, means information stored in a graph database and visualized as a graph structure, prompting the term knowledge "graph". But it helps us see the semantics as the start (the definitions -> can be independent of database or tooling if you have an external layer), and then external elements of the world outside of my company's business are described as an ontology, what Ananth calls the "schema layer," since it defines the classes, properties, and rules everything else has to conform to, which, combined with a graph (the "instance layer," holding the actual data), leads to the "context graph".</p>
<p>Mehdi calls the difference between a semantic and context (page 5): "'Semantic' is just a fancy word meaning there's a specific meaning for certain concepts and metrics in a company. Some are easy and stable; others live in people's heads and shift over time." And says that the good news is that LLMs are very good at pulling data from many sources, so we can use the full semantic context and not just a separate layer.
</p>
<h2>What's the Take Away? Graphs and AI Agent Integration?</h2>
<p>I know that was a lot, with a lot of definitions and potentially new terms brought together.</p>
<p>What got clearer to me, is that data <strong>gets more interconnected</strong>. When you follow the data news, as I do, many call for the context layer and connect it <strong>with a graph</strong>, because the graph is the best representation of complex interconnected knowledge, internal, external or models for describing the world, as the airport/flight example above shows.</p>
<p>Hamilton, Till, Jacob and Garret though make a counter argument in <a href="https://motherduck.com/blog/context-belongs-in-the-warehouse/">Context belongs in the warehouse</a>, saying not to overcomplicate with sophisticated retrievals (embeddings, graphs). They showcase MotherDuck's new Guides work by having the agent browse a topic tree of curated guide titles and pick the right one without any keyword or vector search. This suggests that sometimes a simple index is enough.</p>
<h3>Sophistication Is a Cost, Not a Default</h3>
<p>Put those two paragraphs side by side and you get a contradiction: interconnected knowledge argues for a graph, and MotherDuck's own Guides argue that a flat index of titles beats embeddings and graph traversal. Both are right, they're just answering different questions.</p>
<p>Sophistication is a cost you should only pay if the outcome is worth much more than that cost. The airport/flight ontology earns a graph because the domain genuinely is cross-domain and interconnected: an aircraft links to a flight, a flight to an airline, an airline to a hub, and the value is in traversing those relationships. MotherDuck's guide index doesn't need that, because the actual bottleneck isn't relating entities to each other, it's picking the one right document out of a hundred, and an agent does that more reliably by scanning titles than by ranking similarity scores. A graph would have added retrieval overhead and, per MotherDuck's own evals, picked worse.</p>
<p>The same lens explains why a semantic layer earns a deterministic, machine-callable interface (SQL, REST, GraphQL) that a context layer doesn't get. It comes down to who's actually asking, and what it costs to be wrong. A semantic layer's numbers get called directly by a dashboard or a scheduled job, with no human and no LLM in the loop, so it has to be right every time, and that guarantee is worth the cost of building and maintaining it. A context layer feeds an agent that's still reasoning, still capable of misreading a guide or picking the wrong table, so there's still a checkpoint between the context and the number that ships. A context layer doesn't carry that weight, at least not yet: it depends entirely on your setup and your data governance. As more agent-mediated work goes straight to a dashboard with nobody reviewing it, the case for giving context layers their own consistency guarantees only gets stronger.</p>
<p>So before reaching for a graph, an ontology, or a deterministic interface, ask what the retrieval or consistency problem actually is, who consumes the result, and what a wrong answer costs. Match the tool to that answer, not to what's trendy this quarter.</p>
<h3>The Way Forward: Tools and AI Agent Integration</h3>
<p>You might also ask, if agents like Fable are one-shotting work that used to take many iterations, what's actually left for humans to do?</p>
<p>There's already a handful of context layer tool that build a Context Layer. I have written about <a href="https://github.com/Kaelio/ktx">ktx</a>, and am checking out <a href="https://github.com/ModernRelay/omnigraph">OmniGraph</a>, but there are many more with <a href="https://github.com/getnao/nao">Nao</a> or more data catalog flavored <a href="https://github.com/marmotdata/marmot">Marmot</a>, <a href="https://github.com/open-metadata/OpenMetadata">OpenMetadata</a> or <a href="https://github.com/datahub-project/datahub">DataHub</a> just to name a few, and all working closely with AI agents to ease governance and management.</p>
<p>Another integration is through the ORM (Object-Relational Mapping). I once read: "an ORM to a database is what a semantic layer is to a domain knowledge", so maybe we just need ORMs for agents?</p>
<p>So what's the way forward then?</p>
<h3>AI Agents Read the Business Knowledge</h3>
<p>When we give an AI agent the business knowledge it needs through a context layer, or semantics with SQL queries and joins, it can query a warehouse correctly.</p>
<p>An agent can read a table's schema, but the schema won't reveal the inside knowledge of how "revenue" is defined, which tables join to which, or which columns are unreliable. A semantic layer and a context layer are two different answers to that gap and are not mutually exclusive.</p>
<p>We can see a real-world illustration of how the two layers of semantic and context can cooperate in Anthropic's <a href="https://claude.com/blog/how-anthropic-enables-self-service-data-analytics-with-claude">self-service data analytics with Claude</a>. They write about how their agents are using skill instructions to leverage the semantic layer first for self-service data analytics. The skill file itself states plainly that the semantic layer is the mandatory default path for every data question, with raw SQL as the fallback used only once the semantic-layer path is shown not to cover the ask. MotherDuck Guides play a related role as curated knowledge for the agent, though MotherDuck ships the context layer first and treats a dedicated semantic layer as a separate, later question, so the routing is not the same.</p>
<h2>In the end?</h2>
<p>So, back to where I started: if a model like Fable can one-shot in minutes what used to take me many rounds with Opus, what's actually left for us in the data work context? Looking back at the initial semantic layer, the evolution to a context layer, and combining it with an ontology, these are not really competing tools or methodologies. They are all interconnected and work in a net. <strong>The definitions for the metrics in SQL/YAML in a semantic layer, ingestion pipeline of unstructured text and keeping it up-to-date with context layers, and making sense of the world for the agents with ontologies</strong>.</p>
<p>And most of what we have evolved to, is mostly due to the sheer power and advancement of agentic work, that agents can autonomously keep up with metadata and data we want to convert into context. But at the same time, it always <strong>defaults back to the fundamental question of what my data governance</strong> looks like, and what my overall data architecture is to achieve the goal at hand.</p>
<p>And as a16z's three-part context layer implied, as well as Anthropic's semantic-layer-first skill: <strong>someone still has to decide what's true</strong>. We still need the human in the loop, especially with data. And that's the whole crux of Amdahls Law, as long as a person or a team needs to decide or gets involved, we lose the overall speed, but I think that's the price we still pay, if we want good, verified data quality in our enterprise data warehouse or analytics platforms.</p>
<p>And as I raised with the metric to measure data quality, which we do not have, it confirms another true statement, that the hard part in data is never building semantics or the context once, it's how and who keeps it <em>correct</em> and <em>maintained</em>. That's the answer to my opening question: not a tool, but judgment, the same judgment behind the "human refinement" step a16z pointed to, and the same one behind deciding whether a problem is worth a graph or is better served by a flat index.</p>
<p>Large language models are getting exceptionally good at writing the SQL with the right context, and at maintaining just that. But most often, deciding what "revenue" means still requires deep company-specific knowledge (for now).</p>
<hr>
<p>Listen more on these very related discussed topics with the already teased Jacob's podcast about <a href="https://analyticshour.io/2026/06/23/300-are-semantic-layers-really-necessary/">Are Semantic Layers Really Necessary?</a>. Or check out the great example of how AI agents can help with creating a semantic layer using the open source semantic layer Malloy at <a href="https://motherduck.com/blog/AI-writes-the-semanrites-the-semantic-layer/">AI Writes the Semantic Layer | MotherDuck</a>.</p>
<p>[^1]: They call it a "modern" context layer. I'm not sure we already went through the evolution of context layers, so calling it modern does not add much value. To me it's the first version of a context layer.</p>
]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agents Don’t Query Like Humans Do]]></title>
            <link>https://motherduck.com/blog/agents-dont-query-like-humans-do</link>
            <guid isPermaLink="false">https://motherduck.com/blog/agents-dont-query-like-humans-do</guid>
            <pubDate>Wed, 02 Sep 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[We analyzed a slice of MotherDuck query history and found agents ran 29 times more queries than humans last month, a gap that has roughly doubled every month. The average organization now has twice as many agents as human users. Agents are the dominant consumers of the data platform, and our systems can't afford to stay the same.]]></description>
            <content:encoded><![CDATA[
<p>Agents don’t write code like humans do. They grep around endlessly, use pip instead of uv (sad), and <a href="https://www.githubstatus.com/history">strain our most important systems</a>. Agents in data use the same trusty SQL we do, but maybe they wield it differently. How <code>DISTINCT</code> are they from humans, really? Once we know, what should we do about it?</p>
<p>We wanted to find out by analyzing a slice of query history across human and agent users. Here’s what we uncovered. Our systems can’t afford to stay the same.</p>
<p><em>On methodology, a quick note: here we’re comparing queries written during a two week period in the MotherDuck UI (“human”) versus those written through the MCP server (“agent”). This is the most consistent way to segment with a high degree of confidence between human and robot authorship.</em></p>
<h2>Agents Query 29 Times More Often</h2>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/agent_to_human_volume_ratio_ac3e7c120d.png" alt="agent_to_human_volume_ratio.png"></p>
<p>The most visible difference between agentic query patterns and humans is just the sheer volume of queries. Agents ran 29 times more queries than humans in the last month. By itself that is quite astonishing. If you look at the chart though, the trend shows no signs of slowing down. Each month in the last three, the gap has roughly doubled: 6x, 16x, 29x. If that pattern holds, in 2 more months agents will be issuing a full 2 orders of magnitude more queries than are run in the UI manually (the “old fashioned way” - it feels crazy to say that!).</p>
<p>Another interesting observation is that as recently as January of this year, humans did more of the querying. Then agentic queries overtook manual queries in February and haven’t looked back.</p>
<p>Efficient agent ergonomics are no longer optional. The accuracy of robot-authored queries matters tremendously. The importance of <a href="https://motherduck.com/blog/context-belongs-in-the-warehouse/">investing in the context layer</a> is increasing dramatically month on month. Context can both boost accuracy and reduce how many tokens it takes to reach the right answer.</p>
<blockquote>
<p>Agents are now the dominant consumers of the data platform.</p>
</blockquote>
<h2>Organizations Have More Robots Than Humans</h2>
<p>Self service analytics has long been a holy grail in data. Some have quested after it for many years (I count myself among them, having helped build a self-service platform!). Others consider it a myth, too high a risk, or at best an inefficient approach.</p>
<p>Our data shows <strong>twice as many agents as human users on average</strong> per organization. At the extremes there is an even larger difference. The organization with the most agent users has <strong>7 times as many agents</strong> as the org with the most human users has humans! More and more people are learning about their data by using agents to interpret it.</p>
<p>As a self-service-maximalist, this is music to my ears! However, I am not naive. I have seen plenty of data misinterpretation and have certainly been guilty of it myself more than a few times.</p>
<p>New types of folks across your company are asking data questions, or rather, new agents from across your company are asking questions on their behalf. The <a href="https://motherduck.com/docs/key-tasks/guides/">context layer</a> helps here too, but as adoption increases across new teams, it needs to be as automatic as possible. People are connecting up agents on their own and just firing away questions independent of any central training program.</p>
<blockquote>
<p>Like it or not, agents have accelerated data democratization.</p>
</blockquote>
<h2>Humans Pause to Think, Agents Query Rapid-Fire</h2>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/time_between_queries_ebbcb4f46d.png" alt="time_between_queries.png"></p>
<p>The gap between queries is far shorter for agents than humans. The <strong>median delay between queries for agents is 4 seconds, but 60 seconds for humans</strong>. This makes agentic workloads far burstier than their human equivalents. I see this myself as well: I am far better at building one query at a time, but with a few subagents, agents can be highly parallel.</p>
<p>This has significant system implications. Your data platform has to be ready to handle higher concurrency than before, but is also more likely to have periods of quiet after each burst. Can your system <a href="https://motherduck.com/learn/how-motherduck-scales-distributed-architecture/">scale down</a> in between those bursts of queries, or do you have a cluster that is running even when the agent is “Razzmatazzing”? If you are scaling up to handle that concurrency, those idle times get expensive quickly.</p>
<p>However, the opposite extreme has high costs as well. Those queries run in short succession often examine the same data. A completely fresh compute environment for each query sacrifices all the benefits of pre-warmed data. <a href="https://motherduck.com/learn/skip-the-cache-embedded-analytics/">Keeping your data warm</a> can boost performance and lower costs.</p>
<blockquote>
<p>Agents fire off queries in rapid bursts that can be taxing to rigidly configured data infrastructure.</p>
</blockquote>
<h2>Experimentation is the Way of the Robot</h2>
<p>We’ve seen this behavior in coding. Agents like to do small experiments to confirm their assumptions. Our dataset shows this behavior extends to data analysis. <strong>The median query by an agent only scans 7000 rows of data vs. 200,000 by humans.</strong> Agents issue large requests too, but they issue so many small ones that it lowers the median. Similarly, many agent queries are acquiring context and metadata by reading table schemas.</p>
<p>Is your data system prepared for many small, highly concurrent queries? Or is there a latency floor where even the smallest queries take multiple seconds? Agents love to experiment, and the faster they can do that, the quicker your company’s data questions get answered.</p>
<p>Using a full compute cluster just to list the data types in a table is overkill. Does your data platform have the ability to <a href="https://motherduck.com/docs/key-tasks/running-hybrid-queries/">cache data locally</a>? Then when an agent asks 3 specific questions about the same dataset, it will only be pulled once. If the entire catalog could be synced locally (<a href="https://motherduck.com/docs/concepts/architecture-and-capabilities/#dual-execution">it can!</a>) then exploratory queries become instant and free.</p>
<blockquote>
<p>The small experimental queries that agents depend on need to be both fast and cost efficient.</p>
</blockquote>
<h2>Our Systems Need to Change</h2>
<p>Taken together, these agentic workload patterns should change how we design and implement our data platforms.</p>
<p>Organizing the context of your data is an investment with far greater returns than ever before. Not only does context <a href="https://motherduck.com/blog/context-belongs-in-the-warehouse/#benchmarking-improvements">dramatically increase agent query accuracy</a>, it also reduces costs (55% savings in those same benchmarks) by requiring fewer tokens to complete the same analysis.</p>
<p>Having a well constructed context layer also makes it far easier for all teams (executive, operational, and everything in between) to begin uncovering data insights on their own. This can lead to tremendous value and far better decisions across the company. Agents open the door, but inside will they find a dusty antique shop or an orderly library?</p>
<p>Small, highly concurrent query patterns are the norm with agents. Those patterns are also burstier than human ones and require faster scaling up and scaling down. Having a data platform that can <a href="https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/read-scaling/">handle that very different load shape</a> in a performant and cost effective manner will become more and more critical.</p>
<p>Finally, how can we take better advantage of <a href="https://motherduck.com/docs/key-tasks/running-hybrid-queries/">compute</a> and <a href="https://motherduck.com/docs/concepts/results/">caching</a> where agents are running? Any round trips that are saved on background schema research or follow up questions on similar datasets directly translate into performance and cost wins.</p>
<p>We’ve been architecting MotherDuck specifically for the agentic reality we all live in. Give us a test - there’s nothing quite like benchmarking with your own data and workload.</p>
]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic SQL for Free with Qwen3.8 27B and DuckDB]]></title>
            <link>https://motherduck.com/blog/Agentic-SQL-for-Free-with-Qwen3.8-27B-and-DuckDB</link>
            <guid isPermaLink="false">https://motherduck.com/blog/Agentic-SQL-for-Free-with-Qwen3.8-27B-and-DuckDB</guid>
            <pubDate>Fri, 28 Aug 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[If your laptop has 16GB of RAM, your agent can write SQL locally for free with Qwen3.8 27B. On the DABstep SQL benchmark, Qwen beat GPT 5.6 Luna and cost under 50 cents in electricity, over 17x less. Add DuckDB and you have a data analyst that runs on your own machine. This post covers the benchmark results and walks through the setup, including which quantized model to download for your laptop.]]></description>
            <content:encoded><![CDATA[
<p>Frontier-level agentic SQL performance now fits on your laptop, even if your laptop is almost five years old with only 16GB RAM! By combining Qwen 3.8 27B and DuckDB, everything happens locally. If you want, one config change moves the query workload to MotherDuck to handle any scale.</p>
<p>How does this change the way we work? What does this say about the future of using AI in data? Oh, and let’s get it set up on your machine while we’re at it. It won’t take long!</p>
<h2>The Pareto Frontier Has Shifted</h2>
<p>We used a custom harness and OpenRouter to run the <a href="https://motherduck.com/blog/oops-maybe-we-do-need-semantic-layers/">DABstep benchmark</a> across a variety of models and compare them to Qwen3.8 27B running locally on my laptop(s). I’ll dig into the details in a moment, but first, how did it do?</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/cost_vs_accuracy_343f23ee75.png" alt="cost_vs_accuracy.png"></p>
<blockquote>
<p>To say I was impressed with Qwen 3.8 is an understatement. Look how far to the top-left it is!</p>
</blockquote>
<p>For free, or under $0.50 if you count electricity costs, Qwen outperformed OpenAI’s GPT 5.6 Luna Max that cost over $8. That’s over <em><strong>17 times cheaper.</strong></em> Just a few weeks ago, <a href="https://motherduck.com/blog/openai-just-made-analytics-10x-cheaper/">we were singing Luna’s praises</a> and its revolutionary impact. It’s still really powerful. Things just move fast here in AI land.</p>
<p>The Qwen 4 bit run was done on an M5 Macbook Air (32GB RAM), and the 3 bit run on my older M1 Pro Macbook Pro (16GB RAM). Since the Air only uses 30 Watts to the Pro’s 100W, it is even more cost efficient!</p>
<p>Gemini-3-Flash remains the most accurate model, but for an additional 2.3x in price over Luna. These benchmarks are slightly noisy, so it is possible that some small prompt improvements could bring performance closer together.</p>
<p>Things are not looking great for Sonnet 5 here. More expensive and significantly less accurate is not a great combination.</p>
<p>As another open weight model data point, Kimi K3 is quite accurate, but at a high price. It is suboptimal vs. Gemini-3-Flash aside from its openness.</p>
<p>You can explore the results in this <a href="https://motherduck.com/product/dives/">MotherDuck Dive</a>:</p>
<h2>How Qwen3.8 Changes the Way We Work</h2>
<p>This truly is intelligence too cheap to meter. We are quite literally only metering electricity, and on a 30W Macbook Air, that’s 1 single light bulb! Left a light on last night? Could have answered a whole bunch of data questions!</p>
<p>While this benchmarked questions and answers about data, there are a number of other similar workloads where these models are useful. Background research has a lot of similarities. The first task in both is to use business context to understand the question, then the tool usage for research is just web search instead of kicking off a local DuckDB query. SQL is a good proxy for other lightweight coding tasks like scripting or automation too. These tasks are now free, so feel free to kick them off in the background even if there is only a chance they are useful.</p>
<p>With a local model this good, and a laptop that powerful sitting on your desk, every day you wait to set this up is a day you’re burning money on tokens! If you have a fairly powerful laptop, you could get several dollars per day (upwards of $100 per month!) of value out of it for pennies in electricity.</p>
<p>Aside from the raw dollars, completely removing the risk of racking up a big bill overnight by accident is really freeing. The failure mode of running slowly on a big task instead of churning through credits is a big benefit. (Side note, MotherDuck’s billing model works the same way - you can’t accidentally send a query across thousands of machines!).</p>
<p>One of my favorite data workloads that fits that pattern is query optimization. “Hey Qwen! Look at all the queries I ran today and make them faster. You have the next 12 hours to experiment. Use data science best practices. Go!”.</p>
<p>Powerful open models open up other doors around self hosting these open weight models, possibly fine tuning them, or even tapping into a <a href="https://www.darkbloom.dev/">decentralized network of independently owned Macs</a> for cheap inference!</p>
<h2>Let’s Get Your Laptop Fans Whirring</h2>
<p>So how can you get this set up locally to get in on these benefits? First, what kind of machine do we need?</p>
<p>You’ll want a laptop with over 16GB of unified memory or a discrete graphics card with 16GB of RAM. For things to work most smoothly, having 32GB of RAM does help a fair bit. Macs (especially Macbook Pros) also have higher GPU memory bandwidth so they tend to be higher performing than other laptops.</p>
<p>As a total newcomer to local models, it only took me an hour or so of trial and error to get the basics working. Now you can skip those steps and be up and running in minutes!</p>
<ol>
<li><a href="https://duckdb.org/install/?platform=macos&#x26;environment=cli">Install DuckDB</a></li>
<li><a href="https://lmstudio.ai/download">Install LM Studio</a></li>
<li>Download a quantized (smaller) Qwen3.8 27B model
<ol>
<li>For a Macbook with 32GB RAM I recommend a 4bit quant like <a href="https://huggingface.co/lmstudio-community/Qwen3.8-27B-MLX-4bit">Qwen3.8-27B-MLX-4bit</a></li>
<li>For a Macbook with 16GB RAM you’ll want a 3bit quant. I like <a href="https://huggingface.co/unsloth/Qwen3.8-27B-GGUF?show_file_info=Qwen3.8-27B-UD-IQ3_XXS.gguf">IQ3_XXS</a> from the unsloth family of models.</li>
</ol>
</li>
<li>[Optional] Download an <a href="https://huggingface.co/mlx-community/Qwen3.8-27B-MTP-4bit">MTP (Multi-Token Predictor)</a> for a speed up in some cases</li>
<li>Ask your agent to start the LM Studio OpenAI-compatible endpoint server with the model you downloaded. These settings worked well for this benchmark:
<ol>
<li>16384 tokens of context</li>
<li>The MTP if you downloaded it</li>
<li>Reasoning set to low or off</li>
</ol>
</li>
<li>Connect your favorite agent harness (OpenCode, etc.) to that server
<ol>
<li>Or use a custom harness like in our <a href="https://github.com/motherduckdb/labs/tree/main/projects/agentic-sql-context-mcp">benchmark repo</a></li>
</ol>
</li>
<li>Point DuckDB at your data and ask a data question!</li>
</ol>
<p>I did a number of smaller tests to tweak settings to try and get the most out of my machine. I found the best approach was to ask my agent to build a DOE (design of experiments) to try a variety of combinations of settings. This is important! The settings are very interrelated, so tuning one at a time will not give you the results you’re looking for. I also monitored memory pressure and swapping (meaning I asked Claude to measure that for me!) and asked for ways to lower memory use as well.</p>
<blockquote>
<p>Memory is the most precious resource when running a local model, so I would recommend a clean restart before any benchmarking. At least close all your Chrome tabs…</p>
</blockquote>
<p>I ended up getting about 5-7 tokens / second when looking at total elapsed time on my M5 Macbook Air, which is close to the 8.8 tokens/sec that memory bandwidth would project.</p>
<p>When using an older M1 Pro Macbook Pro with 16GB RAM, I used a 3bit quant. That means that the model’s weights were rounded even more aggressively in order to save RAM. Accuracy suffered somewhat (only 96.4% accurate instead of 98.6% with the 4bit), but it still worked, even on nearly 5 year old hardware! I saw about 5 tokens/second looking at elapsed time, because the memory bandwidth on the M1 Pro chip is actually higher than the M5 [non-pro] on the Macbook Air, but the M5 has some nice neural accelerators that give it an edge.</p>
<h3>What is This MTP Thing?</h3>
<p>MTP, or multi-token prediction, is a really cool approach to boosting output by guessing what the next few tokens will be in advance, then checking if they were correct. It’s most similar to speculative execution in CPUs. A CPU will do branch prediction to try and execute calculations ahead of time (exploring the most common side of an if statement, for example). When it gets things right, you get faster speeds. If it’s wrong, it just falls back to running your calculations in series.</p>
<p>Since the tokens are checked, there is no risk of any inaccuracy. I like risk free performance!</p>
<p>On the more modern Macbook, MTP was helpful with a draft size of 3. I saw somewhere around a 30% boost.</p>
<p>On the older Macbook Pro, MTP was actually slowing me down! It’s because the bottleneck was somewhere else in the system - the hardware just wasn’t designed with this kind of workload in mind. It took too much time to guess ahead and check those answers.</p>
<h2>How Did We Benchmark?</h2>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/context_layer_eval_loop_local_model_sql_13dfdc9ee4.png" alt="context-layer-eval-loop-local-model-sql.png"></p>
<blockquote>
<p>For all the details, check out our <a href="https://github.com/motherduckdb/labs/tree/main/projects/agentic-sql-context-mcp">GitHub repo</a></p>
</blockquote>
<p>Our custom harness uses the DABStep benchmark to simulate how a data team should manage their context layer. First, general documentation (including some SQL snippets) is fed into Claude Fable 5 and converted into MotherDuck Guides. Guides are just markdown living right next to your data that are linked together with relationships. If you want to work locally, markdown files and some links might just do the trick.</p>
<p>So yes, we do use a large frontier model for part of this workload, but it is a fast and inexpensive portion of the flow. The cost sensitive part is when the question and answer sets are evaluated and that’s where the local models come in.</p>
<p>Once an initial context layer is built, it is iteratively tested with the smaller AI model against 26 Q&#x26;A pairs as a training set. Each question must match an exact text output. If any questions are answered incorrectly by the smaller model, the context layer is improved to document missing assumptions and business rules. The improvement uses the larger model to try and really refine that central set of definitions.</p>
<p>With a 26/26 score exiting the training and improvement loop, the full test set of over 400 questions is run and scored. This set is run using the smaller model as well because that is the only scalable way to run this kind of process in production.</p>
<blockquote>
<p>Nobody should run Fable for their evals at scale unless their company rhymes with “gyroscopic”. I guess they could use Sol if it rhymes with “orange banzai”.</p>
</blockquote>
<h2>The Rest of the Story</h2>
<p>I’m convinced that local models have finally reached the tipping point of being useful. Qwen3.8 27B in particular shocked me and made me rethink what is possible in a 27 billion parameter model.</p>
<p>There are still some things that are not quite equal though. First, the runtime:</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/runtime_vs_accuracy_6c12d6104a.png" alt="runtime_vs_accuracy.png"></p>
<p>Qwen took 5-6 minutes to answer each question on average vs. about 25 seconds for Gemini-3-Flash or 40 seconds for GPT 5.6 Luna. There are some disclaimers here though! I think I could tune things up a little bit more, so there could be another 20-30% performance left on the table. New quantizations keep coming out that push Qwen even further as well.</p>
<p>A key factor though is the hardware. M5 Max Macbook Pros actually have 4x the memory bandwidth of the Macbook Air. If that translates to 4x the performance (a decent assumption), then 90 seconds starts to be a lot closer to the frontier lab models.</p>
<p>However, I was only really able to run 1 prompt at a time locally. I routinely blasted 15 questions at a time through OpenRouter for this benchmark, and you can scale out prompts on the cloud as much as you are willing to pay for. Subagents are quite handy to run in parallel.</p>
<p>This approach also only applies to those with beefy enough hardware. Some brief Claude research estimates around 1/3rd of laptops have over 16GB RAM, which means most folks still aren’t going to be able to take full advantage. If you limit it to just Macs with 16GB+, for their faster memory bandwidth, that number drops to more like 1/30th of folks.</p>
<blockquote>
<p>But I’d guess it’s a bit more than 3% of the folks reading this post, so if you have the horsepower, you should try this out!</p>
</blockquote>
<p>In this benchmark, the construction of the context layer was also still done with a large frontier model (here, Fable 5). Local models are unlikely to cover all use cases just yet, at least on midrange consumer hardware.</p>
<p>Lastly, we are only considering electricity costs since we assume you already have a laptop. If you include depreciation expense for the laptop itself, the cost of a local model increases to about $6 per 1000 questions answered. What’s the math there? If we assume a laptop costs $2000 and lasts 4 years, then 6 minutes of depreciation per question gives you $5.70 in costs to answer all 1000.</p>
<blockquote>
<p>So, don’t buy a Macbook Air just to run Qwen. You should also, you know, use the laptop.</p>
</blockquote>
<h2>Get That Laptop Quacking!</h2>
<p>Local models are strong enough that they are worth the hour they take to get set up. Pair them with DuckDB, and you have a powerhouse data exploration and analysis toolkit for free, right where you’re already working.</p>
<p>If your data is too big to analyze locally, MotherDuck’s hypertenancy architecture gives each agent their own sandbox in the cloud. That comes with nice compute isolation guarantees (no agent can slow down the CEO’s dashboard!) as well as data compartmentalization (your agent’s data is private by default). Plus, costs are per sandbox, so no one query can explode across servers and balloon your spend. MotherDuck’s Guides also give you a super easy way to make sure that your business context is right at your agents’ “fingertips” whenever they need it.</p>
<p>Qwen3.8 27B and DuckDB is a uniquely powerful combo to use the laptop you already have to understand your company’s data, and MotherDuck is there if you need more power.</p>
<p>Happy analyzing!</p>
]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MotherDuck CLI: query, pipelines, and dashboards from your terminal]]></title>
            <link>https://motherduck.com/blog/motherduck-cli-announcement</link>
            <guid isPermaLink="false">https://motherduck.com/blog/motherduck-cli-announcement</guid>
            <pubDate>Thu, 27 Aug 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[Meet the MotherDuck CLI: one install to query data, publish Python pipelines, and host dashboards from your terminal, for coding agents and CI alike.]]></description>
            <content:encoded><![CDATA[
<p>One prompt and 45 seconds of CLI time. That's what it took an agent to sign up for MotherDuck, load a dataset into a pipeline, and publish a dashboard on top of it. That's the session I'll walk through in this post, with Claude Code driving the new MotherDuck CLI.</p>
<p>Since launching our MCP server in November 2025, we've been investing in making MotherDuck work well with AI. But agents don't all live in chat windows anymore. A big chunk of them run in coding tools, CI jobs, and sandboxes where the natural interface is a shell. And a shell is where the rest of your infrastructure already lives: your CI, your deploy scripts, your Makefiles.</p>
<p>So we built a <a href="https://motherduck.com/docs/getting-started/interfaces/motherduck-cli/">CLI</a>. Use it to give your agent a MotherDuck environment it can operate directly, or use it on your own to deploy and manage MotherDuck resources as code. Same commands either way.</p>
<p>With the MotherDuck CLI, creating an org, a pipeline, and a dashboard is a handful of commands, whether a human or an agent is typing them:</p>
<pre><code class="language-bash">curl -s https://install.motherduck.com | sh    # install the CLI
motherduck login                               # existing user? browser login
motherduck new                                 # or: free org, no signup needed
motherduck query "FROM 's3://bucket/data.parquet' LIMIT 10"
motherduck flight push my_pipeline --run       # publish + run a Python pipeline
motherduck dive push my_dashboard              # publish a hosted dashboard
</code></pre>
<p>In this post, I'll walk through why we built it, run a real end-to-end session with Claude Code driving the CLI (with actual timings from my terminal), and explain when to reach for the CLI vs our existing MCP server.</p>
<h2>Why a CLI?</h2>
<p>MCP has been great for getting started. You go to the Claude or ChatGPT connector directory, authenticate to MotherDuck in a few clicks, and your agent gets a bunch of tools. That flow works well when the agent lives in a chat client.</p>
<p>A CLI puts the work where the agent already lives. MCP tools are remote calls: every result comes back through the model. A CLI runs in the agent's local environment, next to grep, git, and the filesystem. <code>motherduck flight push hn_flight</code> does the same thing whether a human types it, a CI job runs it, or Claude Code calls it, and the agent only spends tokens on the decision, not on the execution.</p>
<p>It also keeps the work outside the context window. Every MCP tool result lands in the context, and you pay tokens for it. With a CLI, the agent can pipe <code>motherduck query</code> into a file, grep the three rows it cares about, or diff two dive sources on disk, and only the relevant part ever reaches the model. DuckDB runs locally too, so file-shaped work (authoring code, staging data) happens on the machine and ships to the cloud in one call. Fewer round trips through the model means <a href="https://motherduck.com/docs/getting-started/interfaces/motherduck-cli/agents/#why-the-cli-costs-fewer-tokens-for-file-shaped-work">fewer tokens burned</a>.</p>
<p>And since it's a plain command, it's scriptable. The same CLI you hand to an agent is the one you put in a Makefile or a GitHub Action to deploy flights and dives as code. No AI required.</p>
<p>Second reason: setup with no browser. An agent running in a CI job or a sandbox can't click through an OAuth screen. (You can run the MCP server with a token too, but the CLI makes it the default path.) With the CLI, one curl command and the agent has everything it needs. If you already have an account, <code>motherduck login</code> gets you in. If there's a <code>MOTHERDUCK_TOKEN</code> in the environment (the CI case), the CLI picks it up automatically. If neither, <code>motherduck new</code> creates a <a href="https://new.motherduck.com/">temporary org</a> for free, no signup, and stores the token. You also get a claim URL to attach that org to a human account later, so the agent can do the work first and you take ownership after.</p>
<p>Third: one surface. MotherDuck started as a DuckDB extension, which meant installing DuckDB first. The CLI ships with DuckDB inside, so <code>motherduck query</code> works locally and against the cloud from one install. Admin operations live in a <a href="https://motherduck.com/docs/sql-reference/rest-api/motherduck-rest-api/">REST API</a>. The CLI puts queries, pipelines, dashboards, and account management behind a single interface to manage all your MotherDuck resources and assets, for humans and agents alike.</p>
<h2>Show me the prompt</h2>
<pre><code class="language-text">Can you use the motherduck cli to analyze this dataset : https://us.data.motherduck.com/hacker_news/parquet/hacker_news_2021_2022.parquet
</code></pre>
<p>This is a minimalist prompt on purpose. I gave it to Claude Code and let it figure out the rest. The dataset is 3.87M Hacker News items (stories, comments, polls). Here's what the agent did, with the wall-clock timings from my session.</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/articles/motherduck-cli-announcement/images/motherduck_cli_agent_flow_4a7f524811.png" alt="Agent flow: prompt to pipeline to dashboard with the MotherDuck CLI"></p>
<h3>Setup</h3>
<p>The agent searches for the install command and finds:</p>
<pre><code class="language-bash">curl -s https://install.motherduck.com | sh
</code></pre>
<p>This installs the <a href="https://motherduck.com/docs/getting-started/interfaces/motherduck-cli/">MotherDuck CLI</a>. In my case a token was already present, so the CLI connected straight to my org.</p>
<h3>Explore before building</h3>
<p>Before writing any pipeline code, the agent inspected the data with <code>motherduck query</code>, reading the parquet straight from our public datasets host (zero credential setup):</p>
<ul>
<li>count + time range: 4.3s</li>
<li><code>DESCRIBE</code> for the schema: 1.8s</li>
<li>row breakdown by type: 2.3s</li>
</ul>
<p>Here's the schema inspection, exactly as it ran:</p>
<pre><code class="language-bash">motherduck query "DESCRIBE SELECT * FROM 'https://us.data.motherduck.com/hacker_news/parquet/hacker_news_2021_2022.parquet'"
</code></pre>
<pre><code class="language-text">column_name  column_type  null  key  default  extra
-----------  -----------  ----  ---  -------  -----
title        VARCHAR      YES
url          VARCHAR      YES
text         VARCHAR      YES
dead         BOOLEAN      YES
by           VARCHAR      YES
score        BIGINT       YES
time         BIGINT       YES
timestamp    TIMESTAMP    YES
type         VARCHAR      YES
id           BIGINT       YES
parent       BIGINT       YES
descendants  BIGINT       YES
ranking      BIGINT       YES
deleted      BOOLEAN      YES
</code></pre>
<p>And the row breakdown that told the agent what it was dealing with:</p>
<pre><code class="language-bash">motherduck query "SELECT type, count(*) AS n FROM 'https://us.data.motherduck.com/.../hacker_news_2021_2022.parquet' GROUP BY type ORDER BY n DESC"
</code></pre>
<pre><code class="language-text">type     n
-------  -------
comment  3530415
story    334153
pollopt  1123
job      915
poll     134
</code></pre>
<p>That exploration pass paid off: the pipeline SQL that came out of it quoted the reserved <code>"by"</code> column, filtered on the <code>dead</code> and <code>deleted</code> flags, and picked the <code>timestamp</code> column over the raw epoch one. The agent found the sharp edges before they became bugs.</p>
<h3>Read the manual</h3>
<p>This is my favorite part. The CLI ships its own agent-facing docs:</p>
<pre><code class="language-bash">motherduck flight guide
motherduck dive guide
</code></pre>
<p>Each prints a full authoring guide: supported APIs, runtime limits, gotchas like pinning the duckdb version or converting BigInt values before charting. If your org has authored its own flight or dive guidance, the CLI appends it here too. They run locally, so the agent gets everything it needs without a single web search. In my session, both the pipeline and the dashboard worked on the first try, and I credit the guides for that.</p>
<h3>Build the flight</h3>
<p>A <a href="https://motherduck.com/docs">Flight</a> is a Python data pipeline that runs on MotherDuck, on demand or on a cron schedule. The agent scaffolded one locally, wrote the ingestion logic, and shipped it:</p>
<pre><code class="language-bash">motherduck flight init hn_flight --name hn_ingest   # 0.04s
motherduck flight push hn_flight                    # 8.9s
motherduck flight run hn_flight                     # 3.0s to submit
</code></pre>
<p>The run itself ingested all 3.87M rows into three aggregate tables (daily activity, top domains, top stories) in 11.5 seconds of server-side compute. The agent then checked the exit code with <code>flight list-runs</code> and verified the output tables with one more query (2.0s) before moving on.</p>
<h3>Build the dive</h3>
<p>A Dive is an interactive dashboard authored as a single React file and hosted on MotherDuck. The agent wrote one <code>index.tsx</code> querying the tables the flight produced: KPI tiles, a daily time series with a metric toggle, a top domains chart, and a top stories table.</p>
<pre><code class="language-bash">motherduck dive init hn_dive --title "Hacker News 2022 Pulse"   # 0.04s
motherduck dive push hn_dive                                    # 2.2s
</code></pre>
<p>Push returns a live URL. Since the dive reads the flight's output tables, re-running the flight refreshes the dashboard for free.</p>
<p>The dive created:</p>
<p><img src="https://motherduck-com-web-prod.s3.us-east-1.amazonaws.com/assets/img/articles/motherduck-cli-announcement/images/motherduck_cli_dive_screenshot_b39949efd9.png" alt="Hacker News 2022 Pulse dive built by the agent"></p>
<p><em>(placeholder: dive demo video goes here in the final post)</em></p>
<p>End to end: one prompt, about 45 seconds of CLI time, from no account to a scheduled-ready pipeline plus a hosted dashboard.</p>
<h2>Built for agent loops</h2>
<p>A few design choices make the CLI pleasant for agents specifically:</p>
<ul>
<li>Local commands (<code>init</code>, <code>guide</code>, <code>--help</code>) run instantly with no network call.</li>
<li>Every command takes <code>-o json</code> for programmatic parsing:</li>
</ul>
<pre><code class="language-bash">motherduck flight list-runs hn_flight -o json
</code></pre>
<ul>
<li>Runs are inspectable. <code>flight list-runs</code> returns exit codes and <code>flight logs</code> returns what the run printed. When a pipeline fails, the agent reads the logs, fixes the source, and pushes again. Versions are tracked on every push, so nothing is lost.</li>
<li><code>flight push --run</code> collapses publish and execute into one call, which saves a round trip in tight loops.</li>
</ul>
<h2>When to use MCP or CLI</h2>
<p>Both let an agent work with MotherDuck. The deciding question is whether the agent has a shell and a filesystem. If there's a local environment with compute available, the CLI is your best friend: it keeps big results out of the context window and lets the agent filter locally. If there's no shell (Claude or ChatGPT on the web), MCP is the way in:</p>
<ul>
<li>The CLI fits agents that run commands and write files: a coding agent building a dive or a flight in a repository, a CI job, or a shell script.</li>
<li><a href="https://motherduck.com/docs/key-tasks/ai-and-motherduck/mcp-setup/">The MCP server</a> fits agents in a chat client with no shell, such as Claude or ChatGPT on the web. Use it to explore data, answer a question, an