Build a Model

Step-by-step guide to building a Malloy data model with the agent, in the Credible App or with your own coding agent, reviewing it against your data and publishing it, and how to fix common problems

You build a data model in a conversation with the agent, in the Credible App or with your own coding agent. The steps are the same in both; Model Your Data explains the two and how to set each up. Moving from Looker, Power BI or another BI tool? Start with Migrate to Credible.

Prerequisites

  • A Credible account in an organization. Every account has a personal workspace to start in.
  • Modeling access to an environment: the Admin or Modeler role on it. See Environments and Packages.
  • Data to model: a connection in the environment with searchable tables, or a file to upload. In the app, if there's none, the agent opens a connection form in the chat (credentials go straight to Credible; the agent never sees them), or you can start with sample data.
  • With your coding agent: a directory set up with cred init. See Cred CLI.

Build the Model

Start a chat in the Credible App, or open your coding agent in the directory. Then:

  1. Describe the outcome. Say what the model is for and who will use it, then give the agent something to build to: the questions it must answer; numbers you already know are right ("Q3 revenue was $4.2M"), so the draft can be checked against them; constraints ("our fiscal year starts in February", "exclude test accounts").
  2. Add your context. Tell the agent what your data means: how each metric is defined, the business rules, which tables to trust, what the codes in a column stand for. In the app, paste it into the chat. A coding agent can also read the files and tools where your definitions already live, such as a semantic layer, a data catalog or internal docs. The agent writes it into the model as field descriptions and measure definitions, so it stays with the data.
  3. Review the agent's proposal. The agent explores the schema and samples the data, then proposes which tables to include, how they join, and which dimensions and measures to define. Confirm or correct each point in plain language.
  4. Let the agent write the draft. The agent writes the Malloy files, into a draft package in the app or into your directory with your coding agent, with a #(doc) description on each field it defines and #(index) on dimensions where it helps discovery. It compiles the model on every edit and runs queries against your data so you see real results at each step.
  5. Review before publishing. Ask the agent to summarize the model's sources, measures and assumptions, and to check them against the numbers you gave it. It can also propose which sources to export and which fields to hide (see Exports and Field Visibility) and access rules (see Row and Column Access).
  6. Publish. Ask the agent to publish. Each publish creates a new version of the package: in the app the agent publishes the whole draft, and with your coding agent it runs cred publish from the directory. It reports any warnings and offers to fix them. In a git-backed environment, publishing opens a pull request instead, and the version is published when it merges.

To change a published model, ask the agent for the change. In the app it starts a new draft from the published version.

After Publishing

  • Credible builds the version's search indexes and any materialized tables. With auto-promote on, the default for new packages, the version becomes the package's latest when it is ready. See What Happens When You Publish.
  • Keep going with the agent: ask questions of the published model, or ask for a first report or a data app.
  • Share it. In the app, the agent opens a sharing panel where you choose which people and groups get access. See Permissions.
  • Query it from Claude, ChatGPT or another MCP client: see Chat Clients.

Troubleshooting

ProblemCauseFix
The agent can't find a tableThe table is not indexed yet, or not marked searchable on the connectionWait for indexing to finish, then check the connection's searchable tables
The publish is refused because of publisher.jsonThe draft is not one package with one publisher.json at its rootAsk the agent to fix the manifest; the refusal says what is wrong
The publish is refused because the draft changedSomeone else, or another chat, edited the draft after the publish startedReview the draft and publish again
A build failed after publishingA table or index in the new version could not be builtOpen the package page's Builds section to see which one failed, fix the model and publish again, or rebuild from there. See Builds and Refreshes
An AI agent over MCP returns nothing for the new versionThe version's indexing hasn't finished. Search over a version works after it doesWait for indexing to finish. Queries work right after publishing

Next Steps

On this page