{"id":4756,"date":"2025-03-05T09:00:45","date_gmt":"2025-03-05T08:00:45","guid":{"rendered":"https:\/\/www.hiberus.com\/en\/blog\/?p=4756"},"modified":"2025-08-06T12:29:05","modified_gmt":"2025-08-06T10:29:05","slug":"ai-agent-for-text2sql","status":"publish","type":"post","link":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/","title":{"rendered":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions"},"content":{"rendered":"<p>Have you ever dreamed of talking to your database like you&#8217;d chat with a colleague? The rise of text-to-SQL solutions has brought us excitingly close to this reality \u2013 a world where business users can gain insights from their data without writing a single line of SQL code.<\/p>\n<p>As an AI developer working at the intersection of language models and databases, I&#8217;ve observed a fascinating transformation in how we interact with data. When ChatGPT burst onto the scene, one of my clients asked a seemingly simple question: &#8220;Could we connect ChatGPT to our databases for natural language queries?&#8221; While many might reach for a RAG (Retrieval-Augmented Generation) pipeline, I discovered that building a dedicated AI agent would yield far more powerful results.<\/p>\n<p>Join me as I share my journey of creating a robust Text2SQL AI Agent using LangChain and LangGraph \u2013 a solution you can adapt for your own projects.<\/p>\n<p>&nbsp;<\/p>\n<h2>The Power of AI Agents<\/h2>\n<p>In the rapidly evolving AI landscape, AI agents stand out as game-changers. <strong>Harrison Chase<\/strong>, co-founder of LangChain, offers a compelling definition:<\/p>\n<blockquote><p>&#8220;An AI Agent is a system that uses an LLM to decide the control flow of an application.&#8221;<\/p><\/blockquote>\n<p>This isn&#8217;t just another buzzword. AI agents surpass simple text completion \u2013 they&#8217;re decision-making engines that orchestrate complex workflows. When you feed an input to a Large Language Model (LLM), it doesn&#8217;t just predict the next word; it makes strategic decisions about actions and pathways to achieve your goal.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4757\" src=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-1024x753.png\" alt=\"Diagram AI Agents\" width=\"700\" height=\"515\" srcset=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-1024x753.png 1024w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-300x221.png 300w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-768x565.png 768w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-1536x1129.png 1536w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-2048x1505.png 2048w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/1-text-to-sql-360x265.png 360w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>The Four Pillars of Success<\/h2>\n<p>Every good AI agent is built on four fundamental pillars:<\/p>\n<h3>1. The Brain (LLM)<\/h3>\n<ul>\n<li>Powers decision-making and understanding<\/li>\n<li>In our case, we&#8217;re using Azure OpenAI&#8217;s GPT-4<\/li>\n<li>Adaptable to other models like <a href=\"https:\/\/www.hiberus.com\/en\/blog\/deepseek-r1-vs-v3-choosing-the-right-model-for-your-ai-needs\/\">DeepSeek R1<\/a><\/li>\n<\/ul>\n<h3>2. Planning<\/h3>\n<ul>\n<li>Strategizes the sequence of actions needed<\/li>\n<li>Breaks down complex queries into manageable steps<\/li>\n<li>Determines the optimal approach for each query<\/li>\n<li>For example, when asked about sales data:\n<ul>\n<li>First, identify relevant tables (customers, sales, employees)<\/li>\n<li>Then, determine necessary joins<\/li>\n<li>Finally, plan aggregations and filtering<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>3. The Tools<\/h3>\n<ul>\n<li>The agent&#8217;s practical capabilities<\/li>\n<li>For our SQL agent, includes:\n<ul>\n<li>Database table listing<\/li>\n<li>Schema information retrieval<\/li>\n<li>Query validation<\/li>\n<li>Query execution<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>4. The Memory<\/h3>\n<ul>\n<li>Enables contextual understanding<\/li>\n<li>Maintains conversation state<\/li>\n<li>Facilitates natural dialogue about data<\/li>\n<li>Remembers previous queries for context<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>To illustrate how these pillars work together, let&#8217;s analyse a real example with the question: <em>&#8220;Which customers spent the most in each country?&#8221;<\/em><\/p>\n<h4>1. The LLM processes the question and understands:<\/h4>\n<ul>\n<li>We need to find customer spending.<\/li>\n<li>Group by country.<\/li>\n<li>Identify the highest spenders in each group.<\/li>\n<\/ul>\n<h4>2. Planning comes into play:<\/h4>\n<ul>\n<li>It needs to identify tables containing customer, invoice, and location data.<\/li>\n<li>It will require aggregating spending by customer.<\/li>\n<li>It must group results by country.<\/li>\n<li>It needs to rank customers within each country group.<\/li>\n<li>It plans the sequence: customer location \u2192 purchase data \u2192 aggregation \u2192 ranking.<\/li>\n<\/ul>\n<h4>3. Tools execute in sequence:<\/h4>\n<ul>\n<li>First, it lists available tables.<\/li>\n<li>It retrieves schema information for relevant tables (e.g., Customer, Invoice).<\/li>\n<li>It constructs and validates the query (iterating and improving until a valid query is generated).<\/li>\n<\/ul>\n<h4>4. Memory stores:<\/h4>\n<ul>\n<li>The tables used.<\/li>\n<li>The relationship between customers and invoices.<\/li>\n<li>The fact that we are interested in customer spending.<\/li>\n<li>This context helps with<strong> follow-up questions<\/strong> like &#8220;Show me their recent purchases.&#8221;<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4758\" src=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-1024x444.png\" alt=\"Example with the question: &quot;Which customers spent the most in each country?&quot;\" width=\"700\" height=\"303\" srcset=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-1024x444.png 1024w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-300x130.png 300w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-768x333.png 768w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-1536x665.png 1536w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-2048x887.png 2048w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/2-text-to-sql-360x156.png 360w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Building the Magic<\/h2>\n<p>Let&#8217;s dive into the implementation. We&#8217;ll use LangChain for core functionality and LangGraph for workflow orchestration. Here&#8217;s our agent&#8217;s foundation:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4759 size-full\" src=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/3-text-to-sql.png\" alt=\"LangChain for core functionality and LangGraph for workflow orchestration.\" width=\"602\" height=\"145\" srcset=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/3-text-to-sql.png 602w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/3-text-to-sql-300x72.png 300w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/3-text-to-sql-360x87.png 360w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>The real magic happens in our tools&#8217; implementation:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4760 size-full\" src=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/4-text-to-sql.png\" alt=\"Tools' implementation\" width=\"602\" height=\"172\" srcset=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/4-text-to-sql.png 602w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/4-text-to-sql-300x86.png 300w, https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/4-text-to-sql-360x103.png 360w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>The Agent at Work<\/h2>\n<p>When a user poses a question like <em>&#8220;Which sales agent made the most in sales in 2009?&#8221;<\/em>, our agent springs into action:<\/p>\n<ol>\n<li>1Surveys the database landscape (lists available tables)<\/li>\n<li>Understands the data structure (retrieves schema information)<\/li>\n<li>Crafts and validates the perfect SQL query<\/li>\n<li>Executes the query and presents results in plain English<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Powerful Features, Real Benefits<\/h2>\n<p>Our implementation delivers several key advantages:<\/p>\n<ol>\n<li><strong>Rock-Solid Security:<\/strong> Query validation prevents SQL injection and errors<\/li>\n<li><strong>Adaptable Design:<\/strong> Works with various databases and schemas<\/li>\n<li><strong>Easy Maintenance:<\/strong> Clean, modular code structure<\/li>\n<li><strong>Contextual Intelligence:<\/strong> Maintains conversation history<\/li>\n<li><strong>Natural Interaction:<\/strong> Understands plain English queries<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h2>Real-World Impact<\/h2>\n<p>This Text2SQL agent transforms various business scenarios:<\/p>\n<ul>\n<li><strong>Business Intelligence:<\/strong> Democratizes data access for non-technical users<\/li>\n<li><strong>Data Analysis:<\/strong> Simplifies complex query construction<\/li>\n<li><strong>Customer Service:<\/strong> Enables quick, accurate data retrieval<\/li>\n<li><strong>Database Administration:<\/strong> Streamlines routine operations<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>See It in Action<\/h2>\n<p>I&#8217;ve prepared a demonstration that showcases our agent handling various queries:<\/p>\n<ol>\n<li>&#8220;Show me the top 5 best-selling tracks of all time&#8221;<\/li>\n<li>&#8220;What was the total revenue for each genre in 2009?&#8221;<\/li>\n<li>&#8220;Which customers spent the most in each country?&#8221;<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/PKjeuOPqj28?si=B4fVfKkQcekOAiTv\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p>The demo highlights how we&#8217;ve bridged the gap between technical SQL capabilities and user-friendly interaction, making database querying accessible to everyone in your organization.<\/p>\n<p>&nbsp;<\/p>\n<h2>Conclusion<\/h2>\n<p>Building an efficient Text2SQL AI Agent isn&#8217;t just about connecting an LLM to a database \u2013 it&#8217;s about carefully orchestrating the interaction between language understanding, tool capabilities, and memory. Through LangChain and LangGraph, we&#8217;ve created a solution that makes database interactions feel natural and accessible.<\/p>\n<p><span data-contrast=\"auto\">At <a href=\"https:\/\/www.hiberus.com\/en\">hiberus<\/a>, we are ready to help you implement AI in your organization. Our expertise in <a href=\"https:\/\/www.hiberus.com\/en\/partners\/aws\">generative AI<\/a> allows us to design personalized solutions that drive your business toward the future. Have questions or ideas for improvements? Let&#8217;s connect and collaborate!\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Contact us to discover how AI can revolutionize your business!<\/span><\/b><\/p>\n<p><span data-teams=\"true\"><span class=\"ui-provider nt beh bei bej bek bel bem ben beo bep beq ber bes bet beu bev bew bex bey bez bfa bfb bfc bfd bfe bff bfg bfh bfi bfj bfk bfl bfm bfn bfo\" dir=\"ltr\">        <div class=\"row\">\n            <div class=\"block-cta-form\" style=\"background-color: #003664;\">\n                <div class=\"content-cta-form\">\n                    <div class=\"text-cta-form\">\n                        <h3>Want to learn more about AI Agents?<\/h3>\n                        <p>Contact with our GenIA team<\/p>\n                    <\/div>\n                    <div class=\"form-fields\">\n                        \n<div class=\"wpcf7 no-js\" id=\"wpcf7-f268-o1\" lang=\"en-US\" dir=\"ltr\" data-wpcf7-id=\"268\">\n<div class=\"screen-reader-response\"><p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"><\/p> <ul><\/ul><\/div>\n<form action=\"\/en\/blog\/wp-json\/wp\/v2\/posts\/4756#wpcf7-f268-o1\" method=\"post\" class=\"wpcf7-form init\" aria-label=\"Contact form\" novalidate=\"novalidate\" data-status=\"init\">\n<fieldset class=\"hidden-fields-container\"><input type=\"hidden\" name=\"_wpcf7\" value=\"268\" \/><input type=\"hidden\" name=\"_wpcf7_version\" value=\"6.1.5\" \/><input type=\"hidden\" name=\"_wpcf7_locale\" value=\"en_US\" \/><input type=\"hidden\" name=\"_wpcf7_unit_tag\" value=\"wpcf7-f268-o1\" \/><input type=\"hidden\" name=\"_wpcf7_container_post\" value=\"0\" \/><input type=\"hidden\" name=\"_wpcf7_posted_data_hash\" value=\"\" \/><input type=\"hidden\" name=\"_wpcf7_recaptcha_response\" value=\"\" \/>\n<\/fieldset>\n<div id=\"responsive-form\" class=\"clearfix\">\n\t<div class=\"form-row\">\n\t\t<div class=\"column-half\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"names\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Name *\" value=\"\" type=\"text\" name=\"names\" \/><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t\t<div class=\"column-half\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"lastname\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Last name *\" value=\"\" type=\"text\" name=\"lastname\" \/><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-half\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"mail\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-email wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-email\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Corporate email *\" value=\"\" type=\"email\" name=\"mail\" \/><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t\t<div class=\"column-half\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"phone\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-tel wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-tel\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Phone *\" value=\"\" type=\"tel\" name=\"phone\" \/><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-half\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"company\"><input size=\"40\" maxlength=\"400\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Company *\" value=\"\" type=\"text\" name=\"company\" \/><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-full\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"message\"><textarea cols=\"40\" rows=\"10\" maxlength=\"2000\" class=\"wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Message *\" name=\"message\"><\/textarea><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-full color-acceptance\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"politica\"><span class=\"wpcf7-form-control wpcf7-acceptance\"><span class=\"wpcf7-list-item\"><label><input type=\"checkbox\" name=\"politica\" value=\"1\" aria-invalid=\"false\" \/><span class=\"wpcf7-list-item-label\">I have read and accept the <a href=\"https:\/\/www.hiberus.com\/en\/policy\" target=\"_blank\"><u>Privacy Policy<\/u><\/a><\/span><\/label><\/span><\/span><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-full color-acceptance\">\n\t\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"marketing\"><span class=\"wpcf7-form-control wpcf7-acceptance optional\"><span class=\"wpcf7-list-item\"><label><input type=\"checkbox\" name=\"marketing\" value=\"1\" aria-invalid=\"false\" \/><span class=\"wpcf7-list-item-label\">I would like to receive marketing communications from Hiberus and about its products, services and events.<\/span><\/label><\/span><\/span><\/span>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n\t<div class=\"form-row\">\n\t\t<div class=\"column-half\">\n\t\t\t<p><input class=\"wpcf7-form-control wpcf7-submit has-spinner\" type=\"submit\" value=\"Contact us\" \/>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n<!--end responsive-form--><div class=\"wpcf7-response-output\" aria-hidden=\"true\"><\/div>\n<\/form>\n<\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n        <\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever dreamed of talking to your database like you&#8217;d chat with a colleague? The rise of text-to-SQL solutions has brought&#8230;<\/p>\n","protected":false},"author":14,"featured_media":4768,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,14],"tags":[27],"class_list":{"0":"post-4756","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-hiberus","8":"category-generative-ai","9":"tag-ai"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences<\/title>\n<meta name=\"description\" content=\"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.\" \/>\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.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences\" \/>\n<meta property=\"og:description\" content=\"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\" \/>\n<meta property=\"og:site_name\" content=\"hiberus blog - Exploring Technology, AI, and Digital Experiences\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-05T08:00:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-06T10:29:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nour Eddine Zekaoui\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hiberus\" \/>\n<meta name=\"twitter:site\" content=\"@hiberus\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nour Eddine Zekaoui\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\"},\"author\":{\"name\":\"Nour Eddine Zekaoui\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/person\/c4c30fc32d5838377ce6338190963156\"},\"headline\":\"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions\",\"datePublished\":\"2025-03-05T08:00:45+00:00\",\"dateModified\":\"2025-08-06T10:29:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\"},\"wordCount\":912,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg\",\"keywords\":[\"AI\"],\"articleSection\":[\"Digital\",\"Generative AI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\",\"name\":\"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences\",\"isPartOf\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg\",\"datePublished\":\"2025-03-05T08:00:45+00:00\",\"dateModified\":\"2025-08-06T10:29:05+00:00\",\"description\":\"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg\",\"contentUrl\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg\",\"width\":1200,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/www.hiberus.com\/en\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#website\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/\",\"name\":\"hiberus blog - Exploring Technology, AI, and Digital Experiences\",\"description\":\"Blog for the latest updates, trends, and insights in the world of technology, artificial intelligence, and digital experiences. Stay informed!\",\"publisher\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hiberus.com\/en\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#organization\",\"name\":\"hiberus\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2023\/04\/Hiberus_blog-logo.png\",\"contentUrl\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2023\/04\/Hiberus_blog-logo.png\",\"width\":324,\"height\":70,\"caption\":\"hiberus\"},\"image\":{\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/hiberus\",\"https:\/\/www.linkedin.com\/company\/hiberus\",\"https:\/\/www.instagram.com\/hiberusit\/\",\"https:\/\/www.youtube.com\/user\/hiberusit\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/person\/c4c30fc32d5838377ce6338190963156\",\"name\":\"Nour Eddine Zekaoui\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg\",\"contentUrl\":\"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg\",\"caption\":\"Nour Eddine Zekaoui\"},\"description\":\"Data Scientist en hiberus\",\"url\":\"https:\/\/www.hiberus.com\/en\/blog\/author\/nour-eddine-zekaoui\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences","description":"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.","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.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/","og_locale":"en_US","og_type":"article","og_title":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences","og_description":"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.","og_url":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/","og_site_name":"hiberus blog - Exploring Technology, AI, and Digital Experiences","article_published_time":"2025-03-05T08:00:45+00:00","article_modified_time":"2025-08-06T10:29:05+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg","type":"image\/jpeg"}],"author":"Nour Eddine Zekaoui","twitter_card":"summary_large_image","twitter_creator":"@hiberus","twitter_site":"@hiberus","twitter_misc":{"Written by":"Nour Eddine Zekaoui","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#article","isPartOf":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/"},"author":{"name":"Nour Eddine Zekaoui","@id":"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/person\/c4c30fc32d5838377ce6338190963156"},"headline":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions","datePublished":"2025-03-05T08:00:45+00:00","dateModified":"2025-08-06T10:29:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/"},"wordCount":912,"commentCount":0,"publisher":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/#organization"},"image":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg","keywords":["AI"],"articleSection":["Digital","Generative AI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/","url":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/","name":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions - hiberus blog - Exploring Technology, AI, and Digital Experiences","isPartOf":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage"},"image":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg","datePublished":"2025-03-05T08:00:45+00:00","dateModified":"2025-08-06T10:29:05+00:00","description":"Learn how to build an AI Agent for Text2SQL, its main characteristics and its operating process in our article.","breadcrumb":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#primaryimage","url":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg","contentUrl":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/Blog_imagen_articulo-61.jpg","width":1200,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.hiberus.com\/en\/blog\/ai-agent-for-text2sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/www.hiberus.com\/en\/blog\/"},{"@type":"ListItem","position":2,"name":"AI Agent for Text2SQL: The Magical Recipe for Natural Database Interactions"}]},{"@type":"WebSite","@id":"https:\/\/www.hiberus.com\/en\/blog\/#website","url":"https:\/\/www.hiberus.com\/en\/blog\/","name":"hiberus blog - Exploring Technology, AI, and Digital Experiences","description":"Blog for the latest updates, trends, and insights in the world of technology, artificial intelligence, and digital experiences. Stay informed!","publisher":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hiberus.com\/en\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hiberus.com\/en\/blog\/#organization","name":"hiberus","url":"https:\/\/www.hiberus.com\/en\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2023\/04\/Hiberus_blog-logo.png","contentUrl":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2023\/04\/Hiberus_blog-logo.png","width":324,"height":70,"caption":"hiberus"},"image":{"@id":"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/hiberus","https:\/\/www.linkedin.com\/company\/hiberus","https:\/\/www.instagram.com\/hiberusit\/","https:\/\/www.youtube.com\/user\/hiberusit"]},{"@type":"Person","@id":"https:\/\/www.hiberus.com\/en\/blog\/#\/schema\/person\/c4c30fc32d5838377ce6338190963156","name":"Nour Eddine Zekaoui","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg","url":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg","contentUrl":"https:\/\/www.hiberus.com\/en\/blog\/wp-content\/uploads\/2025\/03\/neddine_1-300x300-1-150x150.jpg","caption":"Nour Eddine Zekaoui"},"description":"Data Scientist en hiberus","url":"https:\/\/www.hiberus.com\/en\/blog\/author\/nour-eddine-zekaoui\/"}]}},"_links":{"self":[{"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/posts\/4756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/comments?post=4756"}],"version-history":[{"count":7,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/posts\/4756\/revisions"}],"predecessor-version":[{"id":18862,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/posts\/4756\/revisions\/18862"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/media\/4768"}],"wp:attachment":[{"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/media?parent=4756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/categories?post=4756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiberus.com\/en\/blog\/wp-json\/wp\/v2\/tags?post=4756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}