{"id":9937,"date":"2025-05-27T11:19:25","date_gmt":"2025-05-27T18:19:25","guid":{"rendered":"https:\/\/www.salesforce.com\/?p=9937"},"modified":"2025-08-08T22:24:57","modified_gmt":"2025-08-08T14:24:57","slug":"text-to-sql-agent","status":"publish","type":"post","link":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/","title":{"rendered":"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data"},"content":{"rendered":"\n<p>If you\u2019ve worked with data products in the world before AI data analysis, you know the drill: a project manager or analyst has an important question, but getting the answer means using Structured Query Language (SQL), a language for querying databases. Without innovative tools like a text-to-SQL Slack agent, engineers and data scientists become gatekeepers to the data, since many teams don\u2019t have the technical knowledge to work with SQL.<\/p>\n\n\n\n<p>This creates a <strong>data access gap<\/strong>. Non-technical people have questions, but not answers, and decisions slow down due to a backlog of support requests. (Even worse, people start making decisions using old data or best guesses.) Engineers and data scientists spend their time writing queries and fetching data instead of building high-value features.<\/p>\n\n\n\n<p>This gap prevented us from scaling.<\/p>\n\n\n\n<p>Business Intelligence dashboards in products like <a href=\"https:\/\/www.tableau.com\/why-tableau\">Tableau<\/a> can narrow this gap, but these dashboards take engineering time to build and they rarely cover every question a user might have.<\/p>\n\n\n\n<p>Our team asked: <strong>What if our users could ask natural-language questions and get insights from the data immediately, without waiting for technologists?<\/strong><\/p>\n\n\n\n<p>That vision of democratised access to instant answers \u2013 combined with advancements in AI tools like <a href=\"https:\/\/www.salesforce.com\/artificial-intelligence\/what-are-large-language-models\/\">large language models<\/a> \u2013 led to a new relationship between our users and the data.<\/p>\n\n\n\n<div class=\"layout-one wp-block-salesforce-blog-offer\">\n\t<div class=\"wp-block-offer__wrapper\">\n\n\t\t<div class=\"wp-block-offer__content\">\n\t\t\t<h2 class=\"wp-block-offer__title\">Say hello to Data Cloud<\/h2>\n\t\t\t\t\t\t\t<p class=\"wp-block-offer__description\">Data Cloud, the hyperscale data platform built into Salesforce, unlocks and harmonises data from any system \u2014 so you can better understand your customers and grow your business.<\/p>\n\t\t\t\n\t\t\t\n\t\t\t\t\t\t\t<div class=\"wp-block-button\">\n\t\t\t\t\t<a class=\"wp-block-button__link\" target=\"_blank\" href=\"https:\/\/www.salesforce.com\/ap\/data\/\">Take a closer look<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"wp-block-offer__media\">\n\t\t\t\t\t<\/div>\n\t<\/div>\n\n\t\t\t<div class=\"wp-block-offer__graphics wp-block-offer__contour\"><\/div>\n\t\n\t\t\t<!-- Standard Illustration -->\n\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__illustration\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-illustration-layout-one.png\" alt=\"\">\n\n\t\t<!-- Small Accent Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__accent\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-accent-layout-one.png\" alt=\"\">\n\t\t\n\t\t<!-- Left Side Illustration -->\n\t\t\n\t\t<!-- Cloud Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__cloud\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-cloud-layout-one.png\" alt=\"\">\n\t\t\n\t<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-closing-the-gap-with-ai-data-analysis\">Closing the gap with AI data analysis<\/h2>\n\n\n\n<p>To close this gap, we needed to rethink how our users got insight from our data. SQL is incredible as a structured syntax for accessing data, but it\u2019s not how most people think or express themselves. It\u2019s literally like learning another language. Not everyone in our company should have to learn it to get their jobs done.<\/p>\n\n\n\n<p>But advancements in Large Language Models have made it possible for machines to understand natural language questions and generate SQL with surprising accuracy. Users can simply ask, <em>\u201cHow much did my service cost last month?\u201d<\/em> and an <a href=\"https:\/\/www.salesforce.com\/ap\/agentforce\/what-are-ai-agents\/\">AI agent<\/a> can look at the database tables and generate a SQL query that provides the answer.<\/p>\n\n\n\n<p>This approach democratises data: Non-technical users can ask their questions in plain English and get real-time insights without hopping over to a business intelligence tool and drilling through filters or waiting in a support channel for an engineer.<br><br>And here at Salesforce, our users live in <a href=\"https:\/\/slack.com\/resources\/why-use-slack\/what-is-slack-and-how-does-it-work\">Slack<\/a>. They want to be able to ask questions about data without switching tools. In addition to supporting collaboration through threaded conversations and offering a searchable history for easy access to past insights, Slack also provides the interactive elements (buttons, list menus, etc) needed for a fully-featured application. As a result, choosing Slack as the medium for this natural-language experience was an easy decision.\u00a0<\/p>\n\n\n\n<p>With the concept of AI data analysis clear, we set out to build our solution: an internal text-to-SQL Slack agent, which we call <strong>Horizon Agent<\/strong>. The goal? To make it easy for people to use Slack to ask data questions in everyday language and instantly get back the SQL, the answer, and the context they need to make confident decisions \u2013 right in the flow of their work.<\/p>\n\n\n\n<p>Horizon Agent isn\u2019t something we sell \u2013 it\u2019s an internal tool we built to help our own teams move faster. If you\u2019re looking for ways to close the data access gap in your organisation, Salesforce offers external solutions like <a href=\"https:\/\/www.salesforce.com\/ap\/agentforce\/\">Agentforce<\/a> and <a href=\"https:\/\/www.salesforce.com\/ap\/data\/\">Data Cloud<\/a>, which help teams turn natural language into action and unlock insights from data at scale.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-lessons-from-building-a-text-to-sql-slack-agent\"><strong>Lessons from building a text-to-SQL Slack agent<\/strong><\/h2>\n\n\n\n<p>Here\u2019s a look at how we built Horizon Agent using Slack and a mix of internal Salesforce tech. We\u2019ll also share what we learned along the way.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-tech-stack-and-architecture\">Tech stack and architecture<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-ux\">UX<\/h4>\n\n\n\n<p>We built the Slack app using Bolt, Slack\u2019s Python framework for app development. This framework handles Slack API interactions and lets you focus on the real business value. When a user messages our Horizon Agent app in Slack, Slack makes a call to our Python microservice in AWS and Bolt lets us handle the call easily.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-business-context\">Business context<\/h4>\n\n\n\n<p>We loaded all our business context and SME knowledge into Fack, an open-source tool created by Salesforce. This gave us an encyclopedia of Salesforce terms, concepts, ideas, and business jargon, as well as instructions about how to construct valid SQL queries using the Trino dialect.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-dataset-information\">Dataset information<\/h4>\n\n\n\n<p>The Horizon Data Platform is our internal data platform product, similar to industry equivalents like Data Build Tool (dbt). Using HDP, we document the business use of a database table and sample SQL queries that demonstrate access patterns for the data. HDP enriches this metadata with sample records from the table so that a Large Language Model (LLM) can see examples of real data.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-einstein\">Einstein<\/h4>\n\n\n\n<p>The Einstein Gateway is Salesforce\u2019s internal platform for accessing LLMs. When our microservice receives a user\u2019s question, it uses <a href=\"https:\/\/www.salesforce.com\/ap\/agentforce\/what-is-rag\/\">Retrieval-Augmented Generation<\/a> (RAG) to enrich the user\u2019s question with business context from Fack and dataset information from Horizon Data Platform. All that knowledge is bundled together and passed to a LLM through the Einstein Gateway, and we get our response back.<\/p>\n\n\n\n<div class=\"layout-four wp-block-salesforce-blog-offer\">\n\t<div class=\"wp-block-offer__wrapper\">\n\n\t\t<div class=\"wp-block-offer__content\">\n\t\t\t<h2 class=\"wp-block-offer__title\">Boost your productivity and ROI with LLMs<\/h2>\n\t\t\t\t\t\t\t<p class=\"wp-block-offer__description\">Large language models (LLMs) underpin the growth of generative AI. See how they work, how they&#8217;re being used, and why they matter for your business.<\/p>\n\t\t\t\n\t\t\t\n\t\t\t\t\t\t\t<div class=\"wp-block-button\">\n\t\t\t\t\t<a class=\"wp-block-button__link\" target=\"_self\" href=\"https:\/\/www.salesforce.com\/ap\/artificial-intelligence\/what-are-large-language-models\/\">Deepen your understanding<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"wp-block-offer__media\">\n\t\t\t\t\t<\/div>\n\t<\/div>\n\n\t\n\t\t\t<!-- Standard Illustration -->\n\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__illustration\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-illustration-layout-four.png\" alt=\"\">\n\n\t\t<!-- Small Accent Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__accent\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-accent-layout-four.png\" alt=\"\">\n\t\t\n\t\t<!-- Left Side Illustration -->\n\t\t\n\t\t<!-- Cloud Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__cloud\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-cloud-layout-four.png\" alt=\"\">\n\t\t\n\t<\/div>\n\n\n\n<p>To put it all together, here\u2019s an example interaction with Horizon Agent:<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e88be521edc&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e88be521edc\" class=\"wp-block-image wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfiooLhqxQ3j8i1JOr4MsV2iDodxVcxTVpAIb-lrkLt4ZF6cAY-T-MiEFekaHGCyBbdcHAbPz4BD29wxpn8hYdS-o_aOBbyH-gzNrUd0i7Znec5UW-MWgBEcvM2MAqETfvglUs?key=PbuGmy7gNCRu8qSHWUxbVuO5\" alt=\"\"\/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>The user asks a question in Slack.<\/strong> (e.g. <em>\u201cHey @Horizon, what was the cost of my service in September?\u201d<\/em>)<br><\/li>\n\n\n\n<li><strong>Our Bolt-based Python microservice receives the message<\/strong> and uses an LLM through Einstein to identify the message as a cost-related question.<br><\/li>\n\n\n\n<li><strong>The app retrieves business context and dataset information <\/strong>from Fack and Horizon Data Platform to supplement the user\u2019s question with everything an LLM needs to answer the question.<br><\/li>\n\n\n\n<li><strong>The app uses the Einstein Gateway <\/strong>to submit the enriched user question to an LLM, which processes the question and returns a SQL query, as well as an explanation of the query that increases our users\u2019 trust in the answer.<br><\/li>\n\n\n\n<li><strong>The user receives the answer in Slack <\/strong>within a few seconds. The user can ask follow-up questions, like <em>\u201cCan you break the cost out by AWS service?\u201d<\/em> and Horizon Agent will continue the conversation with all of the context of previous messages.<br><\/li>\n\n\n\n<li><strong>The user can also run the query<\/strong>, in which case our app executes the SQL query using Trino, retrieves the data from our Iceberg data lake, and posts that data back to Slack with an analysis of the major features of the data \u2013 summary, patterns, trends, anomalies, etc.<\/li>\n<\/ol>\n\n\n\n<div class=\"layout-astro wp-block-salesforce-blog-related-trail\">\n\n\t<img decoding=\"async\" class=\"related-trail__illustration related-trail__cloud\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/related-trail-cloud-layout-astro.png\" alt=\"\">\n\n\t\n\t<img decoding=\"async\" class=\"related-trail__illustration related-trail__background\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/related-trail-background-layout-astro.png\" alt=\"\">\n\n\t<div class=\"related-trail__wrapper\">\n\t\t<div class=\"related-trail__content\">\n\t\t\t\n<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 345.8 82.8\" aria-hidden=\"true\" class=\"related-trail__logo\"><path fill=\"#1d3767\" d=\"M96.6 33h9v22.6h4.8V33h8.8v-4.3H96.6zm49.8 5.3c0-5.7-3.6-9.6-10.8-9.6H127v27h4.8v-7.9h3l2.3-.1 5.7 8h5.6l-7-9.2c3.4-1.6 5-4.5 5-8.2m-11.1 5.3h-3.6V33h3.6c4.4 0 6 2.3 6 5.3s-1.6 5.3-6 5.3m30.8-15.2-12.6 27.2h5l2.3-5.3h11.6l2.4 5.3h5l-12.6-27.1zm-3.6 18 4.1-9.2 4.1 9.3zm25.2-17.7h4.8v27h-4.8zm20.7 0h-4.8v27h17.6v-4.4h-12.8zm38.4 12.1h-13.2V28.7H229v27h4.7V45h13.2v10.6h4.7V28.7h-4.7zm15.9 14.8h17.5v-4.4h-12.7v-6.4H279v-4.2h-11.5v-7.5h12.7v-4.4h-17.5zm36.9-27.2L287 55.6h5l2.3-5.3H306l2.4 5.3h5l-12.6-27.1zm-3.6 18 4.1-9.2 4.1 9.3zm35.4-17.7h-10.2v27h10.2c8.2 0 14.4-5.9 14.4-13.6s-6-13.4-14.4-13.4m0 22.6H326V33h5.4a9.1 9.1 0 1 1 0 18.1z\" \/><path fill=\"#1d315f\" d=\"M43 82.8h.1a74 74 0 0 0 38.5-12.3 3 3 0 0 0 1.3-2.4v-6A66.2 66.2 0 0 0 42.5.2a3 3 0 0 0-2.3 0A66.2 66.2 0 0 0 0 62.2V68a3 3 0 0 0 1.2 2.4 74 74 0 0 0 40.2 12.4z\" \/><path fill=\"#8ed1f4\" d=\"M13.8 51.8a.3.3 0 0 0 0-.1L33 23.6a3.1 3.1 0 0 1 .8-.8 3 3 0 0 1 4 .8l9.5 13.8 3.5-5a3 3 0 0 1 4.9 0L69 51.6a.3.3 0 0 1 .1.3h7C70.7 17.7 43.7 7.2 41.4 6.2c0 0-11.2 4-21.2 16A59.6 59.6 0 0 0 6.8 51.8zm21.7-21.3\" \/><path fill=\"#aa76b3\" d=\"m62 51.9-8.7-12.6-4.2 6.1 4.8 6.4z\" \/><path fill=\"#722a87\" d=\"m49 45.4-4.4 6.4H54z\" \/><path fill=\"#8ed1f4\" d=\"m37 32.6-1.5-2.1z\" \/><path fill=\"#aa76b3\" d=\"m28 41.4 7.6 10.4h1.8l6.4-9.2-6.8-10-1.5-2.1z\" \/><path fill=\"#722a87\" d=\"m28 41.4-7 10.4h14.6z\" \/><path fill=\"#069a49\" d=\"M43.8 72.5a1.8 1.8 0 0 0-1-2.4L40.1 69a8 8 0 0 1-1-.5 7.8 7.8 0 0 1-2.4-10.7H6a44 44 0 0 0-.2 4.4v4.4A70 70 0 0 0 26 75a70 70 0 0 0 15.2 2l2.4-4.3zm33-14.8H44.3l-2.5 3a1.7 1.7 0 0 0-.2.5 1.8 1.8 0 0 0 1 2.3l2.7 1.2.7.4a7.8 7.8 0 0 1 3 10.6l-.5.9 4.8-.8a71 71 0 0 0 8.4-2.2l1.3-.4a71 71 0 0 0 14-6.7v-8.8z\" \/><path fill=\"#fff\" d=\"m46 65-.7-.3-2.7-1.2a1.8 1.8 0 0 1-1-2.4 1.7 1.7 0 0 1 .2-.4l2.5-3h-7.6A7.8 7.8 0 0 0 39 68.4a8 8 0 0 0 1 .5l2.7 1.2a1.8 1.8 0 0 1 1 2.4l-.1.2-2.5 4.3a52.5 52.5 0 0 0 7.2-.4l.5-.9A7.8 7.8 0 0 0 46 65.1z\" \/><path fill=\"#157139\" d=\"M56.9 67.3h8.8l-4.4-5zM23 71h9l-4.5-5.1zm-4.1-10.4-4.5 5h8.9z\" \/><\/svg>\n\t\t\t<h2 class=\"wp-block-related-trail__title\">Discover how AI understands natural language<\/h2>\n\t\t\t<p>AI enables computers to interpret and generate natural human language. Discover how on Trailhead, the free online learning platform from Salesforce.<\/p>\n\t\t\t\n\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/natural-language-processing-basics?trail_id=get-started-with-ai-data\" target=\"_blank\" rel=\"noreferrer noopener\">Get up to speed<\/a><\/div>\n\n\t\t<\/div>\n\t\t<div class=\"related-trail__mock\">\n\t\t\t<div class=\"related-trail__points\">+200 points<\/div>\n\t\t\t<div class=\"related-trail__eyebrow\">Module<\/div>\n\t\t\t<p class=\"related-trail__trail-title h3\"><a href=\"https:\/\/trailhead.salesforce.com\/content\/learn\/modules\/natural-language-processing-basics?trail_id=get-started-with-ai-data\">Natural Language Processing Basics<\/a><\/p>\n\t\t\t<p class=\"related-trail__trail-description\"><\/p>\n\t\t\t<div class=\"related-trail__actions\">\n\t\t\t\t<div class=\"related-trail__action\">\n<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" fill=\"none\" viewBox=\"0 0 10 10\" aria-hidden=\"true\"><path fill=\"#747474\" fill-rule=\"evenodd\" d=\"m4.93.69.88 2.88c.04.12.16.18.27.18h2.89c.29 0 .4.38.17.56L6.79 6.04c-.1.07-.13.2-.1.32l1.12 2.96c.08.27-.2.5-.44.33L4.85 7.77c-.1-.08-.23-.08-.34 0L1.97 9.65a.29.29 0 0 1-.45-.33L2.6 6.36a.3.3 0 0 0-.1-.32L.17 4.3c-.23-.18-.1-.56.17-.56h2.89c.13 0 .23-.04.27-.18l.9-2.9c.08-.27.46-.25.54.02Z\" clip-rule=\"evenodd\" \/><\/svg>\n<\/div>\n\t\t\t\t<div class=\"related-trail__action\">\n<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" fill=\"none\" viewBox=\"0 0 9 5\" aria-hidden=\"true\"><path fill=\"#747474\" d=\"M4.16 4.5.26 0h7.8z\" \/><\/svg>\n<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\t<\/div>\n\n\t<img decoding=\"async\" class=\"related-trail__illustration related-trail__foreground\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/related-trail-foreground-layout-astro.png\" alt=\"\">\n\t<img decoding=\"async\" class=\"related-trail__illustration related-trail__parks\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/related-trail-parks-layout-astro.png\" alt=\"\">\n\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-we-learned\">What we learned<\/h3>\n\n\n\n<p>Horizon Agent entered Early Access in August of 2024, and achieved a GA release in January of 2025. We\u2019ve been iterating on it ever since. Here are some key things we learned.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-ai-faster-decisions-and-happier-users\">AI = faster decisions and happier users<\/h4>\n\n\n\n<p>The time savings and agility of using <a href=\"https:\/\/www.salesforce.com\/ap\/blog\/ai-transform-data-analysis\/\">AI data analysis<\/a> is a clear win. Our technologists used to spend dozens of hours per week working on custom queries for our users, and our users spent the same amount of time waiting. Now our users can self-serve answers from our text-to-SQL Slack agent in minutes, and our technologists are freed up to build the high-value features of tomorrow.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e88be524243&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e88be524243\" class=\"wp-block-image aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1075\" height=\"273\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.salesforce.com\/blog\/wp-content\/uploads\/sites\/2\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png?strip=all&#038;quality=95\" alt=\"Feedback from a user thanking the author for creating the tool.\" class=\"wp-image-9936\" srcset=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png 1075w, https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png?w=300&amp;h=76 300w, https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png?w=768&amp;h=195 768w, https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png?w=1024&amp;h=260 1024w, https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/Screenshot-2025-05-22-at-8.58.20\u202fAM.png?w=150&amp;h=38 150w\" sizes=\"auto, (max-width: 1075px) 100vw, 1075px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Enlarge\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-meet-your-customers-where-they-live\">Meet your customers where they live<\/h4>\n\n\n\n<p>An early prototype of Horizon Agent was a local-only experience using Streamlit. It was a great start, but since it wasn\u2019t accessible where our users spend their time (Slack), it didn\u2019t get adopted. When we shipped an MVP to Slack, people started using it \u2013 even though the responses weren\u2019t perfect. Once users started trying it out, that led to feedback, and feedback leads to targeted investments. It was a virtuous cycle.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-transparency-leads-to-trust\">Transparency leads to trust<\/h4>\n\n\n\n<p>Initially, Horizon Agent didn\u2019t explain what it was doing. We thought it would confuse users, since they didn\u2019t know SQL. Often, it would just say \u201cI don\u2019t know how to answer that.\u201d Conversation over. Later, we loosened up our guardrails and made the Agent more transparent. Instead of saying \u201cno\u201d, it asked clarifying questions. We also had it explain the SQL it generated. This transparency made the answers more trustworthy and less like a black box. It also helped our users learn a bit about SQL as they went, and get better at asking questions.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-solve-for-agility\">Solve for agility<\/h4>\n\n\n\n<p>Horizon Agent didn\u2019t have perfect results from day one. At launch we only had the correct response ~50% of the time. Ambiguity in language is a major challenge \u2013 machines can be taught to think in human terms, but humans change. New terms and acronyms arise, and we needed Horizon Agent to keep pace with reality. We streamlined our process for updating the Agent\u2019s knowledge base, so that if the Agent is confused by a user\u2019s question we can have its knowledge base updated in ~15 minutes with automated regression testing to make sure our change isn\u2019t making things worse. Our users appreciated&nbsp; the continuous improvement.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-consistent-accuracy-is-key\">Consistent accuracy is key<\/h4>\n\n\n\n<p>Another challenge was delivering consistently correct results. By nature, LLMs are non-deterministic \u2013 even with a perfect knowledge base, if you ask a question 10 times, you might get 8 correct answers and 2 wrong ones. We switched from giving the LLM one chance to generate a SQL query to 10 chances, and we use a sequence of algorithms (Cosine Similarity Modeling and Levenshtein Distance) to eliminate outliers and select the response that best represents the majority consensus. We also pre-check all SQL queries by running a simple EXPLAIN query, and feed errors back to the Agent so it can take another crack at generating a correct query.<\/p>\n\n\n\n<div class=\"layout-five wp-block-salesforce-blog-offer\">\n\t<div class=\"wp-block-offer__wrapper\">\n\n\t\t<div class=\"wp-block-offer__content\">\n\t\t\t<h2 class=\"wp-block-offer__title\">Accelerate your team today with Agentforce in Slack<\/h2>\n\t\t\t\t\t\t\t<p class=\"wp-block-offer__description\">Agents become teammates with Agentforce in Slack. Powered by relevant conversations in Slack and your trusted enterprise data, Agentforce will suggest and take action right in the flow of work.<\/p>\n\t\t\t\n\t\t\t\n\t\t\t\t\t\t\t<div class=\"wp-block-button\">\n\t\t\t\t\t<a class=\"wp-block-button__link\" target=\"_self\" href=\"https:\/\/www.salesforce.com\/ap\/blog\/agentforce-for-employees\/\">Meet your new teammates<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"wp-block-offer__media\">\n\t\t\t\t\t<\/div>\n\t<\/div>\n\n\t\n\t\t\t<!-- Standard Illustration -->\n\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__illustration\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-illustration-layout-five.png\" alt=\"\">\n\n\t\t<!-- Small Accent Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__accent\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-accent-layout-five.png\" alt=\"\">\n\t\t\n\t\t<!-- Left Side Illustration -->\n\t\t\n\t\t<!-- Cloud Illustration -->\n\t\t\t\t\t<img decoding=\"async\" class=\"wp-block-offer__graphics wp-block-offer__cloud\" src=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/themes\/salesforce-blog\/dist\/images\/offer-block\/offer-cloud-layout-five.png\" alt=\"\">\n\t\t\n\t<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-shaping-the-future-of-data-driven-work\"><strong>Shaping the future of data-driven work<\/strong><\/h2>\n\n\n\n<p>Horizon Agent points to a future of AI data analysis that is conversational, not siloed in a BI tool or gated by having a deep knowledge of SQL. Getting insight can be as easy as pinging a text-to-SQL Slack agent. With AI, humans will be able to integrate data-driven questions into their moment-to-moment work \u2013 making decisions, brainstorming, etc.<\/p>\n\n\n\n<p>Achieving this future is partly about technology (we couldn\u2019t have built Horizon Agent a few years ago), but also the table-stakes of building good products: trust and expertise.<\/p>\n\n\n\n<p>You may be very bullish about the AI-assisted future; users might be skeptical. That\u2019s a healthy push-pull relationship. Getting everyone on the same page requires effort. We had to collect feedback, observe our users\u2019 interaction with Horizon Agent, and prioritize quick iterations when we saw bad behaviours and mistakes. There\u2019s still much to improve here, but by being open about the issues and demonstrating an urgency to improve, we got our users to come on that journey with us.<\/p>\n\n\n\n<p>And even if Horizon Agent could perfectly answer every question a user has, there\u2019s still going to be a need for engineers and data scientists, just in a different way. Instead of being the <strong>gatekeepers<\/strong> to data and trying to handle the ever-growing line of users waiting to get through the doors, engineers and data scientists become <strong>guides<\/strong> to a next generation of AI-powered tooling that needs their human expertise to assemble high-quality datasets and define the right guardrails.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion-from-gatekeepers-to-guides\">Conclusion: From gatekeepers to guides<\/h2>\n\n\n\n<p>Horizon Agent was a huge shift for how we think about data access.<\/p>\n\n\n\n<p>We started off with a bottlenecked system where engineers and data scientists were the gatekeepers, even if they didn\u2019t want to be. Now, with conversational AI handling routine questions, those same technologists are freed up to be guides and enable a democratised access to insights from data. At the same time, non-technical users get to enjoy instant, conversational access to data.<\/p>\n\n\n\n<p>Ultimately, Horizon Agent allowed us to turn a data access gap into an opportunity to move toward a new way of working. It demonstrated how AI is ready for prime time and integration into daily work. The next time someone needs an answer to a question, they can get what they need instantly, and we can accelerate the rate of our decision making to stay competitive in a difficult environment.<\/p>\n\n\n\n<p>No \u201cHow to Learn SQL\u201d courses, no waiting, no open support tickets. Just trusted answers, immediately, using AI data analysis.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here&#8217;s how.<\/p>\n","protected":false},"author":66,"featured_media":9935,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sf_justforyou_enable_alt":true,"optimizely_content_id":"a6158a10f3d74e0fae6f8b6cAP","post_meta_title":"","ai_synopsis":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"sf_topic":[13,211,540,162,14,23,648,649],"sf_content_type":[],"coauthors":[752],"class_list":["post-9937","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","sf_topic-cio","sf_topic-data-culture","sf_topic-data","sf_topic-developer","sf_topic-it","sf_topic-artificial-intelligence","sf_topic-data-analyst","sf_topic-data-strategy"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How We Built a Text-To-SQL AI Agent to Get Instant Answers<\/title>\n<meta name=\"description\" content=\"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here&#039;s how.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data\" \/>\n<meta property=\"og:description\" content=\"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here&#039;s how.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\" \/>\n<meta property=\"og:site_name\" content=\"Salesforce\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-27T18:19:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-08T14:24:57+00:00\" \/>\n<meta name=\"author\" content=\"Nick Gibson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nick Gibson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\"},\"author\":[{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/48bdb003ff23422b786cb73c970d3773\"}],\"headline\":\"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data\",\"datePublished\":\"2025-05-27T18:19:25+00:00\",\"dateModified\":\"2025-08-08T14:24:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\"},\"wordCount\":2005,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png\",\"inLanguage\":\"en-SG\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\",\"url\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\",\"name\":\"How We Built a Text-To-SQL AI Agent to Get Instant Answers\",\"isPartOf\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png\",\"datePublished\":\"2025-05-27T18:19:25+00:00\",\"dateModified\":\"2025-08-08T14:24:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/de19e72c1f6bbf930d6231f2f9478f9a\"},\"description\":\"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here's how.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#breadcrumb\"},\"inLanguage\":\"en-SG\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-SG\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage\",\"url\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png\",\"contentUrl\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png\",\"width\":1500,\"height\":844,\"caption\":\"Our technologists used to spend dozens of hours a week working on custom queries for our users. Now users can self-serve answers from our text-to-SQL Slack agent in minutes. [Image credit: peopleimages.com \/ Adobe Stock]\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.salesforce.com\/ap\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#website\",\"url\":\"https:\/\/www.salesforce.com\/ap\/blog\/\",\"name\":\"Salesforce\",\"description\":\"News, tips, and insights from the global cloud leader\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.salesforce.com\/ap\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-SG\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/48bdb003ff23422b786cb73c970d3773\",\"name\":\"Nick Gibson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-SG\",\"@id\":\"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/45361f556b25717e15fb04724ae1ebfd\",\"url\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/08\/Nick-Gibson-Salesforce.webp?w=150&h=150&crop=1\",\"contentUrl\":\"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/08\/Nick-Gibson-Salesforce.webp?w=150&h=150&crop=1\",\"width\":\"150\",\"height\":\"150\",\"caption\":\"Nick Gibson\"},\"description\":\"I'm a software engineer and technical leader based in North Carolina. I\u2019ve worked across the stack - from cloud infrastructure to databases, backend microservices, and frontend apps. I got my start coding games on a TI-85 calculator instead of doing my homework, and I\u2019ve been hooked on software development ever since.\",\"url\":\"https:\/\/www.salesforce.com\/ap\/blog\/author\/nick-gibson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How We Built a Text-To-SQL AI Agent to Get Instant Answers","description":"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here's how.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/","og_type":"article","og_title":"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data","og_description":"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here's how.","og_url":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/","og_site_name":"Salesforce","article_published_time":"2025-05-27T18:19:25+00:00","article_modified_time":"2025-08-08T14:24:57+00:00","author":"Nick Gibson","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","twitter_misc":{"Written by":"Nick Gibson","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#article","isPartOf":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/"},"author":[{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/48bdb003ff23422b786cb73c970d3773"}],"headline":"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data","datePublished":"2025-05-27T18:19:25+00:00","dateModified":"2025-08-08T14:24:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/"},"wordCount":2005,"commentCount":0,"image":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","inLanguage":"en-SG","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/","url":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/","name":"How We Built a Text-To-SQL AI Agent to Get Instant Answers","isPartOf":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage"},"image":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","datePublished":"2025-05-27T18:19:25+00:00","dateModified":"2025-08-08T14:24:57+00:00","author":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/de19e72c1f6bbf930d6231f2f9478f9a"},"description":"Advancements in large language models have made AI data analysis and SQL generation easier for non-technical people. Here's how.","breadcrumb":{"@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#breadcrumb"},"inLanguage":"en-SG","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/"]}]},{"@type":"ImageObject","inLanguage":"en-SG","@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#primaryimage","url":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","contentUrl":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","width":1500,"height":844,"caption":"Our technologists used to spend dozens of hours a week working on custom queries for our users. Now users can self-serve answers from our text-to-SQL Slack agent in minutes. [Image credit: peopleimages.com \/ Adobe Stock]"},{"@type":"BreadcrumbList","@id":"https:\/\/www.salesforce.com\/ap\/blog\/text-to-sql-agent\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.salesforce.com\/ap\/blog\/"},{"@type":"ListItem","position":2,"name":"How We Built a Text-To-SQL AI Agent to Get Instant Answers From Our Data"}]},{"@type":"WebSite","@id":"https:\/\/www.salesforce.com\/ap\/blog\/#website","url":"https:\/\/www.salesforce.com\/ap\/blog\/","name":"Salesforce","description":"News, tips, and insights from the global cloud leader","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.salesforce.com\/ap\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-SG"},{"@type":"Person","@id":"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/48bdb003ff23422b786cb73c970d3773","name":"Nick Gibson","image":{"@type":"ImageObject","inLanguage":"en-SG","@id":"https:\/\/www.salesforce.com\/ap\/blog\/#\/schema\/person\/image\/45361f556b25717e15fb04724ae1ebfd","url":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/08\/Nick-Gibson-Salesforce.webp?w=150&h=150&crop=1","contentUrl":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/08\/Nick-Gibson-Salesforce.webp?w=150&h=150&crop=1","width":"150","height":"150","caption":"Nick Gibson"},"description":"I'm a software engineer and technical leader based in North Carolina. I\u2019ve worked across the stack - from cloud infrastructure to databases, backend microservices, and frontend apps. I got my start coding games on a TI-85 calculator instead of doing my homework, and I\u2019ve been hooked on software development ever since.","url":"https:\/\/www.salesforce.com\/ap\/blog\/author\/nick-gibson\/"}]}},"jetpack_featured_media_url":"https:\/\/www.salesforce.com\/ap\/blog\/wp-content\/uploads\/sites\/8\/2025\/05\/blog_stock_1500_844.png","jetpack_sharing_enabled":true,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Salesforce","distributor_original_site_url":"https:\/\/www.salesforce.com\/ap\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/posts\/9937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/comments?post=9937"}],"version-history":[{"count":2,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/posts\/9937\/revisions"}],"predecessor-version":[{"id":9942,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/posts\/9937\/revisions\/9942"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/media\/9935"}],"wp:attachment":[{"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/media?parent=9937"}],"wp:term":[{"taxonomy":"sf_topic","embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/sf_topic?post=9937"},{"taxonomy":"sf_content_type","embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/sf_content_type?post=9937"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.salesforce.com\/ap\/blog\/wp-json\/wp\/v2\/coauthors?post=9937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}