> ## Documentation Index
> Fetch the complete documentation index at: https://docs.credibledata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI-Assisted Modeling

> Build semantic models with the Credible AI agent in Cursor

The fastest way to build a semantic model is with the Cursor agent. The Credible Extension equips the agent with MCP tools to discover your data, modeling skills to guide best practices, and Malloy-aware rules — so it can analyze your data sources and generate a comprehensive model with sources, joins, dimensions, and measures.

<Note>
  **New to semantic modeling?** See [What is a Semantic Layer?](/concepts/semantic-layer) to understand the concepts, or the [Malloy Language Documentation](https://docs.malloydata.dev/documentation/) for language details.
</Note>

## Prerequisites

* **Cursor with Credible extension** configured — See [Set Up Your IDE](/how-to/modeling/ide-setup)
* **Database connection** established — See [Connect a Database](/how-to/modeling/connect-data)

The agent only knows about your data after the connection is indexed — this is configured when you [set up the connection](/how-to/modeling/connect-data#table-limits-for-ai-assisted-modeling). Indexing can take some time, so if the agent doesn't have data for a new connection, wait a few minutes and verify you're within the [table limits](/how-to/modeling/connect-data#table-limits-for-ai-assisted-modeling).

## Build a Model with the Agent

1. **Open Cursor's agent chat** and describe what you want to model. Be specific about your data and analysis goals:

   * *"Build a model of my ecommerce data so I can analyze sales by product and brand"*
   * *"Create a semantic model for customer analytics including lifetime value"*
   * *"Model the orders table with customer and product relationships"*

2. **The agent discovers your data** — Using its MCP tools, the agent explores your available tables and schemas, then generates a `.malloy` file with sources, joins, dimensions, measures, and views. The extension's skills and rules guide the agent to follow Malloy best practices automatically.

3. **Review the generated model** in your editor and approve the changes.

The agent will create:

* **Sources** connected to your tables
* **Joins** between related tables
* **Dimensions** for grouping and filtering
* **Measures** for calculations and aggregations
* **Views** for common analysis patterns

## Working with the Agent

Beyond initial model creation, the agent can help with a range of modeling workflows:

* **Build and modify models** — Generate sources, joins, dimensions, and measures, or refine existing ones
* **Explore available data** — Discover tables and schemas in your connected databases
* **Fix compile errors** — Diagnose and fix Malloy syntax errors
* **Create interactive dashboards** — Build `.malloynb` notebooks with visualizations and filters
* **Document your model** — Add `#(doc)` and `#(index)` tags for AI discoverability. These tags are what the [Credible Context Engine](/concepts/context-engine) searches against during analysis — good documentation directly improves the quality of chat-based analysis downstream
* **Publish** — Type `/credible-publish` in the agent chat to publish your model to the Credible service
* **Learn Malloy** — Ask the agent questions about the Malloy language (e.g., *"How do I write date filters in Malloy?"*)

## Validate as You Build

Use the buttons above each source definition to validate your model:

* **Schema** — View the compiled structure of your source
* **Explore** — Open the [Explorer](https://docs.malloydata.dev/documentation/user_guides/publishing/explorer) to interactively query
* **Preview** — Quick data preview to verify connections

## Next Steps

<CardGroup cols={2}>
  <Card title="Add Metadata" icon="tags" color="#988962" href="/how-to/modeling/metadata-tags">
    Document your model for humans and AI discovery
  </Card>

  <Card title="Publish Your Model" icon="rocket" color="#628698" href="/how-to/modeling/publishing">
    Make your model available across the platform
  </Card>
</CardGroup>
