Share via


Build and share a chat UI with Databricks Apps

Use Databricks Apps to build and deploy a chat UI for your agent. Agent app templates include this chat UI with no additional setup. Use this page to customize the template UI or to add a chat UI to an agent deployed without a template.

Example chat UI for chatting with deployed agents.

Requirements

This chat UI works with any Azure Databricks agent, except legacy schemas, including:

You must have the following development tools:

  • NPM CLI: Required for local development. See GitHub - NPM CLI

  • Databricks CLI: Required for authentication, see the installation guide.

    1. Install the Databricks CLI.
    2. Set your profile name:
      export DATABRICKS_CONFIG_PROFILE='your_profile_name'
      
    3. Configure authentication:
      databricks auth login --profile "$DATABRICKS_CONFIG_PROFILE"
      
      

Example chat application

The example app, e2e-chatbot-app-next uses NextJS, React, and AI SDK to build a production-ready chat interface.

See the project README.md for detailed instructions on how to use the template.

The example app demonstrates the following:

  • Streaming output: Displays agent responses as they generate with automatic fallback to non-streaming mode
  • Tool calls: Renders tool calls for agents authored using Agent Framework best practices
  • Databricks Agent and Foundation Model integration: Direct connection to Foundation Models, Databricks Agent serving endpoints, and Agent Bricks
  • Databricks authentication: Uses Databricks authentication to identify end users of the chat app and securely manage their conversations.
  • Persistent chat history: Stores conversations in Databricks Lakebase (Postgres) with full governance

Open the following sections to enable optional features:

Enable chat history

Enable chat history

By default, conversations are stored in memory only and are lost when the session ends. To persist history in PostgreSQL, run the quickstart script described in the template README.md.

Enable user feedback

Enable user feedback

Users can provide thumbs up/down feedback on responses, which gets logged in an MLflow experiment.

If you are using an agent template such as agent-openai-agents-sdk or agent-langgraph, the bundle automatically configures authentication for the app to write user feedback to the MLflow experiment. Feedback works after databricks bundle deploy with no extra steps.

If you are using the standalone e2e-chatbot-app-next pointed at an existing agent endpoint, run the quickstart script described in the template README.md to configure authentication for the MLflow experiment.

Note

Also bind a Lakebase database to persist the thumbs up/down state across page reloads. See Enable chat history.

Host multiple apps on the same database instance

Host multiple apps on the same database instance

This example only creates one database per app, because the app code targets a fixed ai_chatbot schema in the database instance. To host multiple apps out of the same instance, you must do the following:

  1. Update the database instance name in databricks.yml.
  2. Update references to ai_chatbot in the codebase to your new desired schema name within the existing database instance.
  3. Run npm run db:generate to regenerate database migrations.
  4. Deploy the app.

Share the app

Grant users permission to view the app (see Configure permissions for a Databricks app), then share the app URL.

Known limitations

  • No support for image or other multi-modal inputs
  • This app only supports Databricks CLI auth (local development) and service principal auth (deployed apps) only. PAT, Azure managed identities, and other mechanisms are not supported.

Streamlit agent chat app

The previous Streamlit template, e2e-chatbot-app, is still available but lacks the production features of e2e-chatbot-app-next.