This cookbook walks through building a complete, working agent end to end in Lyzr Studio that can answer natural-language questions directly against a real database — no SQL knowledge required from the end user.Example used throughout: a Sales Analytics Agent for an e-commerce store. It connects to the store’s own orders/customers/products database and answers questions like “What were total sales last month?” or “Who are our top 5 customers by revenue?” by translating them into database queries behind the scenes.
Before you start
You’ll need:
Connection details for a real database (host, port, username, password, database name) — e.g. a PostgreSQL or MySQL instance containing your orders, customers, and products tables.
Read access to that database from wherever Lyzr Studio’s backend runs.
Part 1 — Connect your database
Sidebar → Configure → Data Connectors.
Click the Database tab.
Find your database type’s card (e.g. PostgreSQL) and click its + icon.
A panel titled “Connect Database” opens. Fill in:
Unique Name(required) — a name for this connection, e.g. “Ecommerce Sales DB”
The provider-specific fields — typically Host, Port, User, Password, and the database name (exact fields vary slightly by provider, since they’re generated from that provider’s own schema)
Click Submit.
Your database is now available to attach to a knowledge base.
Part 2 — Build the Semantic Data Model knowledge base
2a. Create the knowledge base shell
Sidebar → Knowledge Bases.
Click New ▾ → choose Semantic Data Model.
In the “Create Knowledge Base” panel, fill in:
Name(required) — lowercase letters, numbers, and underscores only, e.g. ecommerce_sales_analytics
Description(optional) — e.g. “Orders, customers, and products database for sales Q&A”
Vector Store / LLM Embedding Model — leave the pre-filled defaults
A Database Configuration section appears with two more required fields:
Database — select the connection you created in Part 1 (e.g. “Ecommerce Sales DB”). (If none show up, there’s a “Configure New Database” link here that jumps straight to Data Connectors.)
Documentation Agent — this is a small helper agent that reads your database schema and writes plain-English descriptions of each table and column. Click Create New to set one up (see 2b), or pick an existing one from the dropdown if you already have one.
Click Create Knowledge Base.
2b. Create the Documentation Agent (if you don’t have one yet)
Clicking “Create New” above opens a small dialog titled “Schema Documentation Agent”:
Name(required) — e.g. “Sales DB Documentation Agent”
Model — pick an LLM provider and model (defaults to OpenAI / gpt-5-mini; click “Need help choosing?” if unsure)
Temperature (default 0.7) and Top P (default 0.9) — sliders, safe to leave at defaults
Click Submit.
2c. Document and add each table
After creating the knowledge base, you land on a screen listing every table found in your connected database, with columns Table Name, Status (Added / Not Added), and a Configure → button per row.For each table you want the agent to be able to query (e.g. orders, customers, products):
Click Configure → next to that table.
You’ll see a Column Name / Description table. Descriptions are pre-filled automatically by your Documentation Agent — read through them and edit any that are unclear or wrong (they’re plain editable text fields).
(Optional) Click Preview table to see a sample of the actual rows, to sanity-check you’re looking at the right data.
Click Save & Add to Semantic Data Model.
Repeat for every table the agent needs. Once saved, that table’s Status flips to Added back on the table list. You can revisit any added table later and click Remove if you need to take it back out.
Only add the tables actually relevant to the questions you expect — e.g. skip internal/admin tables. Fewer, well-documented tables produce more accurate query generation than dumping in your whole schema.
Part 3 — Build the agent and attach the semantic data model
Sidebar → Agents.
Click New ▾ → choose Agent.
Once in the editor, you’re on the Build tab by default. Fill in:
Name — e.g. “Sales Analytics Agent”
Instructions (system prompt) — e.g. “You help the sales team answer questions about orders, customers, and products using the connected database. Always state numbers precisely and mention the time period covered. If a question can’t be answered from the available tables, say so rather than guessing.”
In the right-hand settings, open the Features section and find “Data Query” (under Core Features, described “Answers questions instantly by querying and reading data from your data source”). Toggle it on.
This opens a panel titled “Configure Data Query.” Fill in:
Semantic Data Model(required) — select ecommerce_sales_analytics, the one you built in Part 2.
Max tries — leave at the default (3). This is how many times it’ll retry generating a query if the first attempt fails.
Time limit (s) — leave at the default (60).
Auto train agent(optional) — turn this on if you want successful queries saved for future reference; if enabled, pick an Auto Training Knowledge Base to store them in.
Click Save.
(Optional) Configure Model (choose your preferred LLM) — Knowledge, Tools, Automation are not required for this use case.
Click Create (top-right) to save the agent.
Once a Semantic Data Model is selected, a “Configure” link appears right next to its label in this same panel — click it any time to jump straight back into the table/column setup from Part 2c.
Part 4 — Test it in the Playground
Click the Playground tab.
Ask it real questions your database can answer, e.g.:
“What were our total sales last month?”
“Who are our top 5 customers by revenue this year?”
“How many orders came from repeat customers vs. new customers?”
Check the answers against what you know to be true in the underlying data. If something’s off, go back to Part 2c and improve that table’s column descriptions — vague or missing descriptions are the most common cause of wrong query generation — then re-test.
Part 5 — Deploy (optional)
Click the Deploy tab.
Copy the ready-to-use API snippets, or use Share / Publish to make the agent available to teammates or your organization.
Quick checklist
Database connected in Data Connectors, with valid credentials (Part 1)
Semantic Data Model knowledge base created, linked to that database (Part 2a)
Documentation Agent created and generating descriptions (Part 2b)
Each relevant table configured, reviewed, and marked “Added” (Part 2c)
Agent created with clear instructions (Part 3)
Data Query feature enabled, with the Semantic Data Model selected (Part 3)
Tested with real questions in the Playground, descriptions refined as needed (Part 4)
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Lyzr","colors":{"primary":"#FE4B1E","light":"#FE4B1E","dark":"#FE4B1E"},"logo":{"light":"https://mintcdn.com/lyzrinc/xo6QiCPiFJayrrOL/assets/logo/LyzrLight.svg?fit=max\u0026auto=format\u0026n=xo6QiCPiFJayrrOL\u0026q=85\u0026s=b1a96015130a5dc1f7d8ad4b54977270","dark":"https://mintcdn.com/lyzrinc/xo6QiCPiFJayrrOL/assets/logo/LyzrDark.svg?fit=max\u0026auto=format\u0026n=xo6QiCPiFJayrrOL\u0026q=85\u0026s=6ec155f8cfa5b83cf3941d6b10c3e2d9"},"favicon":"https://mintcdn.com/lyzrinc/bGxeLdNqyZVWUWU3/assets/favicon.svg?fit=max\u0026auto=format\u0026n=bGxeLdNqyZVWUWU3\u0026q=85\u0026s=0bf9187f30914304976b0cb77aa263c7","api":{"playground":{"display":"interactive","proxy":false}},"background":{"color":{"light":"#FAFAF9","dark":"#1F2022"}},"navbar":{"links":[{"href":"https://discord.gg/uaHrgJQxAv","label":"Community"}],"primary":{"type":"button","label":"Lyzr Studio","href":"https://studio.lyzr.ai"}},"footer":{"socials":{"twitter":"https://twitter.com/lyzrai","github":"https://github.com/LyzrCore/lyzr","linkedin":"https://www.linkedin.com/company/lyzr-platform"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lyzrinc","hasAudioNarration":false,"actualSubdomain":"lyzrinc","customDomains":["docs.lyzr.ai"],"gitSource":{"type":"github","owner":"lyzrcore","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae802b165136d2de8e54140","clientVersion":"0.0.4128","searchFilterCounts":[{"language":"default","tag":"API Reference","count":136},{"language":"default","tag":"Integrations","count":81},{"language":"default","tag":"Tools","count":60},{"language":"default","tag":"SuperFlow","count":46},{"language":"default","tag":"Architect","count":44},{"language":"default","tag":"Agent Studio","count":43},{"language":"default","tag":"Connectors","count":42},{"language":"default","tag":"Orchestration","count":40},{"language":"default","tag":"ADK","count":29},{"language":"default","tag":"GitAgent","count":23}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"assets/custom.css","content":"/* cyrillic-ext */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZJhiI2B.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZthiI2B.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek-ext */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZNhiI2B.woff2) format('woff2');\n unicode-range: U+1F00-1FFF;\n}\n/* greek */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZxhiI2B.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZBhiI2B.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZFhiI2B.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfAZ9hiA.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--lyzr-orange: #FE4B1E;--lyzr-navy: #043E77;--lyzr-stone: #A8A298;--lyzr-offwhite: #FAFAF9;--lyzr-black: #1F2022;--grey-200: #E3E1DE;--grey-700: #6B675F;--font-sans: \"Aeonik\", \"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif;--font-mono: \"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace}body{font-family:var(--font-sans)!important}code,pre,kbd,samp{font-family:var(--font-mono)!important}h1,h2,h3,h4,h5,h6,#page-title{font-family:var(--font-sans)!important;font-weight:400!important}html:not(.dark) h1,html:not(.dark) h2,html:not(.dark) h3,html:not(.dark) h4,html:not(.dark) #page-title,html:not(.dark) .prose{color:var(--lyzr-black)}h1,#page-title{letter-spacing:-0.035em;line-height:1.05}h2{letter-spacing:-0.025em;line-height:1.15}h3{letter-spacing:-0.01em;line-height:1.4}.sidebar-group-header,.sidebar-group-header .sidebar-title,.eyebrow{font-family:var(--font-mono)!important;font-weight:500!important;font-size:12px!important;text-transform:uppercase;letter-spacing:0.06em;color:var(--grey-700)!important}.prose a:not([class*=\"card\"]):not(.not-prose){color:var(--lyzr-black);font-weight:400;border-bottom-color:var(--lyzr-orange);text-decoration-color:var(--lyzr-orange)}html.dark .prose a:not([class*=\"card\"]):not(.not-prose){color:var(--lyzr-orange)}hr,.prose hr{border-color:var(--grey-200)}html.dark hr,html.dark .prose hr{border-color:var(--grey-700)}[class*=\"VersionSelect\"],[class*=\"version-selector\"],[class*=\"versionSwitcher\"],button[data-version],button[aria-label*=\"version\"i],button[aria-label*=\"enterprise\"i],button[aria-label*=\"open source\"i],[data-testid=\"version-select\"],nav button:has(svg.lucide-chevron-down),.version-switcher button,.version-dropdown-trigger{border:1px solid rgba(128, 128, 128, 0.35)!important;border-radius:6px!important;padding:4px 10px 4px 12px!important;font-weight:400!important;gap:6px!important;background:rgba(0, 0, 0, 0.06)!important;transition:background 0.15s, border-color 0.15s!important}[class*=\"VersionSelect\"]:hover,button[data-version]:hover,[data-testid=\"version-select\"]:hover,nav button:has(svg.lucide-chevron-down):hover,.version-dropdown-trigger:hover{background:rgba(0, 0, 0, 0.10)!important;border-color:rgba(128, 128, 128, 0.55)!important}html.dark [class*=\"VersionSelect\"],html.dark [class*=\"version-selector\"],html.dark button[data-version],html.dark [data-testid=\"version-select\"],html.dark nav button:has(svg.lucide-chevron-down),html.dark .version-dropdown-trigger{border-color:rgba(255, 255, 255, 0.25)!important;background:rgba(255, 255, 255, 0.08)!important}html.dark [class*=\"VersionSelect\"]:hover,html.dark button[data-version]:hover,html.dark nav button:has(svg.lucide-chevron-down):hover,html.dark .version-dropdown-trigger:hover{background:rgba(255, 255, 255, 0.13)!important;border-color:rgba(255, 255, 255, 0.4)!important}nav a[href*=\"github.com/LyzrCore\"],nav a[href*=\"github.com/open-gitagent\"],header a[href*=\"github.com/LyzrCore\"],header a[href*=\"github.com/open-gitagent\"],nav a[href*=\"studio.lyzr.ai\"],header a[href*=\"studio.lyzr.ai\"]{display:inline-flex!important;align-items:center!important;gap:0!important;background-color:var(--lyzr-orange)!important;color:var(--lyzr-offwhite)!important;border-radius:6px!important;padding:8px 20px!important;font-size:0.875rem!important;font-weight:400!important;text-decoration:none!important;white-space:nowrap!important;border:none!important;outline:none!important;box-shadow:none!important;overflow:visible!important;transition:background-color 0.15s!important}nav a[href*=\"github.com/LyzrCore\"] svg,nav a[href*=\"github.com/LyzrCore\"] [class*=\"chevron\"],nav a[href*=\"github.com/LyzrCore\"] [class*=\"arrow\"],nav a[href*=\"github.com/LyzrCore\"] [class*=\"icon\"],nav a[href*=\"github.com/LyzrCore\"]::after,nav a[href*=\"github.com/LyzrCore\"]::before,nav a[href*=\"github.com/open-gitagent\"] svg,nav a[href*=\"github.com/open-gitagent\"]::after,header a[href*=\"github.com/LyzrCore\"] svg,header a[href*=\"github.com/LyzrCore\"]::after,header a[href*=\"github.com/open-gitagent\"] svg,header a[href*=\"github.com/open-gitagent\"]::after,nav a[href*=\"studio.lyzr.ai\"] svg,nav a[href*=\"studio.lyzr.ai\"] [class*=\"chevron\"],nav a[href*=\"studio.lyzr.ai\"] [class*=\"arrow\"],nav a[href*=\"studio.lyzr.ai\"] [class*=\"icon\"],nav a[href*=\"studio.lyzr.ai\"]::after,nav a[href*=\"studio.lyzr.ai\"]::before,header a[href*=\"studio.lyzr.ai\"] svg,header a[href*=\"studio.lyzr.ai\"]::after,header a[href*=\"studio.lyzr.ai\"]::before{display:none!important;content:none!important;width:0!important;height:0!important;font-size:0!important}nav a[href*=\"github.com/LyzrCore\"]:hover,nav a[href*=\"github.com/open-gitagent\"]:hover,header a[href*=\"github.com/LyzrCore\"]:hover,nav a[href*=\"studio.lyzr.ai\"]:hover,header a[href*=\"studio.lyzr.ai\"]:hover{background-color:var(--lyzr-black)!important;color:var(--lyzr-offwhite)!important}footer a[href*=\"github.com\"]{background:none!important;background-color:transparent!important;padding:0!important;border-radius:0!important;color:inherit!important;display:inline-flex!important;align-items:center!important;width:20px!important;height:20px!important}footer a[href*=\"github.com\"] svg{display:inline!important;width:20px!important;height:20px!important}footer a[href*=\"studio.lyzr.ai\"],footer a[href*=\"studio.lyzr.ai\"]+*,footer [class*=\"primary\"] a[href*=\"studio.lyzr.ai\"]{display:none!important}html.dark nav a[href*=\"github.com/LyzrCore\"],html.dark nav a[href*=\"github.com/open-gitagent\"],html.dark header a[href*=\"github.com/LyzrCore\"],html.dark header a[href*=\"github.com/open-gitagent\"],html.dark nav a[href*=\"studio.lyzr.ai\"],html.dark header a[href*=\"studio.lyzr.ai\"]{background-color:var(--lyzr-orange)!important;color:var(--lyzr-offwhite)!important;border:none!important;border-radius:6px!important;outline:none!important;box-shadow:none!important;overflow:visible!important}html.dark nav a[href*=\"github.com/LyzrCore\"]:hover,html.dark nav a[href*=\"github.com/open-gitagent\"]:hover,html.dark header a[href*=\"github.com/LyzrCore\"]:hover,html.dark nav a[href*=\"studio.lyzr.ai\"]:hover,html.dark header a[href*=\"studio.lyzr.ai\"]:hover{background-color:var(--lyzr-offwhite)!important;color:var(--lyzr-black)!important}"}],"page":{"pagePath":"enterprise/learn/cookbooks/semantic-data-model-agent","slug":"/enterprise/learn/cookbooks/semantic-data-model-agent","pageMetadata":{"title":"Build an Agent with a Semantic Data Model","sidebarTitle":"Agent Studio - Semantic Data Model","description":null,"href":"/enterprise/learn/cookbooks/semantic-data-model-agent"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,em:`em`,hr:`hr`,input:`input`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Tip}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`This cookbook walks through building a complete, working agent end to end in Lyzr Studio that can answer natural-language questions directly against a real database — no SQL knowledge required from the end user.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Example used throughout:`}),` a `,_jsx(_components.strong,{children:`Sales Analytics Agent`}),` for an e-commerce store. It connects to the store’s own orders/customers/products database and answers questions like `,_jsx(_components.em,{children:`“What were total sales last month?”`}),` or `,_jsx(_components.em,{children:`“Who are our top 5 customers by revenue?”`}),` by translating them into database queries behind the scenes.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-start`,children:`Before you start`}),`\n`,_jsx(_components.p,{children:`You’ll need:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Connection details for a real database (host, port, username, password, database name) — e.g. a PostgreSQL or MySQL instance containing your `,_jsx(_components.code,{children:`orders`}),`, `,_jsx(_components.code,{children:`customers`}),`, and `,_jsx(_components.code,{children:`products`}),` tables.`]}),`\n`,_jsx(_components.li,{children:`Read access to that database from wherever Lyzr Studio’s backend runs.`}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`part-1-—-connect-your-database`,children:`Part 1 — Connect your database`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Sidebar → `,_jsx(_components.strong,{children:`Configure`}),` → `,_jsx(_components.strong,{children:`Data Connectors`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Click the `,_jsx(_components.strong,{children:`Database`}),` tab.`]}),`\n`,_jsxs(_components.li,{children:[`Find your database type’s card (e.g. `,_jsx(_components.strong,{children:`PostgreSQL`}),`) and click its `,_jsx(_components.strong,{children:`+`}),` icon.`]}),`\n`,_jsxs(_components.li,{children:[`A panel titled `,_jsxs(_components.strong,{children:[`“Connect `,` Database”`]}),` opens. Fill in:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Unique Name`}),` `,_jsx(_components.em,{children:`(required)`}),` — a name for this connection, e.g. “Ecommerce Sales DB”`]}),`\n`,_jsxs(_components.li,{children:[`The provider-specific fields — typically `,_jsx(_components.strong,{children:`Host`}),`, `,_jsx(_components.strong,{children:`Port`}),`, `,_jsx(_components.strong,{children:`User`}),`, `,_jsx(_components.strong,{children:`Password`}),`, and the database name (exact fields vary slightly by provider, since they’re generated from that provider’s own schema)`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Submit`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Your database is now available to attach to a knowledge base.`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`part-2-—-build-the-semantic-data-model-knowledge-base`,children:`Part 2 — Build the Semantic Data Model knowledge base`}),`\n`,_jsx(Heading,{level:`3`,id:`2a-create-the-knowledge-base-shell`,children:`2a. Create the knowledge base shell`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Sidebar → `,_jsx(_components.strong,{children:`Knowledge Bases`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`New ▾`}),` → choose `,_jsx(_components.strong,{children:`Semantic Data Model`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`In the `,_jsx(_components.strong,{children:`“Create Knowledge Base”`}),` panel, fill in:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Name`}),` `,_jsx(_components.em,{children:`(required)`}),` — `,_jsx(_components.strong,{children:`lowercase letters, numbers, and underscores only`}),`, e.g. `,_jsx(_components.code,{children:`ecommerce_sales_analytics`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Description`}),` `,_jsx(_components.em,{children:`(optional)`}),` — e.g. “Orders, customers, and products database for sales Q\u0026A”`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Vector Store`}),` / `,_jsx(_components.strong,{children:`LLM Embedding Model`}),` — leave the pre-filled defaults`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.strong,{children:`Database Configuration`}),` section appears with two more required fields:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Database`}),` — select the connection you created in Part 1 (e.g. “Ecommerce Sales DB”). `,_jsx(_components.em,{children:`(If none show up, there’s a “Configure New Database” link here that jumps straight to Data Connectors.)`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Documentation Agent`}),` — this is a small helper agent that reads your database schema and writes plain-English descriptions of each table and column. Click `,_jsx(_components.strong,{children:`Create New`}),` to set one up (see 2b), or pick an existing one from the dropdown if you already have one.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create Knowledge Base`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`2b-create-the-documentation-agent-if-you-don’t-have-one-yet`,children:`2b. Create the Documentation Agent (if you don’t have one yet)`}),`\n`,_jsxs(_components.p,{children:[`Clicking “Create New” above opens a small dialog titled `,_jsx(_components.strong,{children:`“Schema Documentation Agent”`}),`:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Name`}),` `,_jsx(_components.em,{children:`(required)`}),` — e.g. “Sales DB Documentation Agent”`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Model`}),` — pick an LLM provider and model (defaults to OpenAI / gpt-5-mini; click “Need help choosing?” if unsure)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Temperature`}),` (default 0.7) and `,_jsx(_components.strong,{children:`Top P`}),` (default 0.9) — sliders, safe to leave at defaults`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Submit`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`2c-document-and-add-each-table`,children:`2c. Document and add each table`}),`\n`,_jsxs(_components.p,{children:[`After creating the knowledge base, you land on a screen listing every table found in your connected database, with columns `,_jsx(_components.strong,{children:`Table Name`}),`, `,_jsx(_components.strong,{children:`Status`}),` (`,_jsx(_components.strong,{children:`Added`}),` / `,_jsx(_components.strong,{children:`Not Added`}),`), and a `,_jsx(_components.strong,{children:`Configure →`}),` button per row.`]}),`\n`,_jsxs(_components.p,{children:[`For each table you want the agent to be able to query (e.g. `,_jsx(_components.code,{children:`orders`}),`, `,_jsx(_components.code,{children:`customers`}),`, `,_jsx(_components.code,{children:`products`}),`):`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Configure →`}),` next to that table.`]}),`\n`,_jsxs(_components.li,{children:[`You’ll see a `,_jsx(_components.strong,{children:`Column Name`}),` / `,_jsx(_components.strong,{children:`Description`}),` table. Descriptions are pre-filled automatically by your Documentation Agent — read through them and edit any that are unclear or wrong (they’re plain editable text fields).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.em,{children:`(Optional)`}),` Click `,_jsx(_components.strong,{children:`Preview table`}),` to see a sample of the actual rows, to sanity-check you’re looking at the right data.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Save \u0026 Add to Semantic Data Model`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Repeat for every table the agent needs. Once saved, that table’s `,_jsx(_components.strong,{children:`Status`}),` flips to `,_jsx(_components.strong,{children:`Added`}),` back on the table list. You can revisit any added table later and click `,_jsx(_components.strong,{children:`Remove`}),` if you need to take it back out.`]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Only add the tables actually relevant to the questions you expect — e.g. skip internal/admin tables. Fewer, well-documented tables produce more accurate query generation than dumping in your whole schema.`})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`part-3-—-build-the-agent-and-attach-the-semantic-data-model`,children:`Part 3 — Build the agent and attach the semantic data model`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Sidebar → `,_jsx(_components.strong,{children:`Agents`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`New ▾`}),` → choose `,_jsx(_components.strong,{children:`Agent`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Once in the editor, you’re on the `,_jsx(_components.strong,{children:`Build`}),` tab by default. Fill in:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Name`}),` — e.g. “Sales Analytics Agent”`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Instructions`}),` (system prompt) — e.g. “You help the sales team answer questions about orders, customers, and products using the connected database. Always state numbers precisely and mention the time period covered. If a question can’t be answered from the available tables, say so rather than guessing.”`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`In the right-hand settings, open the `,_jsx(_components.strong,{children:`Features`}),` section and find `,_jsx(_components.strong,{children:`“Data Query”`}),` (under Core Features, described `,_jsx(_components.em,{children:`“Answers questions instantly by querying and reading data from your data source”`}),`). Toggle it on.`]}),`\n`,_jsxs(_components.li,{children:[`This opens a panel titled `,_jsx(_components.strong,{children:`“Configure Data Query.”`}),` Fill in:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Semantic Data Model`}),` `,_jsx(_components.em,{children:`(required)`}),` — select `,_jsx(_components.strong,{children:`ecommerce_sales_analytics`}),`, the one you built in Part 2.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Max tries`}),` — leave at the default (3). This is how many times it’ll retry generating a query if the first attempt fails.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Time limit (s)`}),` — leave at the default (60).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Auto train agent`}),` `,_jsx(_components.em,{children:`(optional)`}),` — turn this on if you want successful queries saved for future reference; if enabled, pick an `,_jsx(_components.strong,{children:`Auto Training Knowledge Base`}),` to store them in.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Save`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.em,{children:`(Optional)`}),` Configure `,_jsx(_components.strong,{children:`Model`}),` (choose your preferred LLM) — Knowledge, Tools, Automation are not required for this use case.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create`}),` (top-right) to save the agent.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Once a Semantic Data Model is selected, a `,_jsx(_components.strong,{children:`“Configure”`}),` link appears right next to its label in this same panel — click it any time to jump straight back into the table/column setup from Part 2c.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`part-4-—-test-it-in-the-playground`,children:`Part 4 — Test it in the Playground`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Click the `,_jsx(_components.strong,{children:`Playground`}),` tab.`]}),`\n`,_jsxs(_components.li,{children:[`Ask it real questions your database can answer, e.g.:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.em,{children:`“What were our total sales last month?”`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.em,{children:`“Who are our top 5 customers by revenue this year?”`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.em,{children:`“How many orders came from repeat customers vs. new customers?”`})}),`\n`]}),`\n`]}),`\n`,_jsx(_components.li,{children:`Check the answers against what you know to be true in the underlying data. If something’s off, go back to Part 2c and improve that table’s column descriptions — vague or missing descriptions are the most common cause of wrong query generation — then re-test.`}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`part-5-—-deploy-optional`,children:`Part 5 — Deploy (optional)`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Click the `,_jsx(_components.strong,{children:`Deploy`}),` tab.`]}),`\n`,_jsxs(_components.li,{children:[`Copy the ready-to-use API snippets, or use `,_jsx(_components.strong,{children:`Share / Publish`}),` to make the agent available to teammates or your organization.`]}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`quick-checklist`,children:`Quick checklist`}),`\n`,_jsxs(_components.ul,{className:`contains-task-list`,children:[`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Database connected in Data Connectors, with valid credentials (Part 1)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Semantic Data Model knowledge base created, linked to that database (Part 2a)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Documentation Agent created and generating descriptions (Part 2b)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Each relevant table configured, reviewed, and marked “Added” (Part 2c)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Agent created with clear instructions (Part 3)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Data Query feature enabled, with the Semantic Data Model selected (Part 3)`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,`Tested with real questions in the Playground, descriptions refined as needed (Part 4)`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Build an Agent with a Semantic Data Model","sidebarTitle":"Agent Studio - Semantic Data Model","description":null,"href":"/enterprise/learn/cookbooks/semantic-data-model-agent"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Before you start","slug":"before-you-start","depth":2,"children":[]},{"title":"Part 1 — Connect your database","slug":"part-1-—-connect-your-database","depth":2,"children":[]},{"title":"Part 2 — Build the Semantic Data Model knowledge base","slug":"part-2-—-build-the-semantic-data-model-knowledge-base","depth":2,"children":[{"title":"2a. Create the knowledge base shell","slug":"2a-create-the-knowledge-base-shell","depth":3,"children":[]},{"title":"2b. Create the Documentation Agent (if you don’t have one yet)","slug":"2b-create-the-documentation-agent-if-you-don’t-have-one-yet","depth":3,"children":[]},{"title":"2c. Document and add each table","slug":"2c-document-and-add-each-table","depth":3,"children":[]}]},{"title":"Part 3 — Build the agent and attach the semantic data model","slug":"part-3-—-build-the-agent-and-attach-the-semantic-data-model","depth":2,"children":[]},{"title":"Part 4 — Test it in the Playground","slug":"part-4-—-test-it-in-the-playground","depth":2,"children":[]},{"title":"Part 5 — Deploy (optional)","slug":"part-5-—-deploy-optional","depth":2,"children":[]},{"title":"Quick checklist","slug":"quick-checklist","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/lyzrinc/096864f58d0733b3/assets/custom.js"],"subdomain":"lyzrinc","siteName":"Lyzr","title":"Build an Agent with a Semantic Data Model - Lyzr","navMaps":{"firstHrefInVersion":{"Enterprise":{"href":"/enterprise/learn/cookbooks/semantic-data-model-agent","matchLevel":0},"Open-Source":{"href":"/open-source/opengap/overview","matchLevel":4}},"firstHrefInLanguage":{}},"lastModified":"2026-10-30T05:23:19.570Z","originalFileLocation":"enterprise/learn/cookbooks/semantic-data-model-agent.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Lyzr\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Build an Agent with a Semantic Data Model - Lyzr\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Lyzr\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lyzrinc.mintlify.site/_mintlify/api/og/v2?division=Lyzr+Studio\u0026amp;title=Build+an+Agent+with+a+Semantic+Data+Model\u0026amp;theme=97bf7c32ac91c729058827c5\u0026amp;signature=fef0082a7db35572730281922a57c6ae4a87bd55a57bd61783ededa45c562657\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Build an Agent with a Semantic Data Model - Lyzr\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lyzrinc.mintlify.site/_mintlify/api/og/v2?division=Lyzr+Studio\u0026amp;title=Build+an+Agent+with+a+Semantic+Data+Model\u0026amp;theme=97bf7c32ac91c729058827c5\u0026amp;signature=fef0082a7db35572730281922a57c6ae4a87bd55a57bd61783ededa45c562657\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lyzrinc/hXsNM-nAiiGh29-D/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Lyzr\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FE4B1E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/enterprise/learn/cookbooks/semantic-data-model-agent.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lyzr.ai/#organization\",\"name\":\"Lyzr\",\"url\":\"https://docs.lyzr.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lyzrinc/xo6QiCPiFJayrrOL/assets/logo/LyzrLight.svg?fit=max\u0026auto=format\u0026n=xo6QiCPiFJayrrOL\u0026q=85\u0026s=b1a96015130a5dc1f7d8ad4b54977270\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lyzr.ai#website\",\"name\":\"Lyzr\",\"url\":\"https://docs.lyzr.ai\",\"publisher\":{\"@id\":\"https://docs.lyzr.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent#webpage\",\"url\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent\",\"name\":\"Build an Agent with a Semantic Data Model\",\"dateModified\":\"2026-10-30T05:23:19.570Z\",\"isPartOf\":{\"@id\":\"https://docs.lyzr.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Cookbooks\",\"item\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/voice-agent-knowledge-base\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lyzr Studio\",\"item\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/voice-agent-knowledge-base\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Build an Agent with a Semantic Data Model\",\"item\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent#article\",\"headline\":\"Build an Agent with a Semantic Data Model\",\"name\":\"Build an Agent with a Semantic Data Model\",\"url\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lyzr.ai/enterprise/learn/cookbooks/semantic-data-model-agent#webpage\"},\"dateModified\":\"2026-10-30T05:23:19.570Z\",\"publisher\":{\"@id\":\"https://docs.lyzr.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lyzr.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Lyzr\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Lyzr\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/enterprise/learn/cookbooks/semantic-data-model-agent.md","siteName":"Lyzr","nav":{"global":null,"versions":[{"version":"Enterprise","tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/enterprise/get-started/intro"}]},{"tab":"Agent Studio","pages":[{"title":"Agent Studio","href":"/enterprise/agent-studio/introduction"}]},{"tab":"Architect","pages":[{"title":"Architect","href":"/enterprise/architect/introduction/overview/introduction"}]},{"tab":"Lyzr Blocks","pages":[{"title":"Lyzr Blocks","href":"/enterprise/lyzr-blocks/overview"}]},{"tab":"ADK","pages":[{"title":"ADK","href":"/enterprise/adk/overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/enterprise/api/agents/introduction"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/enterprise/integrations/overview"}]},{"tab":"Learn","groups":[{"group":"Overview","pages":[{"title":"Learn","href":"/enterprise/learn/overview"}]},{"group":"Cookbooks","pages":[{"group":"Lyzr Studio","pages":[{"title":"Build a Voice Agent with a Knowledge Base","sidebarTitle":"Agent Studio - Voice Agent + KB","description":null,"href":"/enterprise/learn/cookbooks/voice-agent-knowledge-base"},{"title":"Build an Agent with a Semantic Data Model","sidebarTitle":"Agent Studio - Semantic Data Model","href":"/enterprise/learn/cookbooks/semantic-data-model-agent"},{"title":"Build a SuperFlow: Smart Support Ticket Triage with Human-Approved Escalation","sidebarTitle":"SuperFlow - Support Triage","description":null,"href":"/enterprise/learn/cookbooks/superflow-support-triage"}]},{"title":"Choosing the Right Model for Your Use Case","sidebarTitle":"Lyzr - Product Guide","href":"/enterprise/learn/cookbooks/choosing-model"},{"title":"Lyzr - NANDA MCP Server Cookbook","sidebarTitle":"Lyzr - NANDA","href":"/enterprise/learn/cookbooks/lyzr-nanda"},{"title":"Lyzr - Software Manager","href":"/enterprise/learn/cookbooks/software-manager"},{"title":"Product Support Chatbot that Reads 100+ Web Pages","sidebarTitle":"Lyzr - Product Chatbot","href":"/enterprise/learn/cookbooks/product-support-chatbot"},{"title":"Compliance Advisor Bot","sidebarTitle":"Lyzr - Responsible AI","href":"/enterprise/learn/cookbooks/responsible-ai"},{"title":null,"href":"/enterprise/learn/cookbooks/tooling"},{"title":null,"href":"/enterprise/learn/cookbooks/ms-teams"},{"title":null,"href":"/enterprise/learn/cookbooks/slack"},{"title":null,"href":"/enterprise/learn/cookbooks/telegram"}]},{"group":"Support","pages":[{"title":"FAQs","sidebarTitle":"FAQs","href":"/enterprise/learn/support/faqs"},{"title":"Getting Support","sidebarTitle":"Need Help?","href":"/enterprise/learn/support/contact"}]},{"group":"Community","pages":[{"title":"Join the Lyzr Community","sidebarTitle":"Join Us","href":"/enterprise/learn/community/join"}]}]}]},{"version":"Open-Source","pages":[{"title":"Open-Source","href":"/open-source/opengap/overview"}]}]},"basePath":"","title":"Build an Agent with a Semantic Data Model - Lyzr","buildId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","deploymentId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","dynamics":[],"chunks":[]}