---
title: "Context Management for Data Agents | MotherDuck"
description: "Learn to write effective context for data agents. Covers benchmarks comparing English, SQL, and semantic model formats plus scaling strategies."
canonical: "https://motherduck.com/videos/context-management-data-agents/"
---

[BACK TO VIDEOS](/videos/)

[Webinar](/videos/?category=Webinar#videos-and-webinars-library)[AI, ML and LLMs](/videos/?category=AI,%20ML%20and%20LLMs#videos-and-webinars-library)

# A Practical Guide to Context Management for Data Agents

2026/04/23Featuring: [Jacob Matson](/authors/jacob-matson/)
, [Peter Chapman](/authors/peter-chapman/)

> **TL;DR:** Data agents can query your warehouse in plain English, but without context they return inconsistent answers. English-based context outperforms semantic models for accuracy and ease of maintenance. SQL snippets speed up specific query patterns. Start with a blank context file and build it up as you find gaps.

## Why context matters for data agents

Data agents let you query a data warehouse in plain English, but the same question asked ten times can produce ten different answers. LLMs don't understand your business definitions, data semantics, or domain logic unless you spell them out. This session covers what good context looks like and how to manage it as your team grows.

## Three formats compared: English, semantic models, and SQL

Using benchmark data from the Dabstep sample dataset, the session tests three context formats against each other. English context — plain definitions and schema explanations — gets full accuracy because LLMs handle natural language best. Semantic models like Cube, LookML, and Omni perform worst because LLMs weren't trained on those structured languages. SQL context, using question-answer pairs, matches English on accuracy and runs faster for queries that resemble the provided examples.

Write context in English, add SQL snippets for frequent or complex queries, and if you already have a semantic model, translate it to English rather than feeding it to an LLM raw.

## Writing effective context

Good context adds information the LLM can't guess from column names. Don't restate the obvious. Describing "company_name" as "the name of the company" wastes tokens and adds nothing. Define business-specific terms and clarify ambiguous metrics instead. Negative prompting ("don't use average") tends to backfire on current models, making them use the wrong function more often. Frame instructions positively. Database views work well as SQL context because LLMs can both reference and introspect them through the [information schema](/docs/key-tasks/ai-and-motherduck/mcp-workflows/).

## Scaling context across your organization

The session breaks adoption into three stages. Solo explorers can start with a blank context file and build it up as they find gaps. Teams need shared context through GitHub sync, [MotherDuck's MCP server](/product/mcp-server/), or tools like Virgil, plus lightweight ownership over who updates what. Organizations supporting both explorers and pedestrians — non-technical users who expect reliable answers — need mandatory test suites, granular access control, and alerts when questions fall outside test coverage. For more on building [analytics agents](/docs/key-tasks/ai-and-motherduck/building-analytics-agents/) with MotherDuck, see the docs.

TABLE OF CONTENTS

- Why context matters for data agents
- Three formats compared: English, semantic models, and SQL
- Writing effective context
- Scaling context across your organization

Start using MotherDuck now!

[Try 7 Days Free](https://auth.motherduck.com/authorize?app_source=web&response_type=code&client_id=bza3KWQpxRAFlTlRFXUo29AOg9xD7zcp&redirect_uri=https%3A%2F%2Fapp.motherduck.com%2F&state=STATE&auth_flow=signup&screen_hint=signup&ext-ph_distinct_id=e8b9329a-97db-4afb-920d-0be2437a7cba)

## FAQS

### What is context management for data agents?

Context management means giving your data agent enough background — business definitions, how your tables relate to each other, what "revenue" actually means at your company — so it writes correct SQL instead of guessing.

Without that background, you get a familiar problem: ask the same question twice, get two different answers. The model doesn't know your org excludes refunds from revenue, or that "active customer" means someone who logged in within 90 days, not just anyone with an account. So it improvises, and it improvises differently each time.

Get the context right and the agent becomes useful for [real business decisions](/blog/analytics-agents/). Get it wrong and you're debugging hallucinated joins at 11pm.

### What's the best format for providing context to data agents — English, SQL, or semantic models?

LLMs were trained on massive amounts of natural language, so they parse English definitions well. Plain English descriptions of your data model give the best accuracy and are the easiest to maintain.

Adding SQL context — sample queries for your most common questions — matches English on accuracy and runs faster because the model spends less time exploring. Semantic model formats like Cube or LookML tend to do worse; LLMs just haven't seen enough of those languages to handle them reliably.

Write your definitions in plain English and include SQL snippets for the queries people actually ask.

### How should I start adding context for data agents?

Start with no context. Run questions against your data, see where the LLM gets answers wrong, and add context to fix those specific failures. Focus on what the LLM can't figure out from your column and table names alone — how your business defines a metric, which tables join to which, what "active" actually means in your schema. Don't dump everything you have into the context file. Irrelevant context adds noise and slows things down. You can start with [MotherDuck's MCP server](/product/mcp-server/) or a markdown file on your machine.

### How do I scale context management from one analyst to a full team?

Share your context file through GitHub or a shared workspace like [MotherDuck](/docs/key-tasks/ai-and-motherduck/mcp-workflows/). Pick someone to own keeping it current. Once non-technical users start relying on your data agents, add test cases that check answers against known correct results. Track questions that fall outside your test coverage so you can expand it. If your context files grow unwieldy, automate some of the curation.

### Can I use my existing semantic layer as context for data agents?

You can, but you'll get better results if you translate it to English first. Semantic modeling languages like Cube and LookML predate LLMs, and LLMs aren't great at interpreting them. If you feed your raw semantic model straight to an LLM, you'll get worse answers than if you write out the same definitions in plain English. It's an extra step, but converting your [semantic model](/blog/semantic-layer-duckdb-tutorial/) into natural language descriptions makes a real difference in response accuracy.

## Related Videos

[60:29](/videos/ai-agents-semantic-layer/)[2026-08-26](/videos/ai-agents-semantic-layer/)

### [Do AI Agents Need a Semantic Layer?](/videos/ai-agents-semantic-layer/)

Do AI agents need a semantic layer? Evals comparing plain-text context with a Malloy semantic layer show where each wins, and what it costs.

Stream

AI, ML and LLMs

BI & Visualization

SQL

[63:17](/videos/agentic-data-engineering-stack/)[2026-08-18](/videos/agentic-data-engineering-stack/)

### [Beyond Copilots: We're Building a Data Stack Live with AI Agents](/videos/agentic-data-engineering-stack/)

Agentic data engineering in practice: AI agents build dlt ingestion into MotherDuck and a governed Lightdash semantic layer, live in an hour.

Stream

AI, ML and LLMs

Data Pipelines

Ecosystem

[52:41](/videos/guides-context-layer-ai-agents/)[2026-08-13](/videos/guides-context-layer-ai-agents/)

### [Introducing Guides: Warehouse-Native Context for AI Agents](/videos/guides-context-layer-ai-agents/)

Guides store business context inside your warehouse so AI agents write correct SQL. See how warehouse-native context works in MotherDuck.

Stream

AI, ML and LLMs

MotherDuck Features

[View all](/videos/)