Skip to content

pedrozanlorensi/streamlit-multiagent-chatbot-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Agent Chatbot App for Databricks

A Streamlit-based chatbot application designed to work with Databricks serving endpoints, including support for multi-agent systems with custom response formats.

Features

  • 🤖 Multi-agent support - Works with supervisor-agent architectures
  • 🔄 Flexible response formats - Supports standard ChatCompletions and custom output arrays
  • 📊 Rich content display - Automatically renders markdown tables and formatted responses
  • 🎨 Customizable branding - Easy logo and title configuration
  • Real-time feedback - Animated loading indicators during processing
  • 🔧 Adaptive input handling - Automatically detects and uses correct API schema

Prerequisites

  • Access to a Databricks workspace
  • A deployed serving endpoint (ChatCompletions-compatible or custom agent endpoint)
  • Git installed on your local machine

Setup Instructions

1. Clone the Repository

git clone <your-repo-url>
cd streamlit-chatbot-app

2. Update Configuration

Edit the app.yaml file and update the serving endpoint reference:

env:
  - name: "SERVING_ENDPOINT"
    value: "agents_pedroz_genai_catalog-default-teste_multi"  # Change this to your serving endpoint name

Example:

env:
  - name: "SERVING_ENDPOINT"
    value: "my-agent-endpoint"

3. Customize Branding (Optional)

  • Replace figures/brand_logo.png with your company logo
  • Edit app.py to update the title and branding text in the sidebar (lines 88-92)

4. Deploy to Databricks Apps

  1. Navigate to Databricks Apps in your workspace
  2. Click "Create App"
  3. Configure the app:
    • Name: Choose a name for your app (e.g., "Multi-Agent Chatbot")
    • Source code: Select "Local files" or "Git repository"
    • Source directory: Point to the directory where you cloned this repo
  4. Add Serving Endpoint Permission:
    • In the app configuration, add a resource reference to your serving endpoint
    • Grant CAN_QUERY permissions to the app
  5. Click "Create" and wait for deployment

5. Access Your App

Once deployed, Databricks will provide a URL to access your chatbot application.

Configuration Reference

app.yaml

The app.yaml file configures the Streamlit application:

command: [
  "streamlit", 
  "run",
  "app.py"
]

env:
  - name: STREAMLIT_BROWSER_GATHER_USAGE_STATS
    value: "false"
  - name: "SERVING_ENDPOINT"
    value: "serving-endpoint"  # Your serving endpoint name here

Supported Endpoint Formats

This app supports three response formats:

  1. Standard ChatCompletions (choices with message)
  2. Databricks Agent Framework (messages array)
  3. Custom Multi-Agent Format (output array with messages and function calls)

File Structure

streamlit-chatbot-app/
├── app.py                    # Main Streamlit application
├── model_serving_utils.py    # Endpoint query utilities
├── app.yaml                  # Databricks App configuration
├── requirements.txt          # Python dependencies
├── figures/
│   └── brand_logo.png       # Company logo
└── README.md                # This file

Customization

Change App Title

Edit app.py line 88:

st.markdown("<h2 style='text-align: center;'>Your App Name</h2>", unsafe_allow_html=True)

Update Page Title (Browser Tab)

Edit app.py line 8:

page_title="YourAppName",

Modify Maximum Tokens

Edit app.py line 126:

max_tokens=50_000,  # Adjust as needed

Troubleshooting

Issue: App can't find serving endpoint

Solution: Make sure the SERVING_ENDPOINT value in app.yaml matches your actual serving endpoint name exactly.

Issue: Permission denied errors

Solution: Ensure the app has CAN_QUERY permissions on the serving endpoint in the Databricks Apps configuration.

Issue: Response format not supported

Solution: This app supports multiple formats. If you encounter issues, check model_serving_utils.py to see if your format needs to be added.

Advanced Features

Multi-Agent Response Handling

The app automatically:

  • Filters out metadata messages (agent transfers, internal routing)
  • Combines multiple agent responses (e.g., data + explanation)
  • Renders markdown tables and formatted content
  • Separates distinct responses with visual dividers

Custom Response Filtering

The app filters out:

  • Messages starting with <name>... (agent identifiers)
  • Transfer notifications ("Transferring...", "Successfully transferred...")

To modify filtering logic, edit model_serving_utils.py lines 80-82.

Support

For issues or questions, please refer to the Databricks Apps documentation.

About

A simple streamlit multi-agent app interface for Databricks Apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors