Deploy a Text-to-SQL AI Agent on Databricks Apps
Deploy the open-source db-agent to Databricks Apps over a built-in sample dataset. The lab then asks a test question through the live app to confirm it works.
- Level
- Beginner
- Duration
- About 20 min
- Cost
- Free tier
- Runs on a vendor free plan.
- Technologies
- Text-to-SQLAI agentsDatabricks AppsUnity CatalogSQL warehouse
What you will build
- A text-to-SQL agent running as a Databricks App in your own workspace
- A connection to the built-in samples catalog, so nothing is downloaded
- A revocable app token stored as a secret
- A verified end-to-end test question
Prerequisites
- A Databricks workspace (Free Edition works)
- The Databricks CLI, logged in with databricks auth login
- Python 3.9 or newer with pip
- git installed
Run it
Install once, then launch the lab. Preview the steps first with the dry run. Remove everything when you finish.
pip install 'labagent[rag]'
databricks auth login
# preview the steps without changing anything
labagent launch db-agent --name demo --dry-run
# launch the lab (safe to re-run, it resumes where it stopped)
labagent launch db-agent --name demo --param dataset=bakehouse
# remove only what the lab created
labagent destroy db-agent --name demoSteps
- 1
Preflight
Check your login, SQL warehouse, sample data and serving endpoints.
- 2
Fetch db-agent
Clone the app at a pinned commit so you run the code that was reviewed.
- 3
Create the app token
Make a revocable token and store it as a secret.
- 4
Deploy the app
Publish the Databricks App.
- 5
Verify
Ask a test question through the deployed app.
FAQ
Which data does the agent query?+
Does labagent copy the db-agent code?+
What happens to the access token when I remove the lab?+
Does this lab cost money?+
Pick how you want to use this lab
Run this lab for your team
Tell us the class size and the date. We reply within one business day.
Related labs
Build a RAG App with pgvector on Databricks Lakebase
Build a retrieval-augmented generation app over real SEC 10-K filings. It has hybrid search, company and year filters, cited answers, and a quality gate that blocks a bad deploy.
Smoke-Test a RAG Pipeline on Databricks Lakebase
Run the full RAG pipeline on a small demo corpus of 25 passages. Use it to check your Databricks setup before you build with real data.