AI coding agents can help data practitioners move from an idea to a working application without spending days learning every detail of a new Python or JavaScript framework, deployment model, or API. The key is giving the agent the right development environment and a clear path to your data and AI platform.
This guide walks through how to connect OpenAI Codex CLI to Databricks, create a simple Databricks App, develop it locally, and deploy it to your workspace. It starts with the recommended ucode setup and then covers manual Codex configuration for teams that want more control.
By the end, you will have a repeatable workflow for using Codex as an AI pair programmer while keeping your application close to Databricks data, models, governance, and deployment services.
Databricks Apps lets you build and deploy data and AI applications directly in your Databricks workspace. Apps run on managed serverless infrastructure and can integrate with services such as Unity Catalog, Lakebase, Databricks SQL, and OAuth-based authentication. You can use familiar frameworks including Streamlit, Dash, Gradio, React, and other Python or Node.js frameworks. Learn more in the Databricks Apps documentation.
For this walkthrough, the workflow looks like this:
You can use this pattern for turning dashboards into interactive apps, building data-entry tools, RAG applications, internal operational workflows, lightweight AI assistants and more.
Before you begin, make sure you have:
Databricks Apps can be developed in an IDE such as Visual Studio Code, PyCharm, or IntelliJ IDEA. The Databricks Apps development guide contains the environment and application requirements.
ucode is Databricks’ command-line entry point for running supported coding agents through Unity AI Gateway. It can authenticate to your workspace and configure supported agents, including Codex CLI. It can also register Databricks MCP servers for capabilities such as Unity Catalog functions, AI Search, SQL warehouses, and discovered external connections.
Install ucode with uv:
uv tool install git+https://github.com/databricks/ucode
You can see the available commands with:
ucode --help
Launch Codex with:
ucode codex
On first launch, ucode prompts you for your Databricks workspace URL, authenticates you, and writes the agent configuration. Later launches can go directly to Codex.
You can pass supported flags through to Codex. For example:
ucode codex --full-auto
Use approval settings carefully, especially when working with production repositories or applications. Start with a mode that lets you review changes before they are applied.
MCP servers give Codex structured access to tools and services beyond the local filesystem. To configure Databricks MCP servers, run:
ucode mcp add
Add only the MCP servers your project needs. A smaller tool surface is often easier for an agent to use reliably and easier for you to govern.
For example, an app that queries a SQL warehouse may need SQL-related capabilities, while an app that uses governed search may need AI Search access. Keep the first iteration narrow, then add tools as the application requirements become clearer.
You can change the model from inside Codex with /model. If your workspace exposes approved open-source model services, ucode can also pass a model explicitly:
ucode codex --model <model-service-name>
Your available model services depend on workspace configuration and permissions.
The recommended ucode workflow is the simplest way to get started, but a manual configuration can be useful for teams that manage Codex settings centrally or want to inspect the configuration directly.
Install Codex CLI version 0.118 or later:
npm install -g @openai/codex@latest
Install the Databricks CLI, then authenticate to your workspace:
databricks auth login --host <workspace-url>
Replace <workspace-url> with the URL of your Databricks workspace. You only need to complete this login once for the local environment.
Create or edit the Codex configuration file at ~/.codex/config.toml:
profile = "default"
[profiles.default]
model_provider = "Databricks"
[model_providers.Databricks]
name = "Databricks AI Gateway"
base_url = "<workspace-url>/ai-gateway/codex/v1"
wire_api = "responses"
[model_providers.Databricks.auth]
command = "sh"
args = ["-c", "databricks auth token --host <workspace-url> --output json | jq -r '.access_token'"]
timeout_ms = 5000
refresh_interval_ms = 1800000
Replace <workspace-url> in both places with your workspace URL. The configuration retrieves a short-lived Databricks token when Codex needs one and refreshes it during longer sessions.
Make sure jq is installed and available on your PATH. Then start Codex:
codex
You can change models from the Codex interface with /model.
For the full integration details, including model services, usage tracking, governance, and OpenTelemetry, see Integrate with coding agents.
The quickest way to understand the workflow is to start from a template. The Databricks Apps getting-started tutorial uses a simple Gradio application and then shows how to export, run, modify, and redeploy it.
In your Databricks workspace:
After the app is created, Databricks deploys it and provides a preview URL. The template includes the core files you need:
At this stage, the goal is not to build the final product. The goal is to give Codex a working application that it can inspect, explain, and improve.
After you have installed the Databricks AI skills using the CLI, you can just prompt your agent to create an app. For instance, you could say: “Create an app that will display live data over from the X table in Unity Catalog and contains a side chat where users can ask questions through Genie”.
The agent will create a first version of your app. The framework used by default is AppKit, which was built specifically to create beautiful and functional apps on Databricks. You may learn about it on the Databricks Developers Getting Started page. If you’d like, you may also specifically prompt your agent to use a specific language or framework.
Once your app is scaffolded, you will be able to preview it locally, and request any new features or fixes to be done. The agent is able to handle the full development and deployment flow, including:
A coding agent works best when you provide a specific outcome, the constraints, and the definition of done. Instead of asking Codex to “make this app better,” try a prompt like this:
Inspect this Databricks App and explain its current structure.
Then update it to:
Add a text input for a SQL query.
Run the query through the configured Databricks SQL resource.
Display the results in a table.
Show a clear error message when the query fails.
Avoid logging credentials or sensitive query results.
Keep the existing startup command and make the app run locally.
Before changing files, describe the files you plan to modify.
After making changes, list the tests I should run.
This prompt gives Codex a bounded task, a security requirement, and a review checkpoint. For larger changes, ask Codex to create a plan first and implement the work in small increments.
Useful prompts for data practitioners include:
The agent can write code, but you remain responsible for validating the query logic, access controls, data exposure, and production behavior.
As your app becomes useful, connect it to the platform services it needs. Databricks Apps supports resources such as Databricks SQL, secrets, and Lakebase. The resources documentation explains how to configure these connections.
A good progression is:
For apps that need transactional state, Lakebase provides a managed Postgres backend that can be added as an app resource. See Using Lakebase with Databricks Apps for a database-backed application example.
Avoid placing tokens, passwords, or connection strings directly in source code. Use Databricks-managed authentication, app resources, and environment variables as appropriate. The authorization guide provides additional guidance for service principals, user authorization, and least-privilege access.
When the app works locally, deploy it back to your Databricks workspace using the command shown in the app overview page. Databricks builds the application, installs its dependencies, and runs the command defined in app.yaml.
For a team workflow, store the application in Git and deploy from a repository. Git-based deployment gives you version control, pull-request review, collaboration, and a path to automated deployments. The Databricks Apps deployment guide covers workspace sync, Git deployment, and automatic deployment options.
Before deploying to a shared or production workspace, verify:
The Databricks Apps best practices guide covers security, performance, networking, dependency management, logging, and graceful shutdown behavior.
For many teams, the most effective pattern is a short review loop:
This approach makes Codex useful to people who may be new to application development without removing human judgment from the workflow.
The combination of Codex and Databricks Apps gives data practitioners a practical path from analysis to application. Codex helps translate intent into code, while Databricks provides the governed environment for data, AI, authentication, and deployment.
Start with a small app: a query explorer, a business intake form, a RAG prototype, or a model-powered workflow. Give Codex a narrow first task, test locally, connect only the resources you need, and promote the result through a reviewed deployment process.
That is the core loop: describe the outcome, inspect the generated work, test against real requirements, and iterate until the app is ready for its users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.