New to semantic modeling? See What is a Semantic Layer? to understand the concepts, or the Malloy Language Documentation for language details.
Prerequisites
- Cursor with Credible extension configured — See Set Up Your IDE
- Database connection established — See Connect a Database
Build a Model with the Agent
-
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”
-
The agent discovers your data — Using its MCP tools, the agent explores your available tables and schemas, then generates a
.malloyfile with sources, joins, dimensions, measures, and views. The extension’s skills and rules guide the agent to follow Malloy best practices automatically. - Review the generated model in your editor and approve the changes.
- 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
.malloynbnotebooks with visualizations and filters - Document your model — Add
#(doc)and#(index_values)tags for AI discoverability. These tags are what the Credible Context Engine searches against during analysis — good documentation directly improves the quality of chat-based analysis downstream - Publish — Type
/credible-publishin 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 to interactively query
- Preview — Quick data preview to verify connections